/// <summary> /// The queue processor queue completed event handler. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void QueueProcessorQueueCompleted(object sender, QueueCompletedEventArgs e) { if (e.WasManuallyStopped) { return; } if (this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction) == "Do nothing") { return; } // Give the user the ability to cancel the shutdown. Default 60 second timer. ICountdownAlertViewModel titleSpecificView = IoC.Get<ICountdownAlertViewModel>(); Caliburn.Micro.Execute.OnUIThread( () => { titleSpecificView.SetAction(this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction)); this.windowManager.ShowDialog(titleSpecificView); }); if (!titleSpecificView.IsCancelled) { // Do something whent he encode ends. switch (this.userSettingService.GetUserSetting<string>(UserSettingConstants.WhenCompleteAction)) { case "Shutdown": Process.Start("Shutdown", "-s -t 60"); break; case "Log off": Win32.ExitWindowsEx(0, 0); break; case "Suspend": System.Windows.Forms.Application.SetSuspendState(PowerState.Suspend, true, true); break; case "Hibernate": System.Windows.Forms.Application.SetSuspendState(PowerState.Hibernate, true, true); break; case "Lock System": Win32.LockWorkStation(); break; case "Quit HandBrake": Execute.OnUIThread(() => Application.Current.Shutdown()); break; } } }
/// <summary> /// The on queue completed. /// </summary> /// <param name="e"> /// The e. /// </param> protected virtual void OnQueueCompleted(QueueCompletedEventArgs e) { QueueCompletedEventDelegate handler = this.QueueCompleted; if (handler != null) { handler(this, e); } this.IsProcessing = false; }