diff --git a/CHANGELIST.md b/CHANGELIST.md
index 09408060..042d39d5 100644
--- a/CHANGELIST.md
+++ b/CHANGELIST.md
@@ -44,6 +44,7 @@
- Small updtes to MainViewModel
- Remove MainWindow from MainViewModel
- Use callback for logging, fix Options window
+- Remove WinForms from MainViewModel
### 2.6.6 (2023-10-04)
diff --git a/MPF.Core/DumpEnvironment.cs b/MPF.Core/DumpEnvironment.cs
index 850f9f89..8d20ed20 100644
--- a/MPF.Core/DumpEnvironment.cs
+++ b/MPF.Core/DumpEnvironment.cs
@@ -4,7 +4,6 @@ using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using BurnOutSharp;
-using MPF.Core;
using MPF.Core.Data;
using MPF.Core.Utilities;
using MPF.Core.Modules;
diff --git a/MPF.UI.Core/ViewModels/MainViewModel.cs b/MPF.UI.Core/ViewModels/MainViewModel.cs
index a8913bfd..8acb69bc 100644
--- a/MPF.UI.Core/ViewModels/MainViewModel.cs
+++ b/MPF.UI.Core/ViewModels/MainViewModel.cs
@@ -13,7 +13,6 @@ using MPF.Core.Utilities;
using MPF.Core.UI.ComboBoxItems;
using SabreTools.RedumpLib.Data;
using WPFCustomMessageBox;
-using WinForms = System.Windows.Forms;
namespace MPF.UI.Core.ViewModels
{
@@ -871,15 +870,6 @@ namespace MPF.UI.Core.ViewModels
///
public static void ExitApplication() => Application.Current.Shutdown();
- ///
- /// Set the output path from a dialog box
- ///
- public void SetOutputPath()
- {
- BrowseFile();
- EnsureDiscInformation();
- }
-
///
/// Show the About text popup
///
@@ -1141,40 +1131,6 @@ namespace MPF.UI.Core.ViewModels
#region Helpers
- ///
- /// Browse for an output file path
- ///
- private void BrowseFile()
- {
- // Get the current path, if possible
- string currentPath = this.OutputPath;
- if (string.IsNullOrWhiteSpace(currentPath))
- currentPath = Path.Combine(this.Options.DefaultOutputPath, "track.bin");
- if (string.IsNullOrWhiteSpace(currentPath))
- currentPath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "track.bin");
-
- // Get the full path
- currentPath = Path.GetFullPath(currentPath);
-
- // Get the directory
- string directory = Path.GetDirectoryName(currentPath);
-
- // Get the filename
- string filename = Path.GetFileName(currentPath);
-
- WinForms.FileDialog fileDialog = new WinForms.SaveFileDialog
- {
- FileName = filename,
- InitialDirectory = directory,
- };
- WinForms.DialogResult result = fileDialog.ShowDialog();
-
- if (result == WinForms.DialogResult.OK)
- {
- this.OutputPath = fileDialog.FileName;
- }
- }
-
///
/// Cache the current disc type to internal variable
///
diff --git a/MPF.UI.Core/Windows/MainWindow.xaml.cs b/MPF.UI.Core/Windows/MainWindow.xaml.cs
index 6e9a63c2..83c9091d 100644
--- a/MPF.UI.Core/Windows/MainWindow.xaml.cs
+++ b/MPF.UI.Core/Windows/MainWindow.xaml.cs
@@ -1,10 +1,12 @@
using System;
+using System.IO;
using System.Windows;
using System.Windows.Controls;
using MPF.Core;
using MPF.UI.Core.ViewModels;
using SabreTools.RedumpLib.Data;
using WPFCustomMessageBox;
+using WinForms = System.Windows.Forms;
namespace MPF.UI.Core.Windows
{
@@ -76,6 +78,40 @@ namespace MPF.UI.Core.Windows
OutputPathTextBox.TextChanged += OutputPathTextBoxTextChanged;
}
+ ///
+ /// Browse for an output file path
+ ///
+ public void BrowseFile()
+ {
+ // Get the current path, if possible
+ string currentPath = MainViewModel.OutputPath;
+ if (string.IsNullOrWhiteSpace(currentPath))
+ currentPath = Path.Combine(MainViewModel.Options.DefaultOutputPath, "track.bin");
+ if (string.IsNullOrWhiteSpace(currentPath))
+ currentPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "track.bin");
+
+ // Get the full path
+ currentPath = Path.GetFullPath(currentPath);
+
+ // Get the directory
+ string directory = Path.GetDirectoryName(currentPath);
+
+ // Get the filename
+ string filename = Path.GetFileName(currentPath);
+
+ WinForms.FileDialog fileDialog = new WinForms.SaveFileDialog
+ {
+ FileName = filename,
+ InitialDirectory = directory,
+ };
+ WinForms.DialogResult result = fileDialog.ShowDialog();
+
+ if (result == WinForms.DialogResult.OK)
+ {
+ MainViewModel.OutputPath = fileDialog.FileName;
+ }
+ }
+
///
/// Build a dummy SubmissionInfo and display it for testing
///
@@ -240,8 +276,11 @@ namespace MPF.UI.Core.Windows
///
/// Handler for OutputPathBrowseButton Click event
///
- public void OutputPathBrowseButtonClick(object sender, RoutedEventArgs e) =>
- MainViewModel.SetOutputPath();
+ public void OutputPathBrowseButtonClick(object sender, RoutedEventArgs e)
+ {
+ BrowseFile();
+ MainViewModel.EnsureDiscInformation();
+ }
///
/// Handler for OutputPathTextBox TextChanged event