private async void OkButton_Click(object sender, RoutedEventArgs e) { try { OkButton.IsEnabled = false; //player.Close(); MediaEncoderBusiness business = new MediaEncoderBusiness(); if (ReplaceOption.IsChecked.Value) { // await Task.Run(() => business.FinalizeReplace(jobInfo)); } else if (KeepOption.IsChecked.Value) { await Task.Run(() => business.FinalizeKeep(jobInfo)); } if (ReencodeCheckbox.IsChecked.Value) { MainWindow.Instance.EditEncodingTask(jobInfo.Settings); } PathManager.DeleteJobFiles(jobInfo.Settings.JobIndex); jobInfo.Settings.JobIndex = -1; this.Close(); Owner?.Focus(); } catch (Exception ex) { OkButton.IsEnabled = true; MessageBox.Show(this, ex.Message, "File Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// Cancels an encoding task and display it to change settings. /// </summary> /// <param name="settings">The encoding task to display.</param> public async void EditEncodingTask(MediaEncoderSettings settings) { HidePreview(); await business.MovePreviewFilesAsync(settings); SetEncodeSettings(settings); PathManager.DeleteJobFiles(settings.JobIndex); settings.JobIndex = -1; business.ProcessingQueue.Remove(settings); }
private async void OkButton_Click(object sender, RoutedEventArgs e) { MediaEncoderBusiness business = MainWindow.Instance.business; try { OkButton.IsEnabled = false; if (ResumeOption.IsChecked == true) { business.AddJobToQueue(jobInfo.Settings); } else if (RestartOption.IsChecked == true) { EncoderBusiness.EditStartPosition(jobInfo.Settings.ScriptFile, 0, 0); PathManager.DeleteOutputFiles(jobInfo.Settings.JobIndex); business.AddJobToQueue(jobInfo.Settings); } else if (DeleteOption.IsChecked == true) { PathManager.DeleteJobFiles(jobInfo.Settings.JobIndex); } else if (ChangeOption.IsChecked == true) { MainWindow.Instance.HidePreview(); await business.MovePreviewFilesAsync(jobInfo.Settings); MainWindow.Instance.SetEncodeSettings(jobInfo.Settings); PathManager.DeleteJobFiles(jobInfo.Settings.JobIndex); jobInfo.Settings.JobIndex = -1; } this.Close(); Owner?.Focus(); } catch (Exception ex) { OkButton.IsEnabled = true; MessageBox.Show(this, ex.Message, "File Error", MessageBoxButton.OK, MessageBoxImage.Error); } }