public static void Wait(System.Windows.Threading.Dispatcher Dispatcher, int Milliseconds)
        {
            var Frame = new DispatcherFrame();

            ThreadPool.QueueUserWorkItem(State =>
            {
                Thread.Sleep(Milliseconds);
                Frame.Continue = false;
            });

            MessageBox.Show("Complete!");
            Dispatcher.PushFrame(Frame);
            MessageBox.Show("Complete 2!");
        }
Exemple #2
0
        /// <summary>
        /// Equivalent to DoEvents
        /// </summary>
        /// <seealso cref="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.pushframe.aspx"/>
        public static void DoEvents(this Dispatcher dispatcher)
        {
            if (dispatcher.IsDisabled())
            {
                return;
            }

            var frame = new DispatcherFrame();

            dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action <DispatcherFrame>((p) =>
            {
                p.Continue = false;
            }), frame);

            Dispatcher.PushFrame(frame);
        }