From 73b2f0921f6e53d509fb00b6b4d92f2bd092852d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 30 Dec 2022 10:59:32 -0800 Subject: [PATCH] Address some UI concerns --- CHANGELIST.md | 2 ++ MPF/ViewModels/MainViewModel.cs | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index fb66e972..bb020c12 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -32,6 +32,8 @@ - Update to Aaru v5.3.2 LTS - Update options loader with sane defaults - Fix AppVeyor pathing +- Skip during detection +- Address some UI concerns ### 2.4 (2022-10-26) - Update to DIC 20211001 diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs index 5db5fd2b..d58ca9f6 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF/ViewModels/MainViewModel.cs @@ -430,12 +430,14 @@ namespace MPF.UI.ViewModels { if (App.Instance.EnableParametersCheckBox.IsChecked == true) { + App.Instance.OutputPathTextBox.IsEnabled = false; App.Instance.ParametersTextBox.IsEnabled = true; } else { App.Instance.ParametersTextBox.IsEnabled = false; ProcessCustomParameters(); + App.Instance.OutputPathTextBox.IsEnabled = true; } } @@ -575,6 +577,9 @@ namespace MPF.UI.ViewModels App.Instance.MediaTypeComboBox.SelectionChanged += MediaTypeComboBoxSelectionChanged; App.Instance.DriveLetterComboBox.SelectionChanged += DriveLetterComboBoxSelectionChanged; App.Instance.DriveSpeedComboBox.SelectionChanged += DriveSpeedComboBoxSelectionChanged; + + // User Area TextChanged + App.Instance.OutputPathTextBox.TextChanged += OutputPathTextBoxTextChanged; } /// @@ -785,7 +790,6 @@ namespace MPF.UI.ViewModels // Get the directory string directory = Path.GetDirectoryName(currentPath); - Directory.CreateDirectory(directory); // Get the filename string filename = Path.GetFileName(currentPath); @@ -955,7 +959,10 @@ namespace MPF.UI.ViewModels string directory = App.Options.DefaultOutputPath; string filename = $"{label}{extension ?? ".bin"}"; - App.Instance.OutputPathTextBox.Text = Path.Combine(directory, label, filename); + if (directory.EndsWith(label)) + App.Instance.OutputPathTextBox.Text = Path.Combine(directory, filename); + else + App.Instance.OutputPathTextBox.Text = Path.Combine(directory, label, filename); } // Set the output filename, if we changed drives @@ -965,7 +972,10 @@ namespace MPF.UI.ViewModels string directory = Path.GetDirectoryName(App.Instance.OutputPathTextBox.Text); string filename = $"{label}{extension ?? ".bin"}"; - App.Instance.OutputPathTextBox.Text = Path.Combine(directory, label, filename); + if (directory.EndsWith(label)) + App.Instance.OutputPathTextBox.Text = Path.Combine(directory, filename); + else + App.Instance.OutputPathTextBox.Text = Path.Combine(directory, label, filename); } // Ensure the UI gets updated @@ -1459,6 +1469,12 @@ namespace MPF.UI.ViewModels private void OutputPathBrowseButtonClick(object sender, RoutedEventArgs e) => SetOutputPath(); + /// + /// Handler for OutputPathTextBox TextChanged event + /// + private void OutputPathTextBoxTextChanged(object sender, TextChangedEventArgs e) + => EnsureDiscInformation(); + /// /// Handler for StartStopButton Click event ///