private void OnRenderToDiskFinished(object sender, RenderFinishedArgs e)
 {
     animator.TaskFinished -= OnRenderToDiskFinished;
     using (var writer = new FileStream(outputFileName, FileMode.Create, FileAccess.Write, FileShare.None))
     {
         writer.Write(e.Image, 0, e.Image.Length);
         writer.Close();
     }
     DisplayPreview(e);
 }
 private void DisplayPreview(RenderFinishedArgs e)
 {
     if (e.FinishState == RenderFinishState.Success && e.Image != null)
     {
         var ms     = new MemoryStream(e.Image, false);
         var bitmap = (Bitmap)System.Drawing.Image.FromStream(ms);
         view.Preview.Child = new PictureBox
         {
             Image = bitmap
         };
     }
     else
     {
         ExceptionHandler.ShowWindow(view, e.Exception);
         ResetPreview();
     }
     RefreshCommandBindings();
 }
 private void OnPreviewRenderFinished(object sender, RenderFinishedArgs e)
 {
     DisplayPreview(e);
     animator.TaskFinished -= OnPreviewRenderFinished;
 }