From 62a469eb1adabcbf2634795d86d706fe3e89679d Mon Sep 17 00:00:00 2001 From: Cj <161484149+CJ-SPT@users.noreply.github.com> Date: Mon, 17 Jun 2024 11:34:06 -0400 Subject: [PATCH] Stay with winforms, refactor names --- ReCodeItGUI_WPF/App.xaml | 23 +- ReCodeItGUI_WPF/App.xaml.cs | 90 +++++++- ReCodeItGUI_WPF/AssemblyInfo.cs | 12 +- ReCodeItGUI_WPF/Assets/wpfui-icon-1024.png | Bin 0 -> 10779 bytes ReCodeItGUI_WPF/Assets/wpfui-icon-256.png | Bin 0 -> 4391 bytes .../Helpers/EnumToBooleanConverter.cs | 36 ++++ ReCodeItGUI_WPF/Helpers/GUIExtentions.cs | 156 -------------- ReCodeItGUI_WPF/MainWindow.xaml | 197 ------------------ ReCodeItGUI_WPF/MainWindow.xaml.cs | 94 --------- ReCodeItGUI_WPF/Models/AppConfig.cs | 9 + ReCodeItGUI_WPF/Models/DataColor.cs | 9 + ReCodeItGUI_WPF/ReCodeItGUI_WPF.csproj | 26 ++- ReCodeItGUI_WPF/Resources/Translations.cs | 6 + .../Services/ApplicationHostService.cs | 59 ++++++ ReCodeItGUI_WPF/Services/PageService.cs | 42 ++++ ReCodeItGUI_WPF/Usings.cs | 4 + .../ViewModels/Pages/DashboardViewModel.cs | 14 ++ .../ViewModels/Pages/DataViewModel.cs | 47 +++++ .../ViewModels/Pages/SettingsViewModel.cs | 63 ++++++ .../ViewModels/Windows/MainWindowViewModel.cs | 45 ++++ .../Views/Pages/DashboardPage.xaml | 36 ++++ .../Views/Pages/DashboardPage.xaml.cs | 18 ++ ReCodeItGUI_WPF/Views/Pages/DataPage.xaml | 43 ++++ ReCodeItGUI_WPF/Views/Pages/DataPage.xaml.cs | 18 ++ ReCodeItGUI_WPF/Views/Pages/SettingsPage.xaml | 51 +++++ .../Views/Pages/SettingsPage.xaml.cs | 18 ++ ReCodeItGUI_WPF/Views/Windows/MainWindow.xaml | 65 ++++++ .../Views/Windows/MainWindow.xaml.cs | 64 ++++++ ReCodeItGUI_WPF/app.manifest | 75 +++++++ ReCodeItGUI_WPF/wpfui-icon.ico | Bin 0 -> 19438 bytes RecodeIt.sln | 6 - RecodeItLib/Remapper/Search/Fields.cs | 12 +- RecodeItLib/Remapper/Search/Methods.cs | 12 +- RecodeItLib/Remapper/Search/NestedTypes.cs | 12 +- RecodeItLib/Remapper/Search/Properties.cs | 12 +- .../Remapper/Search/TypeDefExtensions.cs | 24 +-- 36 files changed, 882 insertions(+), 516 deletions(-) create mode 100644 ReCodeItGUI_WPF/Assets/wpfui-icon-1024.png create mode 100644 ReCodeItGUI_WPF/Assets/wpfui-icon-256.png create mode 100644 ReCodeItGUI_WPF/Helpers/EnumToBooleanConverter.cs delete mode 100644 ReCodeItGUI_WPF/Helpers/GUIExtentions.cs delete mode 100644 ReCodeItGUI_WPF/MainWindow.xaml delete mode 100644 ReCodeItGUI_WPF/MainWindow.xaml.cs create mode 100644 ReCodeItGUI_WPF/Models/AppConfig.cs create mode 100644 ReCodeItGUI_WPF/Models/DataColor.cs create mode 100644 ReCodeItGUI_WPF/Resources/Translations.cs create mode 100644 ReCodeItGUI_WPF/Services/ApplicationHostService.cs create mode 100644 ReCodeItGUI_WPF/Services/PageService.cs create mode 100644 ReCodeItGUI_WPF/Usings.cs create mode 100644 ReCodeItGUI_WPF/ViewModels/Pages/DashboardViewModel.cs create mode 100644 ReCodeItGUI_WPF/ViewModels/Pages/DataViewModel.cs create mode 100644 ReCodeItGUI_WPF/ViewModels/Pages/SettingsViewModel.cs create mode 100644 ReCodeItGUI_WPF/ViewModels/Windows/MainWindowViewModel.cs create mode 100644 ReCodeItGUI_WPF/Views/Pages/DashboardPage.xaml create mode 100644 ReCodeItGUI_WPF/Views/Pages/DashboardPage.xaml.cs create mode 100644 ReCodeItGUI_WPF/Views/Pages/DataPage.xaml create mode 100644 ReCodeItGUI_WPF/Views/Pages/DataPage.xaml.cs create mode 100644 ReCodeItGUI_WPF/Views/Pages/SettingsPage.xaml create mode 100644 ReCodeItGUI_WPF/Views/Pages/SettingsPage.xaml.cs create mode 100644 ReCodeItGUI_WPF/Views/Windows/MainWindow.xaml create mode 100644 ReCodeItGUI_WPF/Views/Windows/MainWindow.xaml.cs create mode 100644 ReCodeItGUI_WPF/app.manifest create mode 100644 ReCodeItGUI_WPF/wpfui-icon.ico diff --git a/ReCodeItGUI_WPF/App.xaml b/ReCodeItGUI_WPF/App.xaml index d33d2b8..2493fa6 100644 --- a/ReCodeItGUI_WPF/App.xaml +++ b/ReCodeItGUI_WPF/App.xaml @@ -1,10 +1,17 @@ - + + + + + + + - \ No newline at end of file + diff --git a/ReCodeItGUI_WPF/App.xaml.cs b/ReCodeItGUI_WPF/App.xaml.cs index 828021e..52db7ad 100644 --- a/ReCodeItGUI_WPF/App.xaml.cs +++ b/ReCodeItGUI_WPF/App.xaml.cs @@ -1,14 +1,94 @@ -using System.Configuration; -using System.Data; -using System.Windows; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using ReCodeItGUI_WPF.Services; +using ReCodeItGUI_WPF.ViewModels.Pages; +using ReCodeItGUI_WPF.ViewModels.Windows; +using ReCodeItGUI_WPF.Views.Pages; +using ReCodeItGUI_WPF.Views.Windows; +using System.IO; +using System.Reflection; +using System.Windows.Threading; +using Wpf.Ui; namespace ReCodeItGUI_WPF { /// /// Interaction logic for App.xaml /// - public partial class App : Application + public partial class App { - } + // The.NET Generic Host provides dependency injection, configuration, logging, and other services. + // https://docs.microsoft.com/dotnet/core/extensions/generic-host + // https://docs.microsoft.com/dotnet/core/extensions/dependency-injection + // https://docs.microsoft.com/dotnet/core/extensions/configuration + // https://docs.microsoft.com/dotnet/core/extensions/logging + private static readonly IHost _host = Host + .CreateDefaultBuilder() + .ConfigureAppConfiguration(c => { c.SetBasePath(Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location)); }) + .ConfigureServices((context, services) => + { + services.AddHostedService(); + // Page resolver service + services.AddSingleton(); + + // Theme manipulation + services.AddSingleton(); + + // TaskBar manipulation + services.AddSingleton(); + + // Service containing navigation, same as INavigationWindow... but without window + services.AddSingleton(); + + // Main window with navigation + services.AddSingleton(); + services.AddSingleton(); + + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + services.AddSingleton(); + }).Build(); + + /// + /// Gets registered service. + /// + /// Type of the service to get. + /// Instance of the service or . + public static T GetService() + where T : class + { + return _host.Services.GetService(typeof(T)) as T; + } + + /// + /// Occurs when the application is loading. + /// + private void OnStartup(object sender, StartupEventArgs e) + { + _host.Start(); + } + + /// + /// Occurs when the application is closing. + /// + private async void OnExit(object sender, ExitEventArgs e) + { + await _host.StopAsync(); + + _host.Dispose(); + } + + /// + /// Occurs when an exception is thrown by an application but not handled. + /// + private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) + { + // For more info see https://docs.microsoft.com/en-us/dotnet/api/system.windows.application.dispatcherunhandledexception?view=windowsdesktop-6.0 + } + } } diff --git a/ReCodeItGUI_WPF/AssemblyInfo.cs b/ReCodeItGUI_WPF/AssemblyInfo.cs index b0ec827..7ad982e 100644 --- a/ReCodeItGUI_WPF/AssemblyInfo.cs +++ b/ReCodeItGUI_WPF/AssemblyInfo.cs @@ -1,10 +1,10 @@ using System.Windows; [assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located +//(used if a resource is not found in the page, +// app, or any theme specific resource dictionaries) )] diff --git a/ReCodeItGUI_WPF/Assets/wpfui-icon-1024.png b/ReCodeItGUI_WPF/Assets/wpfui-icon-1024.png new file mode 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=QP!&_)$UX^%4La6rff8M&hWKvHO`HqhAzf{S*&`bu*zw_ zN+Rw~WLu@wBD3eLUZxbic|%ALu(8Q61s5NnJ=V2zxL)n5i0|Z`J1e-^w%cp_7%%g4Nq*KEXhAszp;ec;v4a7 zfz@E-QlJ9TzZ*+P(&#v8c+#0-Z&Z%b+U8q(^;CrHR`^?xCIz}rW^v*8q(!Z_FWQ@b zoB9~{U**}~vihHuWCpRT&^1%=+uK#~>4m&6>hEz52Rl0WowopnxOL|s1KEdd52{OH zAXH=J62G9ZYF1;g<9bp;L#=0#saji&tR=-Yii*_ME9?L=HylLY&b!$h;TmsyIQ*jY zOj6yY=D3y&q|Z*+6XD-G_-kl)j}!rdI|E^DuQfGY?G8n%Ugd8R{015dRW$scZn`4N zcfXn`EBJO*t_HZtevaRLEugbLV(amBD-u!;`+ezaVfy^n4%zo!gN;uIeIxp;YPA7e z%zQmK9KZI9_=r;W!=5L-y!jE$z>7#H?TF6CM0LGiyDbKzbNho@etZ2D5SQGh&E*Eh z&xOGktsdC%ZF28^GO}7^%jkVw;(fj1oZC0}im+VnnqMFFF~iPA7=bAZn~xA=^BR$& zmN$ZFkgV(%PV}j=@Z|@Fss}azQ-f}r6y|{7d zMJX@DmD28n?pI!Qo8w<3R36+DVo*Fp2razvDL0hc0EfHT$~5#D(hE_wAV(SX*W%EP z8=U|#(8u^qG_}Y7zoWl!8M=X5fkDwBko^;APNpuH7$OGMD?uO7-vAsVH)M(|pA7h9 zxcH|4L!%}^A7gXqZxBTcYLWzfj5X{7vBk(`CuaEvU?g&wKMG70_{7Y86+Wb+i#a@h U_2T2`0T0>Rth3Ho?YZ;60kX|o`~Uy| literal 0 HcmV?d00001 diff --git a/ReCodeItGUI_WPF/Assets/wpfui-icon-256.png b/ReCodeItGUI_WPF/Assets/wpfui-icon-256.png new file mode 100644 index 0000000000000000000000000000000000000000..6b5cf5d5aea2c545e8c5ca44f61ff7cb4669a2dd GIT binary patch literal 4391 zcmd5=3s4hh9$zS}6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*vFgXn@hWpk z{r>VX&hbw&^DjS7OU}a>@l@>x-{d!c0-0{K3&OX#XEmf3>EC%$e8}TbT}YsT?V7PA zWqNn%xaoVzTlhYmR5Ux2N~~!@x5# zld-j;AmisEm9hX2b5y1`{3LL!&Vnjpx+0x+b^nlhq_*$b0<$DH^QT)M1v#EH+b1eb z{A+cwPMg|d7xeC%Q{Hlz>FS-IGQIcW3=h|18!AL|*5BcFY&-M!oV5#V7j5_US@}Ye zd-q27+^7HIw)m8V2HJ-@U)pZUP6U9I75U~x{E}YK0Xtyr@F%&%JK^f6?9$(?WeC{;UequwKYHNy9V$!{&2Z6Wo z7F)ZS*E6o#dm2u^h^yT7;?e0YwD6IS%T8YxXIH4)WmRL&?4T6C zKh6B%-yt>;eoOD2?CfS7{q{Wwu{p3{$6UXH(hwV{w$AR2ao_d9#`zohn?+QUtH7?^zkl%-(HX8KPUD!Cf|<#{*ZZ+DkyWN-_FpjPKicy@$>un zm5Zm9=Z>9dDF7E&$h&Y?ZF=PLqKCqs0)pCy%scm8TC#R(;+0_6rQtHyBiVg7yDrzZ zH+lwj&xX2dj>NV-?>hk!6?1)AdOgcM>Bu&3JnB5N(hsC`N=F`^wx0RcsjkbZ_jG`A z+Wy88_I_KNLtk%A)safo!L4GOJ4uHH&yCyav&NoxoBY<7!G-0gTFnj~#XUVuq0_YE zeDXhws^bal3S7SOZ)+8B%@0&=4xX!Ld8gjG5D@?U?LDV{e(dU4Cr@avx>C_mmFV - /// Returns the string result of the dialog - /// - /// Path if valid, or empty string - public static string OpenFileDialog(bool dll = false) - { - var title = dll ? "Select a DLL File" : "Select a Json File"; - - var defaultExt = dll ? ".dll" : ".jsonc"; - - var dllFilter = "DLL files (*.dll)|*.dll|All files (*.*)|*.*"; - var jsonFilter = "JSON/JSONC files (*.json;*.jsonc)|*.json;*.jsonc|All files (*.*)|*.*"; - - var openFileDialog = new OpenFileDialog(); - openFileDialog.Title = title; - openFileDialog.Filter = dll ? dllFilter : jsonFilter; - openFileDialog.DefaultExt = defaultExt; - - bool? result = openFileDialog.ShowDialog(); - - if (result == true) - { - return openFileDialog.FileName; - } - - return string.Empty; - } - - public static RemapModel CreateRemapFromGui(this MainWindow window) - { - var model = new RemapModel - { - NewTypeName = window.NewTypeNameTextBox.Text, - OriginalTypeName = window.OriginalTypeNameTextBox.Text ?? string.Empty, - UseForceRename = (bool)window.UseForceRenameCheckbox.IsChecked, - SearchParams = new SearchParams - { - IsPublic = window.IsPublicComboBox.IsComboEnabled(), - IsAbstract = window.IsAbstractComboBox.IsComboEnabled(), - IsInterface = window.IsInterfaceComboBox.IsComboEnabled(), - IsEnum = window.IsEnumComboBox.IsComboEnabled(), - IsNested = window.IsNestedComboBox.IsComboEnabled(), - IsSealed = window.IsSealedComboBox.IsComboEnabled(), - HasAttribute = window.HasAttributeComboBox.IsComboEnabled(), - IsDerived = window.IsDerivedComboBox.IsComboEnabled(), - HasGenericParameters = window.HasAttributeComboBox.IsComboEnabled(), - ParentName = window.ParentNameTextBox.GetText(), - MatchBaseClass = window.IncludeBaseClassTextBox.GetText(), - IgnoreBaseClass = window.IgnoreBaseClassTextBox.GetText(), - ConstructorParameterCount = window.CtorParamCountUpDown.GetValIfEnabled(window.CtorCheckbox), - MethodCount = window.MethodCountUpDown.GetValIfEnabled(window.MethodCheckbox), - FieldCount = window.FieldCountUpDown.GetValIfEnabled(window.FieldCountCheckbox), - PropertyCount = window.PropertyCountUpDown.GetValIfEnabled(window.PropertyCountCheckBox), - NestedTypeCount = window.NestedTypeCountUpDown.GetValIfEnabled(window.NestedTypeCountCheckBox), - IncludeMethods = window.MethodIncludeListView.GetItems(), - ExcludeMethods = window.MethodExcludeListView.GetItems(), - IncludeFields = window.FieldIncludeListView.GetItems(), - ExcludeFields = window.FieldExcludeListView.GetItems(), - IncludeProperties = window.PropertyIncludeListBox.GetItems(), - ExcludeProperties = window.PropertyExcludeListBox.GetItems(), - IncludeNestedTypes = window.NestedTypeIncludeListView.GetItems(), - ExcludeNestedTypes = window.NestedTypeExcludeListView.GetItems(), - } - }; - - return model; - } - - /// - /// True or false if selected, otherwise null - /// - /// - /// - public static bool? IsComboEnabled(this ComboBox comboBox) - { - if (bool.TryParse(comboBox.Text, out var result)) - { - return result; - } - - return null; - } - - /// - /// returns the text in the box if exists, or null - /// - /// - /// - public static string? GetText(this TextBox textBox) - { - if (textBox.Text != string.Empty) - { - return textBox.Text; - } - - return null; - } - - public static int? GetValIfEnabled(this IntegerUpDown intUpDown, CheckBox cBox) - { - if ((bool)cBox.IsChecked) - { - return intUpDown.Value; - } - - return null; - } - - /// - /// Converts list view objects to string list - /// - /// - /// - public static List GetItems(this ListView listView) - { - var tmp = new List(); - - foreach (var item in listView.Items) - { - tmp.Add(item.ToString()); - } - - return tmp; - } - } -} \ No newline at end of file diff --git a/ReCodeItGUI_WPF/MainWindow.xaml b/ReCodeItGUI_WPF/MainWindow.xaml deleted file mode 100644 index 6e80674..0000000 --- a/ReCodeItGUI_WPF/MainWindow.xaml +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - -