From: sr55 Date: Sat, 12 Jan 2019 19:48:22 +0000 (+0000) Subject: WinGui: Minor tidyup in MVM. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe32f6cd3bec6dd30f353fbf444394f017cb36a6;p=handbrake WinGui: Minor tidyup in MVM. --- diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 924b08ebf..4c6f3ad4c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -57,8 +57,8 @@ namespace HandBrakeWPF.ViewModels using DataFormats = System.Windows.DataFormats; using DragEventArgs = System.Windows.DragEventArgs; using Execute = Caliburn.Micro.Execute; - using HandBrakeInstanceManager = HandBrakeWPF.Instance.HandBrakeInstanceManager; - using LogManager = HandBrakeWPF.Helpers.LogManager; + using HandBrakeInstanceManager = Instance.HandBrakeInstanceManager; + using LogManager = Helpers.LogManager; using OpenFileDialog = Microsoft.Win32.OpenFileDialog; using SaveFileDialog = Microsoft.Win32.SaveFileDialog; @@ -108,62 +108,7 @@ namespace HandBrakeWPF.ViewModels /// Initializes a new instance of the class. /// The viewmodel for HandBrakes main window. /// - /// - /// The User Setting Service - /// - /// - /// The scan Service. - /// - /// - /// The preset Service. - /// - /// - /// The Error Service - /// - /// - /// The update Service. - /// - /// - /// The when Done Service. - /// *** Leave in Constructor. *** - /// - /// - /// The window Manager. - /// - /// - /// The picture Settings View Model. - /// - /// - /// The video View Model. - /// - /// - /// The summary view model. - /// - /// - /// The filters View Model. - /// - /// - /// The audio View Model. - /// - /// - /// The subtitles View Model. - /// - /// - /// The advanced View Model. - /// - /// - /// The chapters View Model. - /// - /// - /// The static Preview View Model. - /// - /// - /// The queue View Model. - /// - /// - /// The Meta Data View Model - /// - /// Wrapper around the WinForms NotifyIcon for this app. + /// whenDoneService must be a serivce here! public MainViewModel(IUserSettingService userSettingService, IScan scanService, IPresetService presetService, IErrorService errorService, IUpdateService updateService, IPrePostActionService whenDoneService, IWindowManager windowManager, IPictureSettingsViewModel pictureSettingsViewModel, IVideoViewModel videoViewModel, ISummaryViewModel summaryViewModel, @@ -246,68 +191,23 @@ namespace HandBrakeWPF.ViewModels #region View Model Properties - /// - /// Gets or sets PictureSettingsViewModel. - /// public IPictureSettingsViewModel PictureSettingsViewModel { get; set; } - - /// - /// Gets or sets AudioViewModel. - /// public IAudioViewModel AudioViewModel { get; set; } - - /// - /// Gets or sets SubtitleViewModel. - /// public ISubtitlesViewModel SubtitleViewModel { get; set; } - - /// - /// Gets or sets ChaptersViewModel. - /// public IChaptersViewModel ChaptersViewModel { get; set; } - - /// - /// Gets or sets VideoViewModel. - /// public IVideoViewModel VideoViewModel { get; set; } - - /// - /// Gets or sets FiltersViewModel. - /// public IFiltersViewModel FiltersViewModel { get; set; } - - /// - /// Gets or sets the queue view model. - /// public IQueueViewModel QueueViewModel { get; set; } - - /// - /// Gets or sets the static preview view model. - /// public IStaticPreviewViewModel StaticPreviewViewModel { get; set; } - - /// - /// Gets or sets the The MetaData View Model - /// public IMetaDataViewModel MetaDataViewModel { get; set; } - public ISummaryViewModel SummaryViewModel { get; set; } - /// - /// Active Tab. - /// - /// - /// Should move this to the view when refactoring the keyboard shotcut handling. - /// public int SelectedTab { get; set; } #endregion #region Properties - /// - /// Gets or sets TestProperty. - /// public string WindowTitle { get @@ -369,9 +269,6 @@ namespace HandBrakeWPF.ViewModels public bool QueueRecoveryArchivesExist { get; set; } - /// - /// Gets or sets Presets. - /// public IEnumerable PresetsCategories { get; set; } public IPresetObject SelectedPresetCategory @@ -411,9 +308,6 @@ namespace HandBrakeWPF.ViewModels } } - /// - /// Gets or sets SelectedPreset. - /// public Preset SelectedPreset { get @@ -450,12 +344,6 @@ namespace HandBrakeWPF.ViewModels } } - public void TrickPresetDisplayUpdate() - { - this.NotifyOfPropertyChange(() => this.SelectedPreset); - this.selectedPreset.IsSelected = true; - } - /// /// Gets or sets The Current Encode Task that the user is building /// @@ -580,13 +468,7 @@ namespace HandBrakeWPF.ViewModels /// /// Gets a value indicating whether ShowTextEntryForPointToPointMode. /// - public bool ShowTextEntryForPointToPointMode - { - get - { - return this.SelectedPointToPoint != PointToPointMode.Chapters; - } - } + public bool ShowTextEntryForPointToPointMode => this.SelectedPointToPoint != PointToPointMode.Chapters; /// /// Gets StartEndRangeItems. @@ -595,12 +477,7 @@ namespace HandBrakeWPF.ViewModels { get { - if (this.SelectedTitle == null) - { - return null; - } - - return this.SelectedTitle.Chapters.Select(item => item.ChapterNumber).Select(dummy => dummy).ToList(); + return this.SelectedTitle?.Chapters.Select(item => item.ChapterNumber).Select(dummy => dummy).ToList(); } } @@ -679,16 +556,7 @@ namespace HandBrakeWPF.ViewModels /// /// Gets RangeMode. /// - public IEnumerable OutputFormats - { - get - { - return new List - { - OutputFormat.Mp4, OutputFormat.Mkv - }; - } - } + public IEnumerable OutputFormats => new List { OutputFormat.Mp4, OutputFormat.Mkv }; /// /// Gets or sets Destination. @@ -1045,24 +913,12 @@ namespace HandBrakeWPF.ViewModels /// /// Gets the cancel action. /// - public Action CancelAction - { - get - { - return this.CancelScan; - } - } + public Action CancelAction => this.CancelScan; /// /// Action for the status window. /// - public Action OpenLogWindowAction - { - get - { - return this.OpenLogWindow; - } - } + public Action OpenLogWindowAction => this.OpenLogWindow; /// /// Gets or sets a value indicating whether show alert window. @@ -1127,35 +983,17 @@ namespace HandBrakeWPF.ViewModels /// /// Gets the alert window close. /// - public Action AlertWindowClose - { - get - { - return this.CloseAlertWindow; - } - } + public Action AlertWindowClose => this.CloseAlertWindow; /// /// Gets the add to queue label. /// - public string QueueLabel - { - get - { - return string.Format(Resources.Main_QueueLabel, this.queueProcessor.Count > 0 ? string.Format(" ({0})", this.queueProcessor.Count) : string.Empty); - } - } + public string QueueLabel => string.Format(Resources.Main_QueueLabel, this.queueProcessor.Count > 0 ? string.Format(" ({0})", this.queueProcessor.Count) : string.Empty); /// /// Gets the start label. /// - public string StartLabel - { - get - { - return this.queueProcessor.Count > 0 ? Resources.Main_StartQueue : Resources.Main_Start; - } - } + public string StartLabel => this.queueProcessor.Count > 0 ? Resources.Main_StartQueue : Resources.Main_Start; /// /// Gets or sets a value indicating whether has source. @@ -1311,9 +1149,6 @@ namespace HandBrakeWPF.ViewModels this.AudioViewModel.RefreshTask(); } - /// - /// Shutdown this View - /// public void Shutdown() { // Shutdown Service