void CurrentEncoder_SelectionChanged(object Sender, System.Windows.Controls.SelectionChangedEventArgs E) { int ListIndex = MediaList.SelectedIndex; int EncoderIndex = CurrentEncoder.SelectedIndex; if (_IgnoreCurrentUpdates || Sender == null || ListIndex < 0 || EncoderIndex < 0) { return; } MediaProcessor MediaProcessor = (MediaProcessor)MediaList.Items[ListIndex]; MediaProcessor.PreferredEncoder = (Encoder)CurrentEncoder.Items[EncoderIndex]; MediaList.Items[ListIndex] = MediaProcessor; MediaList.SelectedIndex = ListIndex; }
void CurrentPath_OnChange(string NewPath) { int ListIndex = MediaList.SelectedIndex; if (_IgnoreCurrentUpdates || ListIndex < 0 || NewPath.IsNullOrEmpty()) { return; } MediaProcessor MediaProcessor = (MediaProcessor)MediaList.Items[ListIndex]; if (NewPath.TryGetFile(out FileInfo DestinationFile)) { MediaProcessor.DestinationFile = DestinationFile; MediaList.Items[ListIndex] = MediaProcessor; MediaList.SelectedIndex = ListIndex; } }
public async Task ProcessAllFiles() { foreach (MediaProcessor MediaProcessor in MediaList.Items) { Debug.WriteLine("Will process from processor: " + MediaProcessor.ToLogString()); Process Process = MediaProcessor.GetProcess(); //Process.StartInfo.RedirectStandardInput = true; Process.StartInfo.UseShellExecute = false; Process.StartInfo.CreateNoWindow = true; Process.StartInfo.RedirectStandardOutput = true; Process.StartInfo.RedirectStandardError = true; Process.Start(); Process.OutputDataReceived += Process_OutputDataReceived; Process.BeginOutputReadLine(); Process.BeginErrorReadLine(); await Process.WaitForExitAsync(); //new MediaProcessor(File).GetProcess().Start(); } }
void MediaList_SelectionChanged(object Sender, System.Windows.Controls.SelectionChangedEventArgs E) { _IgnoreCurrentUpdates = true; int SelectedIndex = MediaList.SelectedIndex; if (Sender == null || SelectedIndex < 0) { CurrentPanel.IsEnabled = false; CurrentEncoder.SelectedIndex = -1; CurrentPath.SelectedSavePath = ""; _IgnoreCurrentUpdates = false; } else { MediaProcessor MediaProcessor = (MediaProcessor)MediaList.Items[SelectedIndex]; CurrentEncoder.SelectedIndex = (int)MediaProcessor.PreferredEncoder; CurrentPath.SelectedSavePath = MediaProcessor.DestinationFile.FullName; CurrentPanel.IsEnabled = true; } _IgnoreCurrentUpdates = false; }