Exemplo n.º 1
0
        /// <summary>
        /// Occurs when the button is clicked.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> that contains the event data.</param>
        private void OnStartProcessingButtonClick(object sender, RoutedEventArgs e)
        {
            if (!backgroundWorker.IsBusy)
            {
                // Show the overlay
                WindowChrome.SetIsOverlayVisible(this, true);

                // Start the background worker
                backgroundWorker.RunWorkerAsync();
            }
        }
Exemplo n.º 2
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occurs when a key is pressed while the control has focus.
        /// </summary>
        /// <param name="e">A <see cref="KeyEventArgs"/> that contains the event data.</param>
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            // Call the base method
            base.OnKeyDown(e);

            if (!e.Handled)
            {
                switch (e.Key)
                {
                case Key.Escape:
                    // Ensure the overlay is closed when Esc is pressed
                    if (WindowChrome.GetIsOverlayVisible(window))
                    {
                        WindowChrome.SetIsOverlayVisible(window, false);
                    }
                    break;
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Occurs when the background worker has completed work.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The <see cref="DoWorkEventArgs"/> that contains the event data.</param>
 private void OnBackgroundWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     // Hide the overlay
     WindowChrome.SetIsOverlayVisible(this, false);
 }