Create core UI library

This commit is contained in:
Matt Nadareski
2022-04-11 10:32:03 -07:00
parent 79c7f13ff9
commit c4f0792c77
23 changed files with 139 additions and 67 deletions

View File

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

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using MPF.Core.Converters;
namespace MPF
namespace MPF.UI.Core.ComboBoxItems
{
/// <summary>
/// A generic combo box element

View File

@@ -1,4 +1,4 @@
namespace MPF
namespace MPF.UI.Core.ComboBoxItems
{
public interface IElement
{

View File

Before

Width:  |  Height:  |  Size: 423 KiB

After

Width:  |  Height:  |  Size: 423 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

View File

@@ -0,0 +1,61 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFrameworks>net48;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<PlatformTarget>x86</PlatformTarget>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<Title>MPF.UI.Core</Title>
<AssemblyName>MPF.UI.Core</AssemblyName>
<Authors>Matt Nadareski;ReignStumble;Jakz</Authors>
<Copyright>Copyright (c)2019-2022</Copyright>
<Version>2.3</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<IncludeSource>true</IncludeSource>
<IncludeSymbols>true</IncludeSymbols>
</PropertyGroup>
<PropertyGroup>
<NrtRevisionFormat>$(Version)-{chash:8}</NrtRevisionFormat>
<NrtResolveSimpleAttributes>true</NrtResolveSimpleAttributes>
<NrtShowRevision>false</NrtShowRevision>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\ring-code-guide-1-layer.png" />
<Resource Include="Images\ring-code-guide-2-layer.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MPF.Core\MPF.Core.csproj" />
<ProjectReference Include="..\RedumpLib\RedumpLib.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="PresentationFramework.Aero" />
</ItemGroup>
<ItemGroup>
<Folder Include="Images\" />
</ItemGroup>
<ItemGroup>
<Page Update="UserControls\UserInput.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
<Page Update="Windows\DiscInformationWindow.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
<Page Update="Windows\RingCodeGuideWindow.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
<UserControl x:Class="MPF.UserControls.UserInput"
<UserControl x:Class="MPF.UI.Core.UserControls.UserInput"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Controls;
namespace MPF.UserControls
namespace MPF.UI.Core.UserControls
{
/// <summary>
/// Interaction logic for UserInput.xaml
@@ -106,7 +106,6 @@ namespace MPF.UserControls
#endregion
public UserInput()
{
// Set default values

View File

@@ -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
/// </summary>
public DiscInformationWindow Parent { get; private set; }
/// <summary>
/// Application-level Options object
/// </summary>
public Options Options { get; private set; }
/// <summary>
/// SubmissionInfo object to fill and save
/// </summary>
@@ -191,13 +198,14 @@ namespace MPF.GUI.ViewModels
/// <summary>
/// Constructor
/// </summary>
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

View File

@@ -1,10 +1,10 @@
<windows:WindowBase x:Class="MPF.Windows.DiscInformationWindow"
<windows:WindowBase x:Class="MPF.UI.Core.Windows.DiscInformationWindow"
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.UserControls"
xmlns:windows="clr-namespace:MPF.Windows"
xmlns:controls="clr-namespace:MPF.UI.Core.UserControls"
xmlns:windows="clr-namespace:MPF.UI.Core.Windows"
mc:Ignorable="d"
Title="Disc Information" Width="515" WindowStyle="None"
WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize" SizeToContent="Height"

View File

@@ -1,7 +1,8 @@
using MPF.GUI.ViewModels;
using MPF.Core.Data;
using MPF.UI.Core.ViewModels;
using RedumpLib.Data;
namespace MPF.Windows
namespace MPF.UI.Core.Windows
{
/// <summary>
/// Interaction logic for DiscInformationWindow.xaml
@@ -16,10 +17,10 @@ namespace MPF.Windows
/// <summary>
/// Constructor
/// </summary>
public DiscInformationWindow(SubmissionInfo submissionInfo)
public DiscInformationWindow(Options options, SubmissionInfo submissionInfo)
{
InitializeComponent();
DataContext = new DiscInformationViewModel(this, submissionInfo);
DataContext = new DiscInformationViewModel(this, options, submissionInfo);
}
}
}

View File

@@ -1,11 +1,10 @@
<windows:WindowBase x:Class="MPF.Windows.RingCodeGuideWindow"
<windows:WindowBase x:Class="MPF.UI.Core.Windows.RingCodeGuideWindow"
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:local="clr-namespace:MPF"
xmlns:controls="clr-namespace:MPF.UserControls"
xmlns:windows="clr-namespace:MPF.Windows"
xmlns:controls="clr-namespace:MPF.UI.Core.UserControls"
xmlns:windows="clr-namespace:MPF.UI.Core.Windows"
mc:Ignorable="d"
Title="Ring Code Guide" Width="500" WindowStyle="None"
WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize" SizeToContent="Height"

View File

@@ -1,4 +1,4 @@
namespace MPF.Windows
namespace MPF.UI.Core.Windows
{
/// <summary>
/// Interaction logic for RingCodeGuideWindow.xaml

View File

@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Input;
namespace MPF.Windows
namespace MPF.UI.Core.Windows
{
public class WindowBase : Window
{

View File

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

View File

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

View File

@@ -41,22 +41,14 @@
<Content Include="$(PkgBurnOutSharp)\content\**" PackagePath="contentFiles\any\any;content" CopyToOutputDirectory="Always" PackageCopyToOutput="true" />
</ItemGroup>
<ItemGroup>
<None Remove="Images\ring-code-guide-2-layer.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Icon.ico" />
<Resource Include="Images\ring-code-guide-2-layer.png" />
<Resource Include="Images\ring-code-guide-1-layer.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MPF.Core\MPF.Core.csproj" />
<ProjectReference Include="..\MPF.Library\MPF.Library.csproj">
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
<Name>MPF.Library</Name>
</ProjectReference>
<ProjectReference Include="..\MPF.Library\MPF.Library.csproj" />
<ProjectReference Include="..\MPF.UI.Core\MPF.UI.Core.csproj" />
<ProjectReference Include="..\RedumpLib\RedumpLib.csproj" />
</ItemGroup>

View File

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

View File

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

View File

@@ -1,15 +1,15 @@
<windows:WindowBase x:Class="MPF.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.UserControls"
xmlns:viewModels="clr-namespace:MPF.GUI.ViewModels"
xmlns:windows="clr-namespace:MPF.Windows"
mc:Ignorable="d"
Title="Media Preservation Frontend" Width="600" WindowStyle="None"
WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" SizeToContent="Height"
BorderBrush="DarkGray" BorderThickness="2">
<coreWindows:WindowBase x:Class="MPF.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.UserControls"
xmlns:viewModels="clr-namespace:MPF.GUI.ViewModels"
xmlns:coreWindows="clr-namespace:MPF.UI.Core.Windows;assembly=MPF.UI.Core"
mc:Ignorable="d"
Title="Media Preservation Frontend" Width="600" WindowStyle="None"
WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" SizeToContent="Height"
BorderBrush="DarkGray" BorderThickness="2">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
@@ -186,4 +186,4 @@
</Expander>
</StackPanel>
</Grid>
</windows:WindowBase>
</coreWindows:WindowBase>

View File

@@ -1,5 +1,6 @@
using System;
using MPF.GUI.ViewModels;
using MPF.UI.Core.Windows;
namespace MPF.Windows
{

View File

@@ -1,14 +1,14 @@
<windows:WindowBase x:Class="MPF.Windows.OptionsWindow"
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:local="clr-namespace:MPF"
xmlns:windows="clr-namespace:MPF.Windows"
mc:Ignorable="d"
Title="Options" Width="515.132" WindowStyle="None"
WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize" SizeToContent="Height"
BorderBrush="DarkGray" BorderThickness="2">
<coreWindows:WindowBase x:Class="MPF.Windows.OptionsWindow"
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:local="clr-namespace:MPF"
xmlns:coreWindows="clr-namespace:MPF.UI.Core.Windows;assembly=MPF.UI.Core"
mc:Ignorable="d"
Title="Options" Width="515.132" WindowStyle="None"
WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize" SizeToContent="Height"
BorderBrush="DarkGray" BorderThickness="2">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
@@ -413,4 +413,4 @@
</GroupBox>
</StackPanel>
</Grid>
</windows:WindowBase>
</coreWindows:WindowBase>

View File

@@ -1,4 +1,5 @@
using MPF.GUI.ViewModels;
using MPF.UI.Core.Windows;
namespace MPF.Windows
{