summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
diff options
context:
space:
mode:
authorsr55 <[email protected]>2017-08-23 22:32:28 +0100
committersr55 <[email protected]>2017-08-23 22:32:28 +0100
commitffa1a048c75be90797b9c98a8d62a5fc8b03326b (patch)
treefb87366bcb1e57c0c96acbbe5de5bf75bd64c882 /win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
parent4d3958bfaeec0fd72de01b58a40c3335d1651cf0 (diff)
WinGui: Summary Tab - Make the preview controls operational. #833
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs')
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs71
1 files changed, 70 insertions, 1 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
index cac78160b..10f53517f 100644
--- a/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/SummaryViewModel.cs
@@ -42,6 +42,7 @@ namespace HandBrakeWPF.ViewModels
private Source source;
private Title currentTitle;
private bool isMkv;
+ private int selectedPreview = 2;
public SummaryViewModel(IScan scanService, IUserSettingService userSettingService)
{
@@ -137,6 +138,8 @@ namespace HandBrakeWPF.ViewModels
public bool IsPreviousPreviewControlVisible { get; set; } = false;
public bool IsNextPreviewControlVisible { get; set; } = false;
+ public bool IsPreviewInfoVisible { get; set; } = false;
+ public string PreviewInfo { get; set; }
#endregion
@@ -289,6 +292,62 @@ namespace HandBrakeWPF.ViewModels
this.SelectedOutputFormat = container;
}
+ public void NextPreview()
+ {
+ int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
+ this.selectedPreview = this.selectedPreview + 1;
+ this.UpdatePreviewFrame();
+ this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, maxPreview);
+ this.NotifyOfPropertyChange(() => this.PreviewInfo);
+
+ if (this.selectedPreview == maxPreview)
+ {
+ this.IsNextPreviewControlVisible = false;
+ this.NotifyOfPropertyChange(() => this.IsNextPreviewControlVisible);
+ }
+ }
+
+ public void PreviousPreview()
+ {
+ int maxPreview = this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount);
+ this.selectedPreview = this.selectedPreview - 1;
+ this.UpdatePreviewFrame();
+ this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, maxPreview);
+ this.NotifyOfPropertyChange(() => this.PreviewInfo);
+
+ if (this.selectedPreview == 1)
+ {
+ this.IsPreviousPreviewControlVisible = false;
+ this.NotifyOfPropertyChange(() => this.IsPreviousPreviewControlVisible);
+ }
+ }
+
+ public void SetPreviewControlVisibility(bool isPreviousVisible, bool isNextVisible)
+ {
+ if (this.selectedPreview > 1)
+ {
+ this.IsPreviousPreviewControlVisible = isPreviousVisible;
+ }
+ else
+ {
+ this.IsPreviousPreviewControlVisible = false;
+ }
+
+ if (this.selectedPreview < this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount))
+ {
+ this.IsNextPreviewControlVisible = isNextVisible;
+ }
+ else
+ {
+ this.IsNextPreviewControlVisible = false;
+ }
+
+ this.NotifyOfPropertyChange(() => this.IsPreviousPreviewControlVisible);
+ this.NotifyOfPropertyChange(() => this.IsNextPreviewControlVisible);
+ }
+
+ #region Private Methods
+
private void UpdateSettings(Preset selectedPreset)
{
// Main Window Settings
@@ -368,6 +427,10 @@ namespace HandBrakeWPF.ViewModels
this.AspectInfo = string.Empty;
this.NotifyOfPropertyChange(() => this.AspectInfo);
+
+ // Preview
+ this.PreviewInfo = string.Format(ResourcesUI.SummaryView_PreviewInfo, this.selectedPreview, this.userSettingService.GetUserSetting<int>(UserSettingConstants.PreviewScanCount));
+ this.NotifyOfPropertyChange(() => this.PreviewInfo);
}
private string GetFilterDescription()
@@ -506,6 +569,8 @@ namespace HandBrakeWPF.ViewModels
if (this.Task.Anamorphic == Anamorphic.Loose && this.Task.Width < 32)
{
this.PreviewNotAvailable = true;
+ this.IsPreviewInfoVisible = false;
+ this.NotifyOfPropertyChange(() => this.IsPreviewInfoVisible);
return;
}
@@ -518,7 +583,7 @@ namespace HandBrakeWPF.ViewModels
BitmapImage image = null;
try
{
- image = this.scanService.GetPreview(this.Task, 2, HBConfigurationFactory.Create()); // TODO make preview image configurable?
+ image = this.scanService.GetPreview(this.Task, this.selectedPreview - 1, HBConfigurationFactory.Create());
}
catch (Exception exc)
{
@@ -530,6 +595,8 @@ namespace HandBrakeWPF.ViewModels
{
this.PreviewNotAvailable = false;
this.PreviewImage = image;
+ this.IsPreviewInfoVisible = true;
+ this.NotifyOfPropertyChange(() => this.IsPreviewInfoVisible);
this.NotifyOfPropertyChange(() => this.PreviewImage);
}
}
@@ -538,5 +605,7 @@ namespace HandBrakeWPF.ViewModels
{
this.OutputFormatChanged?.Invoke(this, e);
}
+
+ #endregion
}
}