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, DispatcherPriority dispatcherPriority = DispatcherPriority.Normal) { p.Dispatcher.BeginInvoke(dispatcherPriority, pAction); } private static Action EmptyDelegate = delegate() { }; public static void RefreshUI(this UIElement uiElement) { uiElement.Dispatcher.Invoke(DispatcherPriority.Render, EmptyDelegate); } } }