Exemple #1
0
 /// <summary>
 /// Handle the Pause button click event.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The EventArgs.
 /// </param>
 private void BtnPauseClick(object sender, EventArgs e)
 {
     queue.Pause();
     MessageBox.Show(
         "No further items on the queue will start. The current encode process will continue until it is finished. \nClick 'Encode' when you wish to continue encoding the queue.",
         "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 }
        /// <summary>
        /// Checks with the use if this window can be closed.
        /// </summary>
        /// <returns>
        /// Returns true if the window can be closed.
        /// </returns>
        public bool CanClose()
        {
            IQueueProcessor processor = IoC.Get <IQueueProcessor>();

            if (processor != null && processor.EncodeService.IsEncoding)
            {
                MessageBoxResult result =
                    errorService.ShowMessageBox(
                        "An Encode is currently running. Exiting HandBrake will stop this encode.\nAre you sure you wish to continue?",
                        Resources.Warning,
                        MessageBoxButton.YesNo,
                        MessageBoxImage.Warning);

                if (result == MessageBoxResult.Yes)
                {
                    processor.Pause();
                    processor.EncodeService.Stop();
                    if (this.MainViewModel != null)
                    {
                        this.MainViewModel.Shutdown();
                    }

                    return(true);
                }
                return(false);
            }

            if (this.MainViewModel != null)
            {
                this.MainViewModel.Shutdown();
            }
            return(true);
        }