diff options
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 7280bc091..788b2ba0f 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1037,6 +1037,11 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Gets or sets the static preview view model.
+ /// </summary>
+ public IStaticPreviewViewModel StaticPreviewViewModel { get; set; }
+
#endregion
#region Load and Shutdown Handling
@@ -1158,18 +1163,11 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenPreviewWindow()
{
- Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(PreviewView));
- IPreviewViewModel viewModel = IoC.Get<IPreviewViewModel>();
-
- if (window != null)
+ if (!string.IsNullOrEmpty(this.CurrentTask.Source))
{
- viewModel.Task = this.CurrentTask;
- window.Activate();
- }
- else
- {
- viewModel.Task = this.CurrentTask;
- this.WindowManager.ShowWindow(viewModel);
+ this.StaticPreviewViewModel.IsOpen = true;
+ this.StaticPreviewViewModel.UpdatePreviewFrame(this.CurrentTask);
+ this.WindowManager.ShowWindow(this.StaticPreviewViewModel);
}
}
@@ -1845,10 +1843,6 @@ namespace HandBrakeWPF.ViewModels this.ChaptersViewModel.UpdateTask(this.CurrentTask);
this.AdvancedViewModel.UpdateTask(this.CurrentTask);
- // Tell the Preivew Window
- IPreviewViewModel viewModel = IoC.Get<IPreviewViewModel>();
- viewModel.Task = this.CurrentTask;
-
// Cleanup
this.ShowStatusWindow = false;
this.SourceLabel = this.SourceName;
|