From b28ad5d3cd090a5f5f33e55c93005c4640fc79c6 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 25 Sep 2023 21:39:28 -0400 Subject: [PATCH] Move MainWindow --- CHANGELIST.md | 1 + MPF.UI.Core/MPF.UI.Core.csproj | 1 + MPF.UI.Core/ViewModels/LogViewModel.cs | 3 --- {MPF => MPF.UI.Core}/ViewModels/MainViewModel.cs | 16 ++++++---------- {MPF => MPF.UI.Core}/Windows/MainWindow.xaml | 8 ++++---- {MPF => MPF.UI.Core}/Windows/MainWindow.xaml.cs | 5 ++--- MPF/App.xaml | 2 +- 7 files changed, 15 insertions(+), 21 deletions(-) rename {MPF => MPF.UI.Core}/ViewModels/MainViewModel.cs (99%) rename {MPF => MPF.UI.Core}/Windows/MainWindow.xaml (98%) rename {MPF => MPF.UI.Core}/Windows/MainWindow.xaml.cs (89%) diff --git a/CHANGELIST.md b/CHANGELIST.md index 6064f546..7fa920cc 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -32,6 +32,7 @@ - Set parent on MainViewModel init - Make logger a local reference - Move options into MainViewModel +- Move MainWindow ### 2.6.3 (2023-08-15) diff --git a/MPF.UI.Core/MPF.UI.Core.csproj b/MPF.UI.Core/MPF.UI.Core.csproj index 86dfc671..2e4f0dc1 100644 --- a/MPF.UI.Core/MPF.UI.Core.csproj +++ b/MPF.UI.Core/MPF.UI.Core.csproj @@ -30,6 +30,7 @@ + diff --git a/MPF.UI.Core/ViewModels/LogViewModel.cs b/MPF.UI.Core/ViewModels/LogViewModel.cs index bf927495..4239e0e3 100644 --- a/MPF.UI.Core/ViewModels/LogViewModel.cs +++ b/MPF.UI.Core/ViewModels/LogViewModel.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF.UI.Core/ViewModels/MainViewModel.cs similarity index 99% rename from MPF/ViewModels/MainViewModel.cs rename to MPF.UI.Core/ViewModels/MainViewModel.cs index 5c844a6e..32a31f0a 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF.UI.Core/ViewModels/MainViewModel.cs @@ -9,15 +9,12 @@ using MPF.Core.Data; using MPF.Core.Utilities; using MPF.Library; using MPF.UI.Core.ComboBoxItems; -using MPF.UI.Core.ViewModels; using MPF.UI.Core.Windows; -using MPF.Windows; using SabreTools.RedumpLib.Data; using WPFCustomMessageBox; using WinForms = System.Windows.Forms; -using MPF.UI.Core; -namespace MPF.UI.ViewModels +namespace MPF.UI.Core.ViewModels { public class MainViewModel { @@ -322,7 +319,7 @@ namespace MPF.UI.ViewModels /// /// Shutdown the current application /// - public void ExitApplication() => Application.Current.Shutdown(); + public static void ExitApplication() => Application.Current.Shutdown(); /// /// Set the output path from a dialog box @@ -793,7 +790,7 @@ namespace MPF.UI.ViewModels /// /// Recolor all UI elements for light mode /// - private void EnableLightMode() + private static void EnableLightMode() { var theme = new LightModeTheme(); theme.Apply(); @@ -802,7 +799,7 @@ namespace MPF.UI.ViewModels /// /// Recolor all UI elements for dark mode /// - private void EnableDarkMode() + private static void EnableDarkMode() { var theme = new DarkModeTheme(); theme.Apply(); @@ -1302,8 +1299,7 @@ namespace MPF.UI.ViewModels DisableAllUIElements(); // Refresh the drive, if it wasn't null - if (Env.Drive != null) - Env.Drive.RefreshDrive(); + Env.Drive?.RefreshDrive(); // Output to the label and log this.Parent.StatusLabel.Text = "Starting dumping process... Please wait!"; @@ -1367,7 +1363,7 @@ namespace MPF.UI.ViewModels // Validate that we have an output path of any sort if (string.IsNullOrWhiteSpace(Env.OutputPath)) { - MessageBoxResult mbresult = CustomMessageBox.Show("No output path was provided so dumping cannot continue.", "Missing Path", MessageBoxButton.OK, MessageBoxImage.Exclamation); + _ = CustomMessageBox.Show("No output path was provided so dumping cannot continue.", "Missing Path", MessageBoxButton.OK, MessageBoxImage.Exclamation); this.Logger.LogLn("Dumping aborted!"); return false; } diff --git a/MPF/Windows/MainWindow.xaml b/MPF.UI.Core/Windows/MainWindow.xaml similarity index 98% rename from MPF/Windows/MainWindow.xaml rename to MPF.UI.Core/Windows/MainWindow.xaml index 2ec69d5d..1e87319a 100644 --- a/MPF/Windows/MainWindow.xaml +++ b/MPF.UI.Core/Windows/MainWindow.xaml @@ -1,11 +1,11 @@ -