public void DisplayTask(FFmpegProcess taskArg)
 {
     Dispatcher.Invoke(() => {
         if (taskArg.Options.IsMainTask)
         {
             host                = taskArg;
             host.InfoUpdated   += FFmpeg_InfoUpdated;
             host.StatusUpdated += FFmpeg_StatusUpdated;
             host.Completed     += FFmpeg_Completed;
             PercentText.Text    = 0.ToString("p1");
             SetPageTitle(PercentText.Text);
         }
         else
         {
             task = taskArg;
             TaskStatusText.Text = task.Options.Title;
             task.Completed     += (sender, e) => {
                 FFmpegProcess Proc = (FFmpegProcess)sender;
                 Dispatcher.Invoke(() => {
                     if (e.Status == CompletionStatus.Error && !Proc.WorkProcess.StartInfo.FileName.EndsWith("avs2yuv.exe"))
                     {
                         FFmpegErrorWindow.Instance(Owner, Proc);
                     }
                     TaskStatusText.Text = "";
                     task = null;
                     if (autoClose)
                     {
                         this.Close();
                     }
                 });
             };
         }
     });
 }
 private void FFmpeg_Completed(object sender, FFmpeg.CompletedEventArgs e)
 {
     Dispatcher.Invoke(() => {
         FFmpegProcess Proc = sender as FFmpegProcess;
         if (e.Status == CompletionStatus.Error && !Proc.WorkProcess.StartInfo.FileName.EndsWith("avs2yuv.exe"))
         {
             FFmpegErrorWindow.Instance(Owner, Proc);
         }
         if (autoClose)
         {
             this.Close();
         }
     });
 }
 public override void DisplayError(FFmpegProcess host)
 {
     Application.Current.Dispatcher.Invoke(() => FFmpegErrorWindow.Instance(parent, host));
 }