using System;
using System.Windows.Threading;
using System.Windows;

namespace BS.Shared.Extensions
{
    public static class ControlExtensions
    {
        public static void Dispatch(this DispatcherObject p, Action pAction)
        {
            p.Dispatcher.BeginInvoke(DispatcherPriority.Normal, pAction);
        }

        private static Action EmptyDelegate = delegate() { };


        public static void RefreshUI(this UIElement uiElement)
        {
            uiElement.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate);
        }
    }
}