public static void PushFrame(DispatcherFrame frame)
        {
            if (frame == null)
            {
                throw new ArgumentNullException("frame");
            }

            Dispatcher dis = CurrentDispatcher;

            if (dis.HasShutdownFinished)
            {
                throw new InvalidOperationException("The Dispatcher has shut down");
            }
            if (frame.dispatcher != null)
            {
                throw new InvalidOperationException("Frame is already running on a different dispatcher");
            }
            if ((dis.flags & Flags.Disabled) != 0)
            {
                throw new InvalidOperationException("Dispatcher processing has been disabled");
            }

            frame.ParentFrame = dis.current_frame;
            dis.current_frame = frame;

            frame.dispatcher = dis;

            dis.RunFrame(frame);
        }