diff --git a/CHANGELIST.md b/CHANGELIST.md index add911d0..a25353ad 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -48,6 +48,7 @@ - Add option for copy protection file output - Make protection field user-editable - Add warning to tooltip +- Create core UI library ### 2.3 (2022-02-05) - Start overhauling Redump information pulling, again diff --git a/MPF/ComboBoxItems/Element.cs b/MPF.UI.Core/ComboBoxItems/Element.cs similarity index 97% rename from MPF/ComboBoxItems/Element.cs rename to MPF.UI.Core/ComboBoxItems/Element.cs index e8a296da..b2200478 100644 --- a/MPF/ComboBoxItems/Element.cs +++ b/MPF.UI.Core/ComboBoxItems/Element.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using MPF.Core.Converters; -namespace MPF +namespace MPF.UI.Core.ComboBoxItems { /// /// A generic combo box element diff --git a/MPF/ComboBoxItems/IElement.cs b/MPF.UI.Core/ComboBoxItems/IElement.cs similarity index 81% rename from MPF/ComboBoxItems/IElement.cs rename to MPF.UI.Core/ComboBoxItems/IElement.cs index c0159ee2..88de5b0d 100644 --- a/MPF/ComboBoxItems/IElement.cs +++ b/MPF.UI.Core/ComboBoxItems/IElement.cs @@ -1,4 +1,4 @@ -namespace MPF +namespace MPF.UI.Core.ComboBoxItems { public interface IElement { diff --git a/MPF/Images/ring-code-guide-1-layer.png b/MPF.UI.Core/Images/ring-code-guide-1-layer.png similarity index 100% rename from MPF/Images/ring-code-guide-1-layer.png rename to MPF.UI.Core/Images/ring-code-guide-1-layer.png diff --git a/MPF/Images/ring-code-guide-2-layer.png b/MPF.UI.Core/Images/ring-code-guide-2-layer.png similarity index 100% rename from MPF/Images/ring-code-guide-2-layer.png rename to MPF.UI.Core/Images/ring-code-guide-2-layer.png diff --git a/MPF.UI.Core/MPF.UI.Core.csproj b/MPF.UI.Core/MPF.UI.Core.csproj new file mode 100644 index 00000000..458f5299 --- /dev/null +++ b/MPF.UI.Core/MPF.UI.Core.csproj @@ -0,0 +1,61 @@ + + + + net48;netcoreapp3.1;net5.0-windows + x86 + true + true + MPF.UI.Core + MPF.UI.Core + Matt Nadareski;ReignStumble;Jakz + Copyright (c)2019-2022 + 2.3 + $(Version) + $(Version) + true + true + + + + $(Version)-{chash:8} + true + false + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + + + + + + + + + + + + $(DefaultXamlRuntime) + + + $(DefaultXamlRuntime) + + + $(DefaultXamlRuntime) + + + diff --git a/MPF/UserControls/UserInput.xaml b/MPF.UI.Core/UserControls/UserInput.xaml similarity index 96% rename from MPF/UserControls/UserInput.xaml rename to MPF.UI.Core/UserControls/UserInput.xaml index 2f659b99..1f3272ef 100644 --- a/MPF/UserControls/UserInput.xaml +++ b/MPF.UI.Core/UserControls/UserInput.xaml @@ -1,4 +1,4 @@ - /// Interaction logic for UserInput.xaml @@ -106,7 +106,6 @@ namespace MPF.UserControls #endregion - public UserInput() { // Set default values diff --git a/MPF/ViewModels/DiscInformationViewModel.cs b/MPF.UI.Core/ViewModels/DiscInformationViewModel.cs similarity index 98% rename from MPF/ViewModels/DiscInformationViewModel.cs rename to MPF.UI.Core/ViewModels/DiscInformationViewModel.cs index e11b12f5..f943d9e2 100644 --- a/MPF/ViewModels/DiscInformationViewModel.cs +++ b/MPF.UI.Core/ViewModels/DiscInformationViewModel.cs @@ -1,11 +1,13 @@ using System.Collections.Generic; using System.Linq; using System.Windows; +using MPF.Core.Data; using MPF.Core.Utilities; -using MPF.Windows; +using MPF.UI.Core.ComboBoxItems; +using MPF.UI.Core.Windows; using RedumpLib.Data; -namespace MPF.GUI.ViewModels +namespace MPF.UI.Core.ViewModels { public class DiscInformationViewModel { @@ -16,6 +18,11 @@ namespace MPF.GUI.ViewModels /// public DiscInformationWindow Parent { get; private set; } + /// + /// Application-level Options object + /// + public Options Options { get; private set; } + /// /// SubmissionInfo object to fill and save /// @@ -191,13 +198,14 @@ namespace MPF.GUI.ViewModels /// /// Constructor /// - public DiscInformationViewModel(DiscInformationWindow parent, SubmissionInfo submissionInfo) + public DiscInformationViewModel(DiscInformationWindow parent, Options options, SubmissionInfo submissionInfo) { Parent = parent; + Options = options; SubmissionInfo = submissionInfo.Clone() as SubmissionInfo ?? new SubmissionInfo(); // Limit lists, if necessary - if (App.Options.EnableRedumpCompatibility) + if (this.Options.EnableRedumpCompatibility) { SetRedumpRegions(); SetRedumpLanguages(); @@ -330,7 +338,7 @@ namespace MPF.GUI.ViewModels private void ManipulateFields() { // Enable tabs in all fields, if required - if (App.Options.EnableTabsInInputFields) + if (this.Options.EnableTabsInInputFields) EnableTabsInInputFields(); // Hide read-only fields that don't have values set diff --git a/MPF/Windows/DiscInformationWindow.xaml b/MPF.UI.Core/Windows/DiscInformationWindow.xaml similarity index 99% rename from MPF/Windows/DiscInformationWindow.xaml rename to MPF.UI.Core/Windows/DiscInformationWindow.xaml index 0821ec7f..51517d18 100644 --- a/MPF/Windows/DiscInformationWindow.xaml +++ b/MPF.UI.Core/Windows/DiscInformationWindow.xaml @@ -1,10 +1,10 @@ - /// Interaction logic for DiscInformationWindow.xaml @@ -16,10 +17,10 @@ namespace MPF.Windows /// /// Constructor /// - public DiscInformationWindow(SubmissionInfo submissionInfo) + public DiscInformationWindow(Options options, SubmissionInfo submissionInfo) { InitializeComponent(); - DataContext = new DiscInformationViewModel(this, submissionInfo); + DataContext = new DiscInformationViewModel(this, options, submissionInfo); } } } diff --git a/MPF/Windows/RingCodeGuideWindow.xaml b/MPF.UI.Core/Windows/RingCodeGuideWindow.xaml similarity index 97% rename from MPF/Windows/RingCodeGuideWindow.xaml rename to MPF.UI.Core/Windows/RingCodeGuideWindow.xaml index 084fb130..949a595f 100644 --- a/MPF/Windows/RingCodeGuideWindow.xaml +++ b/MPF.UI.Core/Windows/RingCodeGuideWindow.xaml @@ -1,11 +1,10 @@ - /// Interaction logic for RingCodeGuideWindow.xaml diff --git a/MPF/Windows/WindowBase.cs b/MPF.UI.Core/Windows/WindowBase.cs similarity index 97% rename from MPF/Windows/WindowBase.cs rename to MPF.UI.Core/Windows/WindowBase.cs index a976d66b..e48de1a9 100644 --- a/MPF/Windows/WindowBase.cs +++ b/MPF.UI.Core/Windows/WindowBase.cs @@ -1,7 +1,7 @@ using System.Windows; using System.Windows.Input; -namespace MPF.Windows +namespace MPF.UI.Core.Windows { public class WindowBase : Window { diff --git a/MPF.sln b/MPF.sln index abd17885..57f4c7dd 100644 --- a/MPF.sln +++ b/MPF.sln @@ -28,6 +28,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MPF.Core", "MPF.Core\MPF.Co EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MPF.Modules", "MPF.Modules\MPF.Modules.csproj", "{8A4254BD-552F-4238-B8EB-D59AACD768B9}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPF.UI.Core", "MPF.UI.Core\MPF.UI.Core.csproj", "{EA3768DB-694A-4653-82E4-9FF71B8963F3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -70,6 +72,10 @@ Global {8A4254BD-552F-4238-B8EB-D59AACD768B9}.Debug|Any CPU.Build.0 = Debug|Any CPU {8A4254BD-552F-4238-B8EB-D59AACD768B9}.Release|Any CPU.ActiveCfg = Release|Any CPU {8A4254BD-552F-4238-B8EB-D59AACD768B9}.Release|Any CPU.Build.0 = Release|Any CPU + {EA3768DB-694A-4653-82E4-9FF71B8963F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA3768DB-694A-4653-82E4-9FF71B8963F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA3768DB-694A-4653-82E4-9FF71B8963F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA3768DB-694A-4653-82E4-9FF71B8963F3}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MPF/ComboBoxItems/KnownSystemComboBoxItem.cs b/MPF/ComboBoxItems/KnownSystemComboBoxItem.cs index 62e80bf8..5f2265cb 100644 --- a/MPF/ComboBoxItems/KnownSystemComboBoxItem.cs +++ b/MPF/ComboBoxItems/KnownSystemComboBoxItem.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using MPF.Core.Converters; using MPF.Core.Utilities; +using MPF.UI.Core.ComboBoxItems; using RedumpLib.Data; namespace MPF diff --git a/MPF/MPF.csproj b/MPF/MPF.csproj index c46bf5ba..d9987233 100644 --- a/MPF/MPF.csproj +++ b/MPF/MPF.csproj @@ -41,22 +41,14 @@ - - - - - - - - {51ab0928-13f9-44bf-a407-b6957a43a056} - MPF.Library - + + diff --git a/MPF/ViewModels/MainViewModel.cs b/MPF/ViewModels/MainViewModel.cs index fd8a0669..9e17079d 100644 --- a/MPF/ViewModels/MainViewModel.cs +++ b/MPF/ViewModels/MainViewModel.cs @@ -1,16 +1,18 @@ -using BurnOutSharp; -using MPF.Core.Data; -using MPF.Core.Utilities; -using MPF.Library; -using MPF.Windows; -using RedumpLib.Data; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Media; +using BurnOutSharp; +using MPF.Core.Data; +using MPF.Core.Utilities; +using MPF.Library; +using MPF.UI.Core.ComboBoxItems; +using MPF.Windows; +using MPF.UI.Core.Windows; +using RedumpLib.Data; using WPFCustomMessageBox; using WinForms = System.Windows.Forms; @@ -1198,7 +1200,7 @@ namespace MPF.GUI.ViewModels if (App.Options.ShowDiscEjectReminder) CustomMessageBox.Show(App.Instance, "It is now safe to eject the disc", "Eject", MessageBoxButton.OK, MessageBoxImage.Information); - var discInformationWindow = new DiscInformationWindow(submissionInfo) + var discInformationWindow = new DiscInformationWindow(App.Options, submissionInfo) { Owner = App.Instance, WindowStartupLocation = WindowStartupLocation.CenterOwner, diff --git a/MPF/ViewModels/OptionsViewModel.cs b/MPF/ViewModels/OptionsViewModel.cs index 49be6c64..41dc0f61 100644 --- a/MPF/ViewModels/OptionsViewModel.cs +++ b/MPF/ViewModels/OptionsViewModel.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Windows; using System.Windows.Forms; using MPF.Core.Data; +using MPF.UI.Core.ComboBoxItems; using MPF.Windows; using RedumpLib.Web; using WPFCustomMessageBox; diff --git a/MPF/Windows/MainWindow.xaml b/MPF/Windows/MainWindow.xaml index db90b0ce..fab835e5 100644 --- a/MPF/Windows/MainWindow.xaml +++ b/MPF/Windows/MainWindow.xaml @@ -1,15 +1,15 @@ - + @@ -186,4 +186,4 @@ - + diff --git a/MPF/Windows/MainWindow.xaml.cs b/MPF/Windows/MainWindow.xaml.cs index 5f767e8a..e55708ba 100644 --- a/MPF/Windows/MainWindow.xaml.cs +++ b/MPF/Windows/MainWindow.xaml.cs @@ -1,5 +1,6 @@ using System; using MPF.GUI.ViewModels; +using MPF.UI.Core.Windows; namespace MPF.Windows { diff --git a/MPF/Windows/OptionsWindow.xaml b/MPF/Windows/OptionsWindow.xaml index 80828154..5e474d3b 100644 --- a/MPF/Windows/OptionsWindow.xaml +++ b/MPF/Windows/OptionsWindow.xaml @@ -1,14 +1,14 @@ - + @@ -413,4 +413,4 @@ - + diff --git a/MPF/Windows/OptionsWindow.xaml.cs b/MPF/Windows/OptionsWindow.xaml.cs index 74d7787b..090d4928 100644 --- a/MPF/Windows/OptionsWindow.xaml.cs +++ b/MPF/Windows/OptionsWindow.xaml.cs @@ -1,4 +1,5 @@ using MPF.GUI.ViewModels; +using MPF.UI.Core.Windows; namespace MPF.Windows {