Move MainWindow

This commit is contained in:
Matt Nadareski
2023-09-25 21:39:28 -04:00
parent 4cdbbcedf0
commit b28ad5d3cd
7 changed files with 15 additions and 21 deletions

View File

@@ -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)

View File

@@ -30,6 +30,7 @@
<ItemGroup>
<ProjectReference Include="..\MPF.Core\MPF.Core.csproj" />
<ProjectReference Include="..\MPF.Library\MPF.Library.csproj" />
</ItemGroup>
<ItemGroup>

View File

@@ -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;

View File

@@ -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
/// <summary>
/// Shutdown the current application
/// </summary>
public void ExitApplication() => Application.Current.Shutdown();
public static void ExitApplication() => Application.Current.Shutdown();
/// <summary>
/// Set the output path from a dialog box
@@ -793,7 +790,7 @@ namespace MPF.UI.ViewModels
/// <summary>
/// Recolor all UI elements for light mode
/// </summary>
private void EnableLightMode()
private static void EnableLightMode()
{
var theme = new LightModeTheme();
theme.Apply();
@@ -802,7 +799,7 @@ namespace MPF.UI.ViewModels
/// <summary>
/// Recolor all UI elements for dark mode
/// </summary>
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;
}

View File

@@ -1,11 +1,11 @@
<coreWindows:WindowBase x:Class="MPF.Windows.MainWindow"
<coreWindows:WindowBase x:Class="MPF.UI.Core.Windows.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="clr-namespace:MPF.UI.Core.UserControls;assembly=MPF.UI.Core"
xmlns:coreWindows="clr-namespace:MPF.UI.Core.Windows;assembly=MPF.UI.Core"
xmlns:viewModels="clr-namespace:MPF.UI.ViewModels"
xmlns:controls="clr-namespace:MPF.UI.Core.UserControls"
xmlns:coreWindows="clr-namespace:MPF.UI.Core.Windows"
xmlns:viewModels="clr-namespace:MPF.UI.Core.ViewModels"
mc:Ignorable="d"
Title="Media Preservation Frontend" Width="600" WindowStyle="None"
WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" SizeToContent="Height"

View File

@@ -1,8 +1,7 @@
using System;
using MPF.UI.Core.Windows;
using MPF.UI.ViewModels;
using MPF.UI.Core.ViewModels;
namespace MPF.Windows
namespace MPF.UI.Core.Windows
{
public partial class MainWindow : WindowBase
{

View File

@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
xmlns:windows="clr-namespace:MPF.Windows"
xmlns:windows="clr-namespace:MPF.UI.Core.Windows;assembly=MPF.UI.Core"
x:Class="MPF.App">
<Application.MainWindow>
<windows:MainWindow Visibility="Visible"/>