diff options
author | sr55 <[email protected]> | 2014-05-24 17:25:48 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2014-05-24 17:25:48 +0000 |
commit | 9ab2cefc88f522c02817a248e2b8d964d186c04f (patch) | |
tree | 643d7aca00d99162a5eef4a05f4b29601de45b87 /win/CS | |
parent | 281c44b0914b21ff6dea0b401a0312d09197a4c3 (diff) |
WinGui: Don't grab previews when the preview window hasn't been opened. (Note, there is still a crash that sometimes happens for some resolutions that needs fixed, but the UI shouldn't crash anymore if the window hasn't been opened)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6205 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
3 files changed, 13 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs index a1d6b465c..6d42d4d55 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IStaticPreviewViewModel.cs @@ -23,5 +23,10 @@ namespace HandBrakeWPF.ViewModels.Interfaces /// The task.
/// </param>
void UpdatePreviewFrame(EncodeTask task);
+
+ /// <summary>
+ /// Gets or sets a value indicating whether is open.
+ /// </summary>
+ bool IsOpen { get; set; }
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index b10c0f292..51c018ad9 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -12,6 +12,7 @@ namespace HandBrakeWPF.ViewModels using System;
using System.Collections.Generic;
using System.Globalization;
+ using System.Windows;
using System.Windows.Media.Imaging;
using Caliburn.Micro;
@@ -825,6 +826,7 @@ namespace HandBrakeWPF.ViewModels {
if (!string.IsNullOrEmpty(this.Task.Source))
{
+ this.StaticPreviewViewModel.IsOpen = true;
this.StaticPreviewViewModel.UpdatePreviewFrame(this.Task);
this.WindowManager.ShowWindow(this.StaticPreviewViewModel);
}
@@ -1197,7 +1199,7 @@ namespace HandBrakeWPF.ViewModels /// </summary>
private void UpdatePreviewImage()
{
- if (delayedPreviewprocessor != null && this.Task != null)
+ if (delayedPreviewprocessor != null && this.Task != null && this.StaticPreviewViewModel != null && this.StaticPreviewViewModel.IsOpen)
{
delayedPreviewprocessor.PerformTask(() => this.StaticPreviewViewModel.UpdatePreviewFrame(this.Task), 800);
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index 279cc6fc8..622319f61 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -195,6 +195,11 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Gets or sets a value indicating whether is open.
+ /// </summary>
+ public bool IsOpen { get; set; }
+
+ /// <summary>
/// The update preview frame.
/// </summary>
public void UpdatePreviewFrame()
|