Remove more Windows from MainViewModel

This commit is contained in:
Matt Nadareski
2023-10-09 00:13:40 -04:00
parent 1b9523c799
commit 17a0c5d083
3 changed files with 7 additions and 14 deletions

View File

@@ -46,6 +46,7 @@
- Use callback for logging, fix Options window
- Remove WinForms from MainViewModel
- Remove some message boxes from MainViewModel
- Remove more Windows from MainViewModel
### 2.6.6 (2023-10-04)

View File

@@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using BurnOutSharp;
using MPF.Core;
using MPF.Core.Converters;
@@ -12,7 +12,6 @@ using MPF.Core.Data;
using MPF.Core.Utilities;
using MPF.Core.UI.ComboBoxItems;
using SabreTools.RedumpLib.Data;
using System.Threading.Tasks;
using WPFCustomMessageBox;
namespace MPF.UI.Core.ViewModels
@@ -628,7 +627,7 @@ namespace MPF.UI.Core.ViewModels
CanExecuteSelectionChanged = true;
// Force an update of the media type
this.ChangeMediaType(null);
this.ChangeMediaType(null, null);
}
/// <summary>
@@ -671,13 +670,11 @@ namespace MPF.UI.Core.ViewModels
/// <summary>
/// Change the currently selected media type
/// </summary>
public void ChangeMediaType(SelectionChangedEventArgs e)
public void ChangeMediaType(System.Collections.IList removedItems, System.Collections.IList addedItems)
{
// Only change the media type if the selection and not the list has changed
if (e == null || (e.RemovedItems.Count == 1 && e.AddedItems.Count == 1))
{
if ((removedItems == null && addedItems == null) || (removedItems.Count == 1 && addedItems.Count == 1))
SetSupportedDriveSpeed();
}
GetOutputNames(false);
EnsureDiscInformation();
@@ -875,11 +872,6 @@ namespace MPF.UI.Core.ViewModels
};
}
/// <summary>
/// Shutdown the current application
/// </summary>
public static void ExitApplication() => Application.Current.Shutdown();
/// <summary>
/// Toggle the Start/Stop button
/// </summary>

View File

@@ -215,7 +215,7 @@ namespace MPF.UI.Core.Windows
/// Handler for AppExitMenuItem Click event
/// </summary>
public void AppExitClick(object sender, RoutedEventArgs e) =>
MainViewModel.ExitApplication();
Application.Current.Shutdown();
/// <summary>
/// Handler for CheckForUpdatesMenuItem Click event
@@ -303,7 +303,7 @@ namespace MPF.UI.Core.Windows
public void MediaTypeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (MainViewModel.CanExecuteSelectionChanged)
MainViewModel.ChangeMediaType(e);
MainViewModel.ChangeMediaType(e.RemovedItems, e.AddedItems);
}
/// <summary>