Exemplo n.º 1
0
 public void ProcessMessage()
 {
     if (UnmanagedMethods.GetMessage(out var msg, IntPtr.Zero, 0, 0) > -1)
     {
         UnmanagedMethods.TranslateMessage(ref msg);
         UnmanagedMethods.DispatchMessage(ref msg);
     }
Exemplo n.º 2
0
 public void ProcessMessage()
 {
     UnmanagedMethods.MSG msg;
     UnmanagedMethods.GetMessage(out msg, IntPtr.Zero, 0, 0);
     UnmanagedMethods.TranslateMessage(ref msg);
     UnmanagedMethods.DispatchMessage(ref msg);
 }
Exemplo n.º 3
0
 public void Loop(CancellationToken cancellationToken)
 {
     while (!cancellationToken.IsCancellationRequested)
     {
         UnmanagedMethods.GetMessage(out var msg, IntPtr.Zero, 0, 0);
         UnmanagedMethods.TranslateMessage(ref msg);
         UnmanagedMethods.DispatchMessage(ref msg);
     }
 }
        private void RunLoop()
        {
            using (var act = _compositor5.RequestCommitAsync())
                act.SetCompleted(new RunLoopHandler(this));

            while (true)
            {
                UnmanagedMethods.GetMessage(out var msg, IntPtr.Zero, 0, 0);
                lock (_pumpLock)
                    UnmanagedMethods.DispatchMessage(ref msg);
            }
        }
Exemplo n.º 5
0
        protected override void RunFrame(DispatcherFrame frame)
        {
            do
            {
                while (this.queueBits != 0)
                {
                    for (int i = TopPriority; i > 0 && this.queueBits != 0; i--)
                    {
                        int currentBit = this.queueBits & (1 << i);
                        if (currentBit != 0)
                        {
                            PokableQueue q = this.priorityQueues[i];

                            do
                            {
                                DispatcherOperation task;

                                lock (q)
                                {
                                    task = (DispatcherOperation)q.Dequeue();
                                }

                                task.Invoke();

                                if (!frame.Continue)
                                {
                                    return;
                                }

                                if (this.HasShutdownStarted)
                                {
                                    this.PerformShutdown();
                                    return;
                                }

                                lock (q)
                                {
                                    if (q.Count == 0)
                                    {
                                        this.queueBits &= ~(1 << i);
                                        break;
                                    }
                                }

                                if (currentBit < (this.queueBits & ~currentBit))
                                {
                                    break;
                                }
                            }while (true);
                        }
                    }
                }

                UnmanagedMethods.MSG msg;
                UnmanagedMethods.GetMessage(out msg, IntPtr.Zero, 0, 0);
                UnmanagedMethods.TranslateMessage(ref msg);
                UnmanagedMethods.DispatchMessage(ref msg);

                if (this.HasShutdownStarted)
                {
                    this.PerformShutdown();
                    return;
                }
            }while (frame.Continue);
        }