Пример #1
0
        /// <summary>
        /// Constructs a window
        /// </summary>
        public Window()
        {
            // Save UI thread's dispatcher.
            Dispatcher = Dispatcher.CurrentDispatcher;

            Dispatcher.ShutdownStarted += (object sender, EventArgs e) => {
                // Raise the abort flag to gracefully shutdown all background threads.
                Abort.Cancel();
            };
        }
Пример #2
0
        /// <summary>
        /// Constructs a window
        /// </summary>
        public Window()
        {
            // Save UI thread's dispatcher.
            Dispatcher = Dispatcher.CurrentDispatcher;

            Dispatcher.UnhandledException += (object sender, DispatcherUnhandledExceptionEventArgs e) =>
            {
                if (!(e.Exception is OperationCanceledException))
                {
                    Error = e.Exception;
                }
                e.Handled = true;
            };

            Dispatcher.ShutdownStarted += (object sender, EventArgs e) =>
            {
                // Raise the abort flag to gracefully shutdown all background threads.
                Abort.Cancel();
            };
        }