From 6bf6357dba00fbfad3da1a111f189fc3cfb43400 Mon Sep 17 00:00:00 2001 From: Kevin Wegman Date: Fri, 26 May 2023 00:10:08 -0400 Subject: [PATCH 1/9] Rewrite application as .net Maui app --- StudentFileRename.sln | 34 +- StudentFileRename/App.xaml | 27 +- StudentFileRename/App.xaml.cs | 56 +-- StudentFileRename/AppShell.xaml | 14 + StudentFileRename/AppShell.xaml.cs | 9 + StudentFileRename/AssemblyInfo.cs | 10 - StudentFileRename/Interface/IDialogService.cs | 12 - .../Interface/IFileDialogService.cs | 11 - .../Interface/IFileNameRetrievalService.cs | 11 - StudentFileRename/MainPage.xaml | 72 ++++ StudentFileRename/MainPage.xaml.cs | 213 +++++++++ StudentFileRename/MauiProgram.cs | 29 ++ StudentFileRename/Model/ConversionError.cs | 11 - StudentFileRename/Model/ConversionRequest.cs | 67 --- StudentFileRename/Platforms/Windows/App.xaml | 8 + .../Platforms/Windows/App.xaml.cs | 24 ++ .../Platforms/Windows/Package.appxmanifest | 46 ++ .../Platforms/Windows/app.manifest | 15 + .../PublishProfiles/FolderProfile.pubxml | 12 - .../PublishProfiles/MSIX-win10-x64.pubxml | 16 + .../PublishProfiles/MSIX-win10-x86.pubxml | 16 + .../Properties/Resources.Designer.cs | 63 --- StudentFileRename/Properties/Resources.resx | 120 ------ .../Properties/launchSettings.json | 8 + StudentFileRename/README.md | 1 - .../Resources/AppIcon/appicon.svg | 4 + .../Resources/AppIcon/appiconfg.svg | 8 + .../Resources/Fonts/OpenSans-Regular.ttf | Bin 0 -> 107184 bytes .../Resources/Fonts/OpenSans-Semibold.ttf | Bin 0 -> 111076 bytes .../Resources/Images/dotnet_bot.svg | 93 ++++ .../Resources/Raw/AboutAssets.txt | 15 + StudentFileRename/Resources/Splash/splash.svg | 8 + .../Resources/Styles/Colors.xaml | 44 ++ .../Resources/Styles/Styles.xaml | 405 ++++++++++++++++++ .../Service/MaterialDesignDialogService.cs | 17 - .../Service/WindowsFileDialogService.cs | 42 -- StudentFileRename/StudentFileRename.csproj | 136 ++++-- .../Utility/BoolToVisibilityConverter.cs | 42 -- StudentFileRename/Utility/RelayCommand.cs | 37 -- StudentFileRename/View/MainWindow.xaml | 29 -- StudentFileRename/View/MainWindow.xaml.cs | 17 - StudentFileRename/View/StartupPageView.xaml | 96 ----- .../View/StartupPageView.xaml.cs | 16 - StudentFileRename/ViewModel/BaseViewModel.cs | 18 - .../ViewModel/InformationalDialogViewModel.cs | 14 - .../ViewModel/MainWindowViewModel.cs | 45 -- .../ViewModel/StartupPageViewModel.cs | 208 --------- StudentFileRename/nlog.config | 27 -- StudentFileRename/x64/concrt140.dll | Bin 0 -> 327576 bytes StudentFileRename/x64/msvcp140.dll | Bin 0 -> 578384 bytes StudentFileRename/x64/msvcp140_1.dll | Bin 0 -> 35704 bytes StudentFileRename/x64/msvcp140_2.dll | Bin 0 -> 267160 bytes .../x64/msvcp140_atomic_wait.dll | Bin 0 -> 50072 bytes .../x64/msvcp140_codecvt_ids.dll | Bin 0 -> 31640 bytes StudentFileRename/x64/vccorlib140.dll | Bin 0 -> 346008 bytes StudentFileRename/x64/vcruntime140.dll | Bin 0 -> 109440 bytes StudentFileRename/x64/vcruntime140_1.dll | Bin 0 -> 49560 bytes 57 files changed, 1167 insertions(+), 1059 deletions(-) create mode 100644 StudentFileRename/AppShell.xaml create mode 100644 StudentFileRename/AppShell.xaml.cs delete mode 100644 StudentFileRename/AssemblyInfo.cs delete mode 100644 StudentFileRename/Interface/IDialogService.cs delete mode 100644 StudentFileRename/Interface/IFileDialogService.cs delete mode 100644 StudentFileRename/Interface/IFileNameRetrievalService.cs create mode 100644 StudentFileRename/MainPage.xaml create mode 100644 StudentFileRename/MainPage.xaml.cs create mode 100644 StudentFileRename/MauiProgram.cs delete mode 100644 StudentFileRename/Model/ConversionError.cs delete mode 100644 StudentFileRename/Model/ConversionRequest.cs create mode 100644 StudentFileRename/Platforms/Windows/App.xaml create mode 100644 StudentFileRename/Platforms/Windows/App.xaml.cs create mode 100644 StudentFileRename/Platforms/Windows/Package.appxmanifest create mode 100644 StudentFileRename/Platforms/Windows/app.manifest delete mode 100644 StudentFileRename/Properties/PublishProfiles/FolderProfile.pubxml create mode 100644 StudentFileRename/Properties/PublishProfiles/MSIX-win10-x64.pubxml create mode 100644 StudentFileRename/Properties/PublishProfiles/MSIX-win10-x86.pubxml delete mode 100644 StudentFileRename/Properties/Resources.Designer.cs delete mode 100644 StudentFileRename/Properties/Resources.resx create mode 100644 StudentFileRename/Properties/launchSettings.json delete mode 100644 StudentFileRename/README.md create mode 100644 StudentFileRename/Resources/AppIcon/appicon.svg create mode 100644 StudentFileRename/Resources/AppIcon/appiconfg.svg create mode 100644 StudentFileRename/Resources/Fonts/OpenSans-Regular.ttf create mode 100644 StudentFileRename/Resources/Fonts/OpenSans-Semibold.ttf create mode 100644 StudentFileRename/Resources/Images/dotnet_bot.svg create mode 100644 StudentFileRename/Resources/Raw/AboutAssets.txt create mode 100644 StudentFileRename/Resources/Splash/splash.svg create mode 100644 StudentFileRename/Resources/Styles/Colors.xaml create mode 100644 StudentFileRename/Resources/Styles/Styles.xaml delete mode 100644 StudentFileRename/Service/MaterialDesignDialogService.cs delete mode 100644 StudentFileRename/Service/WindowsFileDialogService.cs delete mode 100644 StudentFileRename/Utility/BoolToVisibilityConverter.cs delete mode 100644 StudentFileRename/Utility/RelayCommand.cs delete mode 100644 StudentFileRename/View/MainWindow.xaml delete mode 100644 StudentFileRename/View/MainWindow.xaml.cs delete mode 100644 StudentFileRename/View/StartupPageView.xaml delete mode 100644 StudentFileRename/View/StartupPageView.xaml.cs delete mode 100644 StudentFileRename/ViewModel/BaseViewModel.cs delete mode 100644 StudentFileRename/ViewModel/InformationalDialogViewModel.cs delete mode 100644 StudentFileRename/ViewModel/MainWindowViewModel.cs delete mode 100644 StudentFileRename/ViewModel/StartupPageViewModel.cs delete mode 100644 StudentFileRename/nlog.config create mode 100644 StudentFileRename/x64/concrt140.dll create mode 100644 StudentFileRename/x64/msvcp140.dll create mode 100644 StudentFileRename/x64/msvcp140_1.dll create mode 100644 StudentFileRename/x64/msvcp140_2.dll create mode 100644 StudentFileRename/x64/msvcp140_atomic_wait.dll create mode 100644 StudentFileRename/x64/msvcp140_codecvt_ids.dll create mode 100644 StudentFileRename/x64/vccorlib140.dll create mode 100644 StudentFileRename/x64/vcruntime140.dll create mode 100644 StudentFileRename/x64/vcruntime140_1.dll diff --git a/StudentFileRename.sln b/StudentFileRename.sln index 1b2be8d..7c75c96 100644 --- a/StudentFileRename.sln +++ b/StudentFileRename.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30611.23 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31611.283 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StudentFileRename", "StudentFileRename\StudentFileRename.csproj", "{170C05E7-034C-409B-9A05-6C27E38AFC03}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StudentFileRename", "StudentFileRename\StudentFileRename.csproj", "{07902AE7-9819-4034-85DE-5A5B2E19DA06}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,31 +11,17 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {03B84C34-9812-4724-91E3-668691721AC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {03B84C34-9812-4724-91E3-668691721AC4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {03B84C34-9812-4724-91E3-668691721AC4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {03B84C34-9812-4724-91E3-668691721AC4}.Release|Any CPU.Build.0 = Release|Any CPU - {B997F407-C7D4-4537-B100-BFA989A0B952}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B997F407-C7D4-4537-B100-BFA989A0B952}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B997F407-C7D4-4537-B100-BFA989A0B952}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B997F407-C7D4-4537-B100-BFA989A0B952}.Release|Any CPU.Build.0 = Release|Any CPU - {0402661D-D955-4902-8CE4-4F5F286F5228}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0402661D-D955-4902-8CE4-4F5F286F5228}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0402661D-D955-4902-8CE4-4F5F286F5228}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0402661D-D955-4902-8CE4-4F5F286F5228}.Release|Any CPU.Build.0 = Release|Any CPU - {170C05E7-034C-409B-9A05-6C27E38AFC03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {170C05E7-034C-409B-9A05-6C27E38AFC03}.Debug|Any CPU.Build.0 = Debug|Any CPU - {170C05E7-034C-409B-9A05-6C27E38AFC03}.Release|Any CPU.ActiveCfg = Release|Any CPU - {170C05E7-034C-409B-9A05-6C27E38AFC03}.Release|Any CPU.Build.0 = Release|Any CPU - {B1025947-8153-44AD-9AB7-515812A291D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1025947-8153-44AD-9AB7-515812A291D5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B1025947-8153-44AD-9AB7-515812A291D5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1025947-8153-44AD-9AB7-515812A291D5}.Release|Any CPU.Build.0 = Release|Any CPU + {07902AE7-9819-4034-85DE-5A5B2E19DA06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07902AE7-9819-4034-85DE-5A5B2E19DA06}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07902AE7-9819-4034-85DE-5A5B2E19DA06}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {07902AE7-9819-4034-85DE-5A5B2E19DA06}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07902AE7-9819-4034-85DE-5A5B2E19DA06}.Release|Any CPU.Build.0 = Release|Any CPU + {07902AE7-9819-4034-85DE-5A5B2E19DA06}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {10CB4309-A38C-4812-934F-C1F0DA4DD488} + SolutionGuid = {61F7FB11-1E47-470C-91E2-47F8143E1572} EndGlobalSection EndGlobal diff --git a/StudentFileRename/App.xaml b/StudentFileRename/App.xaml index a20136a..649fb8d 100644 --- a/StudentFileRename/App.xaml +++ b/StudentFileRename/App.xaml @@ -1,29 +1,14 @@ - + + x:Class="StudentFileRename.App"> - - + + - - - - diff --git a/StudentFileRename/App.xaml.cs b/StudentFileRename/App.xaml.cs index f06a615..fcfae5b 100644 --- a/StudentFileRename/App.xaml.cs +++ b/StudentFileRename/App.xaml.cs @@ -1,53 +1,11 @@ -using StudentFileRename.Interface; -using StudentFileRename.Service; -using StudentFileRename.ViewModel; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Win32; -using Ookii.Dialogs.Wpf; -using System.Windows; -using StudentFileRename.View; -using Microsoft.Extensions.Logging; -using NLog.Extensions.Logging; +namespace StudentFileRename; -namespace StudentFileRename +public partial class App : Application { - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - private readonly ServiceProvider _serviceProvider; + public App() + { + InitializeComponent(); - public App() - { - ServiceCollection services = new ServiceCollection(); - ConfigureServices(services); - _serviceProvider = services.BuildServiceProvider(); - } - - private void ConfigureServices(IServiceCollection services) - { - services.AddSingleton() - .AddLogging(loggingBuilder => - { - loggingBuilder.ClearProviders(); - loggingBuilder.SetMinimumLevel(LogLevel.Trace); - loggingBuilder.AddNLog(); - }) - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton() - .AddSingleton(); - } - - protected override void OnStartup(StartupEventArgs e) - { - base.OnStartup(e); - - var mainWindow = _serviceProvider.GetRequiredService(); - mainWindow.Show(); - } - } + MainPage = new AppShell(); + } } diff --git a/StudentFileRename/AppShell.xaml b/StudentFileRename/AppShell.xaml new file mode 100644 index 0000000..28b5e52 --- /dev/null +++ b/StudentFileRename/AppShell.xaml @@ -0,0 +1,14 @@ + + + + + + diff --git a/StudentFileRename/AppShell.xaml.cs b/StudentFileRename/AppShell.xaml.cs new file mode 100644 index 0000000..7b5e082 --- /dev/null +++ b/StudentFileRename/AppShell.xaml.cs @@ -0,0 +1,9 @@ +namespace StudentFileRename; + +public partial class AppShell : Shell +{ + public AppShell() + { + InitializeComponent(); + } +} diff --git a/StudentFileRename/AssemblyInfo.cs b/StudentFileRename/AssemblyInfo.cs deleted file mode 100644 index 8b5504e..0000000 --- a/StudentFileRename/AssemblyInfo.cs +++ /dev/null @@ -1,10 +0,0 @@ -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) -)] diff --git a/StudentFileRename/Interface/IDialogService.cs b/StudentFileRename/Interface/IDialogService.cs deleted file mode 100644 index 7616784..0000000 --- a/StudentFileRename/Interface/IDialogService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; - -namespace StudentFileRename.Interface -{ - public interface IDialogService - { - public Task ShowDialog(object content); - } -} diff --git a/StudentFileRename/Interface/IFileDialogService.cs b/StudentFileRename/Interface/IFileDialogService.cs deleted file mode 100644 index c98a53f..0000000 --- a/StudentFileRename/Interface/IFileDialogService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StudentFileRename.Interface -{ - public interface IFileDialogService - { - public string GetFilePathFromExplorer(bool isFolder, string filter = null); - } -} diff --git a/StudentFileRename/Interface/IFileNameRetrievalService.cs b/StudentFileRename/Interface/IFileNameRetrievalService.cs deleted file mode 100644 index 95f1e09..0000000 --- a/StudentFileRename/Interface/IFileNameRetrievalService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace StudentFileRename.Interface -{ - public interface IFileNameRetrievalService - { - string FindFilePathName(string filter, bool isFolder); - } -} diff --git a/StudentFileRename/MainPage.xaml b/StudentFileRename/MainPage.xaml new file mode 100644 index 0000000..93ce6ff --- /dev/null +++ b/StudentFileRename/MainPage.xaml @@ -0,0 +1,72 @@ + + + + + + + + + +