Here are the examples of the csharp api class System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
42 Examples
0
1. Example
View licensepublic static void DoEvents(this Dispatcher dispatcher, DispatcherPriority priority = DispatcherPriority.Background) { var frame = new DispatcherFrame(); dispatcher.BeginInvoke(() => frame.Continue = false, priority); Dispatcher.PushFrame(frame); }
0
2. Example
View licensepublic static void DoEvents(DispatcherPriority priority = DispatcherPriority.Background) { DispatcherObject dispObj = (Instance ?? DXSplashScreen.SplashContainer.ActiveInfo.SplashScreen); if(dispObj == null) return; DispatcherFrame frame = new DispatcherFrame(); dispObj.Dispatcher.BeginInvoke( priority, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
3. Example
View licensepublic static void DoEvents(DispatcherPriority priority = DispatcherPriority.Background) { DispatcherObject dispObj = DXSplashScreen.SplashContainer.ActiveInfo.SplashScreen; if(dispObj == null) return; DispatcherFrame frame = new DispatcherFrame(); dispObj.Dispatcher.BeginInvoke( priority, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
4. Example
View licensepublic static void DoEvents(DispatcherPriority priority) { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke( priority, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
5. Example
View licenseprivate static void DoEvents() { var frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.Background, new Action<DispatcherFrame>(f => f.Continue = false), frame); Dispatcher.PushFrame(frame); }
0
6. Example
View licensepublic static void ProcessUiTasks() { var frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.Background, new DispatcherOperationCallback( delegate { frame.Continue = false; return null; }), null); Dispatcher.PushFrame(frame); }
0
7. Example
View license[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] public void DoEvents() { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
8. Example
View licensepublic void BeginModal() { FormStatus.Start(); Dispatcher.PushFrame(DispatcherFrame); }
0
9. Example
View licenseinternal static void DoEvents() { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
10. Example
View license[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] internal static void DoEvents() { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
11. Example
View license[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] internal static void DoEvents() { var frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
12. Example
View licensepublic static void PumpDispatcher() { // This is dispatcher magic. I'm not 100% sure how it works, but this is the karmic equiv. of // Application.DoEvents() in the Winforms world, and allows any items in the dispatchers queue to be processed DispatcherFrame f = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new DispatcherOperationCallback((p) => { ((DispatcherFrame)p).Continue = false; return null; }), f); Dispatcher.PushFrame(f); }
0
13. Example
View licensepublic Task<ExecutionResult> Execute(IReplWindow window, string arguments) { var delay = new TimeSpan(0, 0, 0, 0, int.Parse(arguments)); var start = DateTime.UtcNow; while ((start + delay) > DateTime.UtcNow) { var frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.Background, new Action<DispatcherFrame>(f => f.Continue = false), frame ); Dispatcher.PushFrame(frame); } return ExecutionResult.Succeeded; }
0
14. Example
View licenseprivate static void DoEvents() { var frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.Background, new Action<DispatcherFrame>(f => f.Continue = false), frame ); Dispatcher.PushFrame(frame); }
0
15. Example
View licensepublic virtual bool Publish(PublishProjectOptions publishOptions, bool async) { string p/n ..... /n //View Source file for more details /n }
0
16. Example
View licensepublic virtual bool Publish(PublishProjectOptions publishOptions, bool async) { /n ..... /n //View Source file for more details /n }
0
17. Example
View licensepublic static void DoEvents(Dispatcher disp = null) { DispatcherFrame frame = new DispatcherFrame(); if(disp == null) { disp = Dispatcher.CurrentDispatcher; } disp.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
18. Example
View licenseprivate static void DoEvents() { var frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.Background, new Action<DispatcherFrame>(f => f.Continue = false), frame); Dispatcher.PushFrame(frame); }
0
19. Example
View license[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] public static void DoEvents() { var frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
20. Example
View licenseprivate static void RunAsyncAction(DispatcherPriority priority = DispatcherPriority.ContextIdle) { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(priority, new DispatcherOperationCallback(f => { ((DispatcherFrame)f).Continue = false; return null; }), frame); Dispatcher.PushFrame(frame); }
0
21. Example
View licensepublic static void DispatchFrame(DispatcherPriority priority = DispatcherPriority.Background) { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(priority, new DispatcherOperationCallback((f)=>((DispatcherFrame)f).Continue = false), frame); Dispatcher.PushFrame(frame); }
0
22. Example
View licensepublic static void ProcessMessages([NotNull] this Dispatcher dispatcher, DispatcherPriority priority) { Contract.Requires(dispatcher != null); var frame = new DispatcherFrame(); dispatcher.BeginInvoke(priority, () => frame.Continue = false); Dispatcher.PushFrame(frame); }
0
23. Example
View licensepublic static void DoEvents() { var frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(dispatcherFrame => { ((DispatcherFrame)dispatcherFrame).Continue = false; return null; }), frame); Dispatcher.PushFrame(frame); }
0
24. Example
View licensepublic static void DoEvents(DispatcherPriority priority = DispatcherPriority.Background) { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke( priority, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
25. Example
View licensepublic static void DoEvents(DispatcherPriority priority = DispatcherPriority.Background) { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke( priority, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
26. Example
View license[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)] public static void DoEvents() { DispatcherFrame frame = new DispatcherFrame(); Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); System.Windows.Forms.Application.DoEvents(); }
0
27. Example
View licensepublic static void DoEvents(this Dispatcher dispatcher) { // A DispatcherFrame represents a loop that processes pending work // items. var frame = new DispatcherFrame(); var callback = (Action<DispatcherFrame>)(f => f.Continue = false); // Executes the specified delegate asynchronously. When it is // complete mark the frame as complete so the dispatcher loop // pops out (stops). var operation = dispatcher.BeginInvoke( DispatcherPriority.SystemIdle, callback, frame); // Start the loop. It will process all items in the queue, then // will process the above callback. That callback will tell the // loop to then stop processing. Dispatcher.PushFrame(frame); if (operation.Status != DispatcherOperationStatus.Completed) { operation.Abort(); } }
0
28. Example
View licensepublic static void WaitForPriority() { // Create new nested message pump. var nestedFrame = new DispatcherFrame(); // Dispatch a callback to the current message queue, when getting called, // this callback will end the nested message loop. // The priority of this callback should be lower than that of event message you want to process. var exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke( DispatcherPriority.ContextIdle, ExitFrameCallback, nestedFrame); // pump the nested message loop, the nested message loop will immediately // process the messages left inside the message queue. Dispatcher.PushFrame(nestedFrame); // If the "exitFrame" callback is not finished, abort it. if (exitOperation.Status != DispatcherOperationStatus.Completed) { exitOperation.Abort(); } }
0
29. Example
View licensepublic void DoEvents() { if (TaskUtilities.IsOnBackgroundThread()) { DoEventsAsync().WaitAndUnwrapExceptions(); return; } var frame = new DispatcherFrame(); _application.Dispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame); Dispatcher.PushFrame(frame); }
0
30. Example
View licensepublic static void DoEvents(this Dispatcher dispatcher) { // A DispatcherFrame represents a loop that processes pending work // items. var frame = new DispatcherFrame(); var callback = (Action<DispatcherFrame>)(f => f.Continue = false); // Executes the specified delegate asynchronously. When it is // complete mark the frame as complete so the dispatcher loop // pops out (stops). var operation = dispatcher.BeginInvoke( DispatcherPriority.Background, callback, frame); // Start the loop. It will process all items in the queue, then // will process the above callback. That callback will tell the // loop to then stop processing. Dispatcher.PushFrame(frame); if (operation.Status != DispatcherOperationStatus.Completed) { operation.Abort(); } }
0
31. Example
View licensepublic static void DoEvents(this Application app, DispatcherPriority priority = DispatcherPriority.Background) { var nestedFrame = new DispatcherFrame(); var exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke(priority, ExitFrameCallback, nestedFrame); try { //execute all next message Dispatcher.PushFrame(nestedFrame); //If not completed, will stop it if (exitOperation.Status != DispatcherOperationStatus.Completed) exitOperation.Abort(); } catch { exitOperation.Abort(); } }
0
32. Example
View licensepublic bool? ShowDialog() { if(m_frame != null) throw new InvalidOperationException("Already showing dialog"); var owner = Owner as IDialogSite; if(owner == null) throw new InvalidOperationException("Owner must implement IDialogSite"); m_dialogResult = null; owner.Site.Children.Add(m_dialogContent); owner.ShowSite(); m_frame = new DispatcherFrame(); Dispatcher.PushFrame(m_frame); return m_dialogResult; }
0
33. Example
View licensepublic static void WaitForPriority(this Dispatcher dispatcher, DispatcherPriority priority) { DispatcherFrame frame = new DispatcherFrame(); DispatcherOperation dispatcherOperation = dispatcher.BeginInvoke(priority, new DispatcherOperationCallback(ExitFrameOperation), frame); Dispatcher.PushFrame(frame); if (dispatcherOperation.Status != DispatcherOperationStatus.Completed) { dispatcherOperation.Abort(); } }
0
34. Example
View licensepublic void DoEvents(int ms) { if (ms < 0) { throw new ArgumentOutOfRangeException(nameof(ms)); } if (ms == 0) { DoEvents(); } else if (TaskUtilities.IsOnBackgroundThread()) { Task.Delay(ms) .ContinueWith(t => DoEventsAsync()) .Wait(); } else { var frame = new DispatcherFrame(); Task.Delay(ms) .ContinueWith(t => _application.Dispatcher.BeginInvoke(DispatcherPriority.Background, new DispatcherOperationCallback(ExitFrame), frame)); Dispatcher.PushFrame(frame); } }
0
35. Example
View licenseprivate bool BlockOnUiThread(System.Action action) { var dispather = Dispatcher.CurrentDispatcher; if (!dispather.CheckAccess()) return false; Debug.Assert(_frame == null, "Do not reuse existing thread blocker, create a new one instead."); _frame = new DispatcherFrame(true); action(); // this will block until completed is called Dispatcher.PushFrame(_frame); _frame = null; return true; }
0
36. Example
View licenseprivate void Run() { frame = new DispatcherFrame(true); dispatcher = Dispatcher.CurrentDispatcher; Action action = () => { TaskFactory = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext()); startedEvent.Set(); }; dispatcher.BeginInvoke(action); Dispatcher.PushFrame(frame); }
0
37. Example
View licensepublic void Show() { ValidateOwner(); InlineModalDecorator panel = GetModalDecorator(Owner); if (panel == null) return; panel.AddModal(this, ShowBlurrer); if (Animator.IsAnimationEnabled) { Storyboard dialogAnim = DialogIntroAnimation; if (dialogAnim != null) { if (dialogAnim.IsFrozen) { dialogAnim = dialogAnim.Clone(); } dialogAnim.AttachCompletedEventHandler(OnOpenAnimationCompleted); dialogAnim.Begin(this); } } else { OpenCompleted(); } _dispatcherFrame = new DispatcherFrame(); Dispatcher.PushFrame(_dispatcherFrame); _isOpen = false; }
0
38. Example
View licensepublic static void RunInWpfSyncContext(Func<Task> function) { if (function == null) throw new ArgumentNullException("function"); var prevCtx = SynchronizationContext.Current; try { var syncCtx = new DispatcherSynchronizationContext(); SynchronizationContext.SetSynchronizationContext(syncCtx); var task = function(); if (task == null) throw new InvalidOperationException(); var frame = new DispatcherFrame(); var t2 = task.ContinueWith(x => { frame.Continue = false; }, TaskScheduler.Default); Dispatcher.PushFrame(frame); // execute all tasks until frame.Continue == false task.GetAwaiter().GetResult(); // rethrow exception when task has failed } finally { SynchronizationContext.SetSynchronizationContext(prevCtx); } }
0
39. Example
View licensepublic static void RunInWpfSyncContext(Func<Task> function) { if (function == null) throw new ArgumentNullException("function"); var prevCtx = SynchronizationContext.Current; try { var syncCtx = new DispatcherSynchronizationContext(); SynchronizationContext.SetSynchronizationContext(syncCtx); var task = function(); if (task == null) throw new InvalidOperationException(); var frame = new DispatcherFrame(); var t2 = task.ContinueWith(x => { frame.Continue = false; }, TaskScheduler.Default); Dispatcher.PushFrame(frame); // execute all tasks until frame.Continue == false task.GetAwaiter().GetResult(); // rethrow exception when task has failed } finally { SynchronizationContext.SetSynchronizationContext(prevCtx); } }
0
40. Example
View licensepublic Task<RunSummary> RunAsync (IMessageSink diagnosticMessageSink, IMessageBus m/n ..... /n //View Source file for more details /n }
0
41. Example
View licensepublic static void ShowWindow() { System.Threading.AutoResetEvent windowShown = new System.Threading.AutoResetEvent(false); ExecuteInSTA(() => { Window window = null; try { window = new InteractiveWindow(); window.Show(); windowShown.Set(); var _dispatcherFrame = new System.Windows.Threading.DispatcherFrame(); window.Closed += (obj, e) => { _dispatcherFrame.Continue = false; }; System.Windows.Threading.Dispatcher.PushFrame(_dispatcherFrame); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { windowShown.Set(); } window?.Close(); System.Windows.Threading.Dispatcher.CurrentDispatcher.InvokeShutdown(); }, waitForExecution: false); windowShown.WaitOne(); }
0
42. Example
View licenseprivate void RunMainThread(object obj) { if (Application.Current != null) { /n ..... /n //View Source file for more details /n }