예제 #1
0
        /// <summary>
        /// Starts the app, asynchronously.
        /// </summary>
        /// <returns>A task that will complete when the app exits</returns>
        public Task Start()
        {
            Task pumpTask = MessagePump.Start();
            var  ret      = pumpTask.ContinueWith((t) =>
            {
                ExitInternal();
            });

            if (SetFocusOnStart)
            {
                MessagePump.QueueAction(() => { FocusManager.TryMoveFocus(); });
            }

            MessagePump.QueueAction(() =>
            {
                if (_current != null)
                {
                    throw new NotSupportedException("An application is already running on this thread.");
                }
                // ensures that the current app is set on the message pump thread
                _current = this;
            });
            Paint();

            return(ret);
        }
예제 #2
0
 /// <summary>
 /// Queues up a request to paint the app.  The system will dedupe multiple paint requests when there are multiple in the pump's work queue
 /// </summary>
 public void Paint()
 {
     MessagePump.QueueAction(new PaintMessage(PaintInternal));
 }