diff options
author | Scott <[email protected]> | 2015-10-09 22:22:28 +0100 |
---|---|---|
committer | Scott <[email protected]> | 2015-10-24 19:50:57 +0100 |
commit | f08c123b7723df0a84b5b72cbb485c052cb7747a (patch) | |
tree | 3acdac3073e292557c70e1e6c9c161750aa72054 /win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | |
parent | 913ca255c13ba8cdc35e9b2bf1c1c6bdc6c42fba (diff) |
Initial commit to allow the Queue Window to be embedded in the main window. Still some UX/UI stuff to tidy up later.
Diffstat (limited to 'win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 159 |
1 files changed, 40 insertions, 119 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index a9ec52071..7a1f586a2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -62,144 +62,36 @@ namespace HandBrakeWPF.ViewModels {
#region Private Variables and Services
- /// <summary>
- /// The Encode Service
- /// </summary>
private readonly IQueueProcessor queueProcessor;
-
- /// <summary>
- /// The preset service
- /// </summary>
private readonly IPresetService presetService;
-
- /// <summary>
- /// The Error Service Backing field.
- /// </summary>
private readonly IErrorService errorService;
-
- /// <summary>
- /// Backing field for the update serivce.
- /// </summary>
private readonly IUpdateService updateService;
-
private readonly IWindowManager windowManager;
-
- /// <summary>
- /// Backing field for the user setting service.
- /// </summary>
private readonly IUserSettingService userSettingService;
-
- /// <summary>
- /// The Source Scan Service.
- /// </summary>
private readonly IScan scanService;
-
- /// <summary>
- /// The Encode Service
- /// </summary>
private readonly IEncode encodeService;
-
- /// <summary>
- /// Windows 7 API Pack wrapper
- /// </summary>
private readonly Win7 windowsSeven = new Win7();
-
- /// <summary>
- /// HandBrakes Main Window Title
- /// </summary>
private string windowName;
-
- /// <summary>
- /// The Source Label
- /// </summary>
private string sourceLabel;
-
- /// <summary>
- /// The Selected Output Format Backing Field
- /// </summary>
private OutputFormat selectedOutputFormat;
-
- /// <summary>
- /// Is a MKV file backing field
- /// </summary>
private bool isMkv;
-
- /// <summary>
- /// The Toolbar Status Label
- /// </summary>
private string statusLabel;
-
- /// <summary>
- /// Program Status Label
- /// </summary>
private string programStatusLabel;
-
- /// <summary>
- /// Backing field for the scanned source.
- /// </summary>
private Source scannedSource;
-
- /// <summary>
- /// Backing field for the selected title.
- /// </summary>
private Title selectedTitle;
-
- /// <summary>
- /// Backing field for duration
- /// </summary>
private string duration;
-
- /// <summary>
- /// Is Encoding Backing Field
- /// </summary>
private bool isEncoding;
-
- /// <summary>
- /// An Indicated to show the status window
- /// </summary>
private bool showStatusWindow;
-
- /// <summary>
- /// Backing field for the selected preset.
- /// </summary>
private Preset selectedPreset;
-
- /// <summary>
- /// Queue Edit Task
- /// </summary>
private EncodeTask queueEditTask;
-
- /// <summary>
- /// The last percentage complete value.
- /// </summary>
private int lastEncodePercentage;
-
- /// <summary>
- /// The is preset panel showing.
- /// </summary>
private bool isPresetPanelShowing;
-
- /// <summary>
- /// The show source selection.
- /// </summary>
private bool showSourceSelection;
-
- /// <summary>
- /// The drives.
- /// </summary>
private BindingList<SourceMenuItem> drives;
-
- /// <summary>
- /// The can pause.
- /// </summary>
private bool canPause;
-
private bool showAlertWindow;
-
private string alertWindowHeader;
-
private string alertWindowText;
-
private bool hasSource;
#endregion
@@ -257,11 +149,15 @@ namespace HandBrakeWPF.ViewModels /// <param name="staticPreviewViewModel">
/// The static Preview View Model.
/// </param>
+ /// <param name="queueViewModel">
+ /// The queue View Model.
+ /// </param>
public MainViewModel(IUserSettingService userSettingService, IScan scanService, IEncode encodeService, IPresetService presetService,
IErrorService errorService, IUpdateService updateService,
IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel,
IFiltersViewModel filtersViewModel, IAudioViewModel audioViewModel, ISubtitlesViewModel subtitlesViewModel,
- IAdvancedViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel)
+ IAdvancedViewModel advancedViewModel, IChaptersViewModel chaptersViewModel, IStaticPreviewViewModel staticPreviewViewModel,
+ IQueueViewModel queueViewModel)
{
this.scanService = scanService;
this.encodeService = encodeService;
@@ -269,6 +165,7 @@ namespace HandBrakeWPF.ViewModels this.errorService = errorService;
this.updateService = updateService;
this.windowManager = windowManager;
+ this.QueueViewModel = queueViewModel;
this.userSettingService = userSettingService;
this.queueProcessor = IoC.Get<IQueueProcessor>();
@@ -341,6 +238,16 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public IFiltersViewModel FiltersViewModel { get; set; }
+ /// <summary>
+ /// Gets or sets the queue view model.
+ /// </summary>
+ public IQueueViewModel QueueViewModel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the static preview view model.
+ /// </summary>
+ public IStaticPreviewViewModel StaticPreviewViewModel { get; set; }
+
#endregion
#region Properties
@@ -1076,11 +983,6 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
- /// Gets or sets the static preview view model.
- /// </summary>
- public IStaticPreviewViewModel StaticPreviewViewModel { get; set; }
-
- /// <summary>
/// Gets the cancel action.
/// </summary>
public Action CancelAction
@@ -1204,6 +1106,11 @@ namespace HandBrakeWPF.ViewModels }
}
+ /// <summary>
+ /// Flag to indicate if the queue is showing on the main view. (I.e inline queue display)
+ /// </summary>
+ public bool IsQueueShowingInLine { get; set; } = false;
+
#endregion
#region Load and Shutdown Handling
@@ -1309,15 +1216,29 @@ namespace HandBrakeWPF.ViewModels /// </summary>
public void OpenQueueWindow()
{
- Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.GetType() == typeof(QueueView));
-
- if (window != null)
+ if (this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowQueueInline))
{
- window.Activate();
+ this.IsQueueShowingInLine = !this.IsQueueShowingInLine;
+ this.NotifyOfPropertyChange(() => this.IsQueueShowingInLine);
+ this.QueueViewModel.Activate(true);
}
else
{
- this.windowManager.ShowWindow(IoC.Get<IQueueViewModel>());
+ this.IsQueueShowingInLine = false;
+ this.NotifyOfPropertyChange(() => this.IsQueueShowingInLine);
+
+ this.QueueViewModel.Activate(false);
+ Window window = Application.Current.Windows.Cast<Window>().FirstOrDefault(x => x.Content.GetType() == typeof(QueueView));
+
+ if (window != null)
+ {
+ window.Activate();
+ }
+ else
+ {
+ // TODO to control the size of this window, we will probably have to create a new window for hosting the queue.
+ this.windowManager.ShowWindow(this.QueueViewModel);
+ }
}
}
|