From a6f4035864427ae1af3569f69615fb89bf415654 Mon Sep 17 00:00:00 2001 From: gaviny82 <38808970+gaviny82@users.noreply.github.com> Date: Thu, 4 Jul 2024 11:33:52 +0800 Subject: [PATCH] [Infra] Separate UI services from the main project (#238) * Move UI services into a separate project * Fix build * Move project path * Add WinUI infra project * Rename WinUI infra classes * Move project * Rename namespaces --- Natsurainko.FluentLauncher.sln | 42 +++++++++++++++++++ Natsurainko.FluentLauncher/App.xaml.cs | 12 ++++-- .../Natsurainko.FluentLauncher.csproj | 1 + .../Services/Download/DownloadService.cs | 4 +- .../SystemServices/JumpListService.cs | 2 +- .../ActivitiesNavigationViewModel.cs | 2 +- .../Activities/DownloadViewModel.cs | 2 +- .../ViewModels/Activities/LaunchViewModel.cs | 2 +- .../Common/DeleteGameDialogViewModel.cs | 2 +- .../ResourceItemFilesDialogViewModel.cs | 2 +- .../ViewModels/Cores/CoresViewModel.cs | 2 +- .../Cores/Manage/CoreModsViewModel.cs | 2 +- .../Cores/Manage/CoreSettingsViewModel.cs | 2 +- .../Cores/Manage/CoreStatisticViewModel.cs | 2 +- .../Cores/ManageNavigationViewModel.cs | 2 +- .../Downloads/CoreInstallWizardViewModel.cs | 2 +- .../Downloads/DownloadsViewModel.cs | 2 +- .../Downloads/ResourceItemViewModel.cs | 2 +- .../Downloads/ResourcesSearchViewModel.cs | 2 +- .../ViewModels/Home/HomeViewModel.cs | 3 +- .../ViewModels/OOBE/OOBEViewModel.cs | 3 +- .../ViewModels/Settings/LaunchViewModel.cs | 3 +- .../Settings/SettingsNavigationViewModel.cs | 3 +- .../ViewModels/ShellViewModel.cs | 3 +- .../ActivitiesNavigationPage.xaml.cs | 4 +- .../Views/Cores/ManageNavigationPage.xaml.cs | 3 +- .../Downloads/CoreInstallWizardPage.xaml.cs | 3 +- .../Views/MainWindow.xaml.cs | 3 +- .../Views/OOBE/OOBENavigationPage.xaml.cs | 4 +- .../Views/Settings/NavigationPage.xaml.cs | 5 ++- .../Views/ShellPage.xaml.cs | 4 +- .../FluentLauncher.Infra.UI.csproj | 13 ++++++ .../Navigation/INavigationAware.cs | 2 +- .../Navigation/INavigationProvider.cs | 4 +- .../Navigation/INavigationService.cs | 4 +- .../Pages/PageProvider.cs | 2 +- .../Pages/PageProviderBuilder.cs | 3 +- .../Windows/ActivationService.cs | 10 ++--- .../Windows/ActivationServiceBuilder.cs | 4 +- .../Windows/IActivationService.cs | 6 +-- .../Windows/IWindowService.cs | 4 +- .../FluentLauncher.Infra.WinUI.csproj | 23 ++++++++++ .../Navigation/WinUINavigationService.cs | 15 ++++--- .../Pages/WinUIPageProvider.cs | 6 ++- .../Windows/WinUIActivationService.cs | 9 ++-- .../Windows/WinUIWindowService.cs | 9 ++-- 46 files changed, 167 insertions(+), 77 deletions(-) create mode 100644 infra/FluentLauncher.Infra.UI/FluentLauncher.Infra.UI.csproj rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Navigation/INavigationAware.cs (77%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Navigation/INavigationProvider.cs (74%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Navigation/INavigationService.cs (94%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Pages/PageProvider.cs (96%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Pages/PageProviderBuilder.cs (96%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Windows/ActivationService.cs (89%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Windows/ActivationServiceBuilder.cs (94%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Windows/IActivationService.cs (92%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.UI}/Windows/IWindowService.cs (78%) create mode 100644 infra/FluentLauncher.Infra.WinUI/FluentLauncher.Infra.WinUI.csproj rename Natsurainko.FluentLauncher/Services/UI/Navigation/NavigationService.cs => infra/FluentLauncher.Infra.WinUI/Navigation/WinUINavigationService.cs (89%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.WinUI}/Pages/WinUIPageProvider.cs (85%) rename {Natsurainko.FluentLauncher/Services/UI => infra/FluentLauncher.Infra.WinUI}/Windows/WinUIActivationService.cs (77%) rename Natsurainko.FluentLauncher/Services/UI/Windows/WindowService.cs => infra/FluentLauncher.Infra.WinUI/Windows/WinUIWindowService.cs (68%) diff --git a/Natsurainko.FluentLauncher.sln b/Natsurainko.FluentLauncher.sln index 4f001498..3940f5f0 100644 --- a/Natsurainko.FluentLauncher.sln +++ b/Natsurainko.FluentLauncher.sln @@ -7,6 +7,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Natsurainko.FluentLauncher" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Natsurainko.FluentCore", "Natsurainko.FluentCore\Natsurainko.FluentCore\Natsurainko.FluentCore.csproj", "{7CA745E6-DEE6-4018-87DB-4012EC94C3B8}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{0537A9FF-BF86-4F92-A731-B6141B27ADDB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FluentLauncher.Infra.UI", "infra\FluentLauncher.Infra.UI\FluentLauncher.Infra.UI.csproj", "{EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FluentLauncher.Infra.WinUI", "infra\FluentLauncher.Infra.WinUI\FluentLauncher.Infra.WinUI.csproj", "{0AD85018-AAA2-49D9-A29F-910E6A82A6BF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -54,10 +60,46 @@ Global {7CA745E6-DEE6-4018-87DB-4012EC94C3B8}.Release|x64.Build.0 = Release|Any CPU {7CA745E6-DEE6-4018-87DB-4012EC94C3B8}.Release|x86.ActiveCfg = Release|Any CPU {7CA745E6-DEE6-4018-87DB-4012EC94C3B8}.Release|x86.Build.0 = Release|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Debug|ARM64.Build.0 = Debug|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Debug|x64.ActiveCfg = Debug|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Debug|x64.Build.0 = Debug|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Debug|x86.ActiveCfg = Debug|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Debug|x86.Build.0 = Debug|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Release|Any CPU.Build.0 = Release|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Release|ARM64.ActiveCfg = Release|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Release|ARM64.Build.0 = Release|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Release|x64.ActiveCfg = Release|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Release|x64.Build.0 = Release|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Release|x86.ActiveCfg = Release|Any CPU + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F}.Release|x86.Build.0 = Release|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Debug|ARM64.Build.0 = Debug|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Debug|x64.ActiveCfg = Debug|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Debug|x64.Build.0 = Debug|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Debug|x86.ActiveCfg = Debug|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Debug|x86.Build.0 = Debug|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Release|Any CPU.Build.0 = Release|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Release|ARM64.ActiveCfg = Release|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Release|ARM64.Build.0 = Release|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Release|x64.ActiveCfg = Release|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Release|x64.Build.0 = Release|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Release|x86.ActiveCfg = Release|Any CPU + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {EC4A7DE1-589A-4FFF-9E2A-48ED6114182F} = {0537A9FF-BF86-4F92-A731-B6141B27ADDB} + {0AD85018-AAA2-49D9-A29F-910E6A82A6BF} = {0537A9FF-BF86-4F92-A731-B6141B27ADDB} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {7BD789E2-AC9A-40C1-BD71-A7DA5DFBF325} EndGlobalSection diff --git a/Natsurainko.FluentLauncher/App.xaml.cs b/Natsurainko.FluentLauncher/App.xaml.cs index dd76a7aa..fe94f17b 100644 --- a/Natsurainko.FluentLauncher/App.xaml.cs +++ b/Natsurainko.FluentLauncher/App.xaml.cs @@ -1,5 +1,12 @@ using AppSettingsManagement; using AppSettingsManagement.Windows; +using FluentLauncher.Infra.UI.Navigation; +using FluentLauncher.Infra.UI.Pages; +using FluentLauncher.Infra.UI.Windows; +using FluentLauncher.Infra.WinUI; +using FluentLauncher.Infra.WinUI.Navigation; +using FluentLauncher.Infra.WinUI.Pages; +using FluentLauncher.Infra.WinUI.Windows; using Microsoft.Extensions.DependencyInjection; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml; @@ -11,9 +18,6 @@ using Natsurainko.FluentLauncher.Services.SystemServices; using Natsurainko.FluentLauncher.Services.UI; using Natsurainko.FluentLauncher.Services.UI.Messaging; -using Natsurainko.FluentLauncher.Services.UI.Navigation; -using Natsurainko.FluentLauncher.Services.UI.Pages; -using Natsurainko.FluentLauncher.Services.UI.Windows; using Natsurainko.FluentLauncher.ViewModels; using Natsurainko.FluentLauncher.ViewModels.Activities; using Natsurainko.FluentLauncher.Views; @@ -129,7 +133,7 @@ private static IServiceProvider ConfigureServices() // UI services services.AddSingleton(sp => BuildPageProvider(sp)); services.AddSingleton(_ => BuildActivationService()); - services.AddScoped(); // A scope is created for each window or page that supports navigation. + services.AddScoped(); // A scope is created for each window or page that supports navigation. // Settings service services.AddSingleton(); diff --git a/Natsurainko.FluentLauncher/Natsurainko.FluentLauncher.csproj b/Natsurainko.FluentLauncher/Natsurainko.FluentLauncher.csproj index 67677836..ea62639f 100644 --- a/Natsurainko.FluentLauncher/Natsurainko.FluentLauncher.csproj +++ b/Natsurainko.FluentLauncher/Natsurainko.FluentLauncher.csproj @@ -122,6 +122,7 @@ + diff --git a/Natsurainko.FluentLauncher/Services/Download/DownloadService.cs b/Natsurainko.FluentLauncher/Services/Download/DownloadService.cs index 2f509ec2..978e2a47 100644 --- a/Natsurainko.FluentLauncher/Services/Download/DownloadService.cs +++ b/Natsurainko.FluentLauncher/Services/Download/DownloadService.cs @@ -1,9 +1,9 @@ -using Natsurainko.FluentLauncher.Models.Download; +using FluentLauncher.Infra.UI.Navigation; +using Natsurainko.FluentLauncher.Models.Download; using Natsurainko.FluentLauncher.Models.UI; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.Settings; using Natsurainko.FluentLauncher.Services.Storage; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.Utils.Xaml; using Nrk.FluentCore.Management; diff --git a/Natsurainko.FluentLauncher/Services/SystemServices/JumpListService.cs b/Natsurainko.FluentLauncher/Services/SystemServices/JumpListService.cs index 6339db28..8977f1a5 100644 --- a/Natsurainko.FluentLauncher/Services/SystemServices/JumpListService.cs +++ b/Natsurainko.FluentLauncher/Services/SystemServices/JumpListService.cs @@ -2,7 +2,6 @@ using Microsoft.Windows.AppNotifications.Builder; using Natsurainko.FluentLauncher.Components.Launch; using Natsurainko.FluentLauncher.Services.Launch; -using Natsurainko.FluentLauncher.Services.UI.Windows; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Activities; using Nrk.FluentCore.Launch; @@ -14,6 +13,7 @@ using System.Text.Json; using System.Threading.Tasks; using Windows.UI.StartScreen; +using FluentLauncher.Infra.UI.Windows; namespace Natsurainko.FluentLauncher.Services.SystemServices; diff --git a/Natsurainko.FluentLauncher/ViewModels/Activities/ActivitiesNavigationViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Activities/ActivitiesNavigationViewModel.cs index 256ce0eb..aa64040d 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Activities/ActivitiesNavigationViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Activities/ActivitiesNavigationViewModel.cs @@ -1,5 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; -using Natsurainko.FluentLauncher.Services.UI.Navigation; +using FluentLauncher.Infra.UI.Navigation; namespace Natsurainko.FluentLauncher.ViewModels.Activities; diff --git a/Natsurainko.FluentLauncher/ViewModels/Activities/DownloadViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Activities/DownloadViewModel.cs index 82a24bff..59911d65 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Activities/DownloadViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Activities/DownloadViewModel.cs @@ -1,9 +1,9 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml; using Natsurainko.FluentLauncher.Models.UI; using Natsurainko.FluentLauncher.Services.Download; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using System; using System.Collections.ObjectModel; using System.Linq; diff --git a/Natsurainko.FluentLauncher/ViewModels/Activities/LaunchViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Activities/LaunchViewModel.cs index 82bdf901..ece6a9eb 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Activities/LaunchViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Activities/LaunchViewModel.cs @@ -1,9 +1,9 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml; using Natsurainko.FluentLauncher.Components.Launch; using Natsurainko.FluentLauncher.Services.Settings; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using System; using System.Collections.ObjectModel; using System.Collections.Specialized; diff --git a/Natsurainko.FluentLauncher/ViewModels/Common/DeleteGameDialogViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Common/DeleteGameDialogViewModel.cs index 52f200e1..78b0b81f 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Common/DeleteGameDialogViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Common/DeleteGameDialogViewModel.cs @@ -1,9 +1,9 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml.Controls; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.UI; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Nrk.FluentCore.Management; using Nrk.FluentCore.Utils; diff --git a/Natsurainko.FluentLauncher/ViewModels/Common/ResourceItemFilesDialogViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Common/ResourceItemFilesDialogViewModel.cs index 935128d4..1bbfce1c 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Common/ResourceItemFilesDialogViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Common/ResourceItemFilesDialogViewModel.cs @@ -1,5 +1,6 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; using Microsoft.Win32; @@ -7,7 +8,6 @@ using Natsurainko.FluentLauncher.Services.Download; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.Storage; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Nrk.FluentCore.Resources; using System.Collections.Generic; diff --git a/Natsurainko.FluentLauncher/ViewModels/Cores/CoresViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Cores/CoresViewModel.cs index dfbe5af3..823555f1 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Cores/CoresViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Cores/CoresViewModel.cs @@ -1,11 +1,11 @@ using AppSettingsManagement.Mvvm; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Natsurainko.FluentLauncher.Models.Download; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.Settings; using Natsurainko.FluentLauncher.Services.UI; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Nrk.FluentCore.Management; using System.Collections.Generic; diff --git a/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreModsViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreModsViewModel.cs index 115c2bc1..20d8d5fc 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreModsViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreModsViewModel.cs @@ -1,7 +1,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Natsurainko.FluentLauncher.Models.Download; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Nrk.FluentCore.Management; using Nrk.FluentCore.Management.Mods; diff --git a/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreSettingsViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreSettingsViewModel.cs index a81e8559..d5eb62d4 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreSettingsViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreSettingsViewModel.cs @@ -1,9 +1,9 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Natsurainko.FluentLauncher.Models.Launch; using Natsurainko.FluentLauncher.Services.Accounts; using Natsurainko.FluentLauncher.Services.Launch; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Common; using Natsurainko.FluentLauncher.Views; diff --git a/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreStatisticViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreStatisticViewModel.cs index 8d772ba1..3e4f4c27 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreStatisticViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Cores/Manage/CoreStatisticViewModel.cs @@ -1,5 +1,5 @@ using CommunityToolkit.Mvvm.ComponentModel; -using Natsurainko.FluentLauncher.Services.UI.Navigation; +using FluentLauncher.Infra.UI.Navigation; using Nrk.FluentCore.Management; using Nrk.FluentCore.Utils; using System; diff --git a/Natsurainko.FluentLauncher/ViewModels/Cores/ManageNavigationViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Cores/ManageNavigationViewModel.cs index 1e064644..0e68edc0 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Cores/ManageNavigationViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Cores/ManageNavigationViewModel.cs @@ -1,7 +1,7 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml.Controls; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Common; using Natsurainko.FluentLauncher.Views; diff --git a/Natsurainko.FluentLauncher/ViewModels/Downloads/CoreInstallWizardViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Downloads/CoreInstallWizardViewModel.cs index f14015fa..de993539 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Downloads/CoreInstallWizardViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Downloads/CoreInstallWizardViewModel.cs @@ -1,12 +1,12 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media.Animation; using Natsurainko.FluentLauncher.Services.Download; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.Storage; using Natsurainko.FluentLauncher.Services.UI; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Common; using Natsurainko.FluentLauncher.ViewModels.CoreInstallWizard; diff --git a/Natsurainko.FluentLauncher/ViewModels/Downloads/DownloadsViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Downloads/DownloadsViewModel.cs index b843ed60..96a020f9 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Downloads/DownloadsViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Downloads/DownloadsViewModel.cs @@ -1,12 +1,12 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml; using Natsurainko.FluentLauncher.Models.Download; using Natsurainko.FluentLauncher.Models.UI; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.Storage; using Natsurainko.FluentLauncher.Services.UI; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Nrk.FluentCore.Management.Downloader.Data; using Nrk.FluentCore.Resources; diff --git a/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourceItemViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourceItemViewModel.cs index aebc53b6..521909d8 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourceItemViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourceItemViewModel.cs @@ -1,9 +1,9 @@ using CommunityToolkit.Labs.WinUI.MarkdownTextBlock; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml; using Natsurainko.FluentLauncher.Services.Storage; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Common; using Natsurainko.FluentLauncher.Views; diff --git a/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourcesSearchViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourcesSearchViewModel.cs index 3559f853..67a11d40 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourcesSearchViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourcesSearchViewModel.cs @@ -1,11 +1,11 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml; using Natsurainko.FluentLauncher.Models.Download; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.Storage; using Natsurainko.FluentLauncher.Services.UI; -using Natsurainko.FluentLauncher.Services.UI.Navigation; using Natsurainko.FluentLauncher.Utils; using Nrk.FluentCore.Management.Downloader.Data; using Nrk.FluentCore.Resources; diff --git a/Natsurainko.FluentLauncher/ViewModels/Home/HomeViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Home/HomeViewModel.cs index 5f66c420..2fc6b957 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Home/HomeViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Home/HomeViewModel.cs @@ -1,11 +1,12 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml; using Natsurainko.FluentLauncher.Services.Accounts; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.UI.Messaging; -using Natsurainko.FluentLauncher.Services.UI.Navigation; + using Natsurainko.FluentLauncher.Utils; using Nrk.FluentCore.Authentication; using Nrk.FluentCore.Management; diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs index 654cf226..adc3e368 100644 --- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs @@ -2,13 +2,14 @@ using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Messaging; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml.Controls; using Natsurainko.FluentLauncher.Services.Accounts; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.Settings; using Natsurainko.FluentLauncher.Services.UI; using Natsurainko.FluentLauncher.Services.UI.Messaging; -using Natsurainko.FluentLauncher.Services.UI.Navigation; + using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.Views.Common; using Nrk.FluentCore.Authentication; diff --git a/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs index c00459c0..0f5913c3 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs @@ -1,11 +1,12 @@ using AppSettingsManagement.Mvvm; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; +using FluentLauncher.Infra.UI.Navigation; using Microsoft.Win32; using Natsurainko.FluentLauncher.Services.Launch; using Natsurainko.FluentLauncher.Services.Settings; using Natsurainko.FluentLauncher.Services.UI; -using Natsurainko.FluentLauncher.Services.UI.Navigation; + using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Common; using Natsurainko.FluentLauncher.Views; diff --git a/Natsurainko.FluentLauncher/ViewModels/Settings/SettingsNavigationViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Settings/SettingsNavigationViewModel.cs index 52b44172..a4ef7076 100644 --- a/Natsurainko.FluentLauncher/ViewModels/Settings/SettingsNavigationViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/Settings/SettingsNavigationViewModel.cs @@ -1,5 +1,6 @@ using CommunityToolkit.Mvvm.ComponentModel; -using Natsurainko.FluentLauncher.Services.UI.Navigation; +using FluentLauncher.Infra.UI.Navigation; + namespace Natsurainko.FluentLauncher.ViewModels.Settings; diff --git a/Natsurainko.FluentLauncher/ViewModels/ShellViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/ShellViewModel.cs index 1615f862..721a3740 100644 --- a/Natsurainko.FluentLauncher/ViewModels/ShellViewModel.cs +++ b/Natsurainko.FluentLauncher/ViewModels/ShellViewModel.cs @@ -1,4 +1,5 @@ -using Natsurainko.FluentLauncher.Services.UI.Navigation; +using FluentLauncher.Infra.UI.Navigation; + namespace Natsurainko.FluentLauncher.ViewModels; diff --git a/Natsurainko.FluentLauncher/Views/Activities/ActivitiesNavigationPage.xaml.cs b/Natsurainko.FluentLauncher/Views/Activities/ActivitiesNavigationPage.xaml.cs index 59482503..f85e4d58 100644 --- a/Natsurainko.FluentLauncher/Views/Activities/ActivitiesNavigationPage.xaml.cs +++ b/Natsurainko.FluentLauncher/Views/Activities/ActivitiesNavigationPage.xaml.cs @@ -1,7 +1,7 @@ +using FluentLauncher.Infra.UI.Navigation; +using FluentLauncher.Infra.UI.Pages; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Navigation; -using Natsurainko.FluentLauncher.Services.UI.Navigation; -using Natsurainko.FluentLauncher.Services.UI.Pages; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Activities; using System.Linq; diff --git a/Natsurainko.FluentLauncher/Views/Cores/ManageNavigationPage.xaml.cs b/Natsurainko.FluentLauncher/Views/Cores/ManageNavigationPage.xaml.cs index 224204a8..c06e28dc 100644 --- a/Natsurainko.FluentLauncher/Views/Cores/ManageNavigationPage.xaml.cs +++ b/Natsurainko.FluentLauncher/Views/Cores/ManageNavigationPage.xaml.cs @@ -1,5 +1,6 @@ +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml.Controls; -using Natsurainko.FluentLauncher.Services.UI.Navigation; + using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Cores; diff --git a/Natsurainko.FluentLauncher/Views/Downloads/CoreInstallWizardPage.xaml.cs b/Natsurainko.FluentLauncher/Views/Downloads/CoreInstallWizardPage.xaml.cs index 30ed26b2..767bfdcd 100644 --- a/Natsurainko.FluentLauncher/Views/Downloads/CoreInstallWizardPage.xaml.cs +++ b/Natsurainko.FluentLauncher/Views/Downloads/CoreInstallWizardPage.xaml.cs @@ -1,5 +1,6 @@ +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI.Xaml.Controls; -using Natsurainko.FluentLauncher.Services.UI.Navigation; + namespace Natsurainko.FluentLauncher.Views.Downloads; diff --git a/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs b/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs index 64b6dee4..db8fe2cc 100644 --- a/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs +++ b/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs @@ -1,9 +1,10 @@ +using FluentLauncher.Infra.UI.Navigation; using Microsoft.UI; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Natsurainko.FluentLauncher.Services.Settings; using Natsurainko.FluentLauncher.Services.UI; -using Natsurainko.FluentLauncher.Services.UI.Navigation; + using Natsurainko.FluentLauncher.Utils; using System.IO; using Windows.ApplicationModel; diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs index 2d810354..2af2db7a 100644 --- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs +++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs @@ -1,9 +1,9 @@ +using FluentLauncher.Infra.UI.Navigation; +using FluentLauncher.Infra.UI.Pages; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media.Animation; using Microsoft.UI.Xaml.Navigation; -using Natsurainko.FluentLauncher.Services.UI.Navigation; -using Natsurainko.FluentLauncher.Services.UI.Pages; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.OOBE; using System.Linq; diff --git a/Natsurainko.FluentLauncher/Views/Settings/NavigationPage.xaml.cs b/Natsurainko.FluentLauncher/Views/Settings/NavigationPage.xaml.cs index 4379a317..a807b27a 100644 --- a/Natsurainko.FluentLauncher/Views/Settings/NavigationPage.xaml.cs +++ b/Natsurainko.FluentLauncher/Views/Settings/NavigationPage.xaml.cs @@ -1,7 +1,8 @@ +using FluentLauncher.Infra.UI.Navigation; +using FluentLauncher.Infra.UI.Pages; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Navigation; -using Natsurainko.FluentLauncher.Services.UI.Navigation; -using Natsurainko.FluentLauncher.Services.UI.Pages; + using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels.Settings; using System; diff --git a/Natsurainko.FluentLauncher/Views/ShellPage.xaml.cs b/Natsurainko.FluentLauncher/Views/ShellPage.xaml.cs index 735f383b..173da117 100644 --- a/Natsurainko.FluentLauncher/Views/ShellPage.xaml.cs +++ b/Natsurainko.FluentLauncher/Views/ShellPage.xaml.cs @@ -1,11 +1,11 @@ using CommunityToolkit.WinUI.Media.Pipelines; +using FluentLauncher.Infra.UI.Navigation; +using FluentLauncher.Infra.UI.Pages; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Navigation; using Natsurainko.FluentLauncher.Services.Settings; using Natsurainko.FluentLauncher.Services.UI; -using Natsurainko.FluentLauncher.Services.UI.Navigation; -using Natsurainko.FluentLauncher.Services.UI.Pages; using Natsurainko.FluentLauncher.Utils; using Natsurainko.FluentLauncher.ViewModels; using System; diff --git a/infra/FluentLauncher.Infra.UI/FluentLauncher.Infra.UI.csproj b/infra/FluentLauncher.Infra.UI/FluentLauncher.Infra.UI.csproj new file mode 100644 index 00000000..d9cab158 --- /dev/null +++ b/infra/FluentLauncher.Infra.UI/FluentLauncher.Infra.UI.csproj @@ -0,0 +1,13 @@ + + + + net7.0 + enable + true + + + + + + + diff --git a/Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationAware.cs b/infra/FluentLauncher.Infra.UI/Navigation/INavigationAware.cs similarity index 77% rename from Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationAware.cs rename to infra/FluentLauncher.Infra.UI/Navigation/INavigationAware.cs index 3123bcec..b2ec7f25 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationAware.cs +++ b/infra/FluentLauncher.Infra.UI/Navigation/INavigationAware.cs @@ -1,4 +1,4 @@ -namespace Natsurainko.FluentLauncher.Services.UI.Navigation; +namespace FluentLauncher.Infra.UI.Navigation; /// /// Implemented by a view model that can respond to navigation events diff --git a/Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationProvider.cs b/infra/FluentLauncher.Infra.UI/Navigation/INavigationProvider.cs similarity index 74% rename from Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationProvider.cs rename to infra/FluentLauncher.Infra.UI/Navigation/INavigationProvider.cs index 1fff4467..559cb585 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationProvider.cs +++ b/infra/FluentLauncher.Infra.UI/Navigation/INavigationProvider.cs @@ -1,6 +1,4 @@ -namespace Natsurainko.FluentLauncher.Services.UI.Navigation; - -#nullable enable +namespace FluentLauncher.Infra.UI.Navigation; /// /// A page or window that provides navigation diff --git a/Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationService.cs b/infra/FluentLauncher.Infra.UI/Navigation/INavigationService.cs similarity index 94% rename from Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationService.cs rename to infra/FluentLauncher.Infra.UI/Navigation/INavigationService.cs index 9157dedb..ae1d238b 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Navigation/INavigationService.cs +++ b/infra/FluentLauncher.Infra.UI/Navigation/INavigationService.cs @@ -1,8 +1,6 @@ using Microsoft.Extensions.DependencyInjection; -namespace Natsurainko.FluentLauncher.Services.UI.Navigation; - -#nullable enable +namespace FluentLauncher.Infra.UI.Navigation; /// /// A service that controls the navigation in a window or page diff --git a/Natsurainko.FluentLauncher/Services/UI/Pages/PageProvider.cs b/infra/FluentLauncher.Infra.UI/Pages/PageProvider.cs similarity index 96% rename from Natsurainko.FluentLauncher/Services/UI/Pages/PageProvider.cs rename to infra/FluentLauncher.Infra.UI/Pages/PageProvider.cs index d31e4ea2..f494faec 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Pages/PageProvider.cs +++ b/infra/FluentLauncher.Infra.UI/Pages/PageProvider.cs @@ -2,7 +2,7 @@ using System; using System.Collections.Generic; -namespace Natsurainko.FluentLauncher.Services.UI.Pages; +namespace FluentLauncher.Infra.UI.Pages; public record PageDescriptor(Type PageType, Type ViewModelType = null); diff --git a/Natsurainko.FluentLauncher/Services/UI/Pages/PageProviderBuilder.cs b/infra/FluentLauncher.Infra.UI/Pages/PageProviderBuilder.cs similarity index 96% rename from Natsurainko.FluentLauncher/Services/UI/Pages/PageProviderBuilder.cs rename to infra/FluentLauncher.Infra.UI/Pages/PageProviderBuilder.cs index 3d2317a7..541637b9 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Pages/PageProviderBuilder.cs +++ b/infra/FluentLauncher.Infra.UI/Pages/PageProviderBuilder.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; -namespace Natsurainko.FluentLauncher.Services.UI.Pages; +namespace FluentLauncher.Infra.UI.Pages; + public class PageProviderBuilder where TPageProvider : PageProvider { private readonly Dictionary _registeredPages = new(); diff --git a/Natsurainko.FluentLauncher/Services/UI/Windows/ActivationService.cs b/infra/FluentLauncher.Infra.UI/Windows/ActivationService.cs similarity index 89% rename from Natsurainko.FluentLauncher/Services/UI/Windows/ActivationService.cs rename to infra/FluentLauncher.Infra.UI/Windows/ActivationService.cs index 0ece01e6..2588176c 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Windows/ActivationService.cs +++ b/infra/FluentLauncher.Infra.UI/Windows/ActivationService.cs @@ -1,14 +1,14 @@ -using Microsoft.Extensions.DependencyInjection; -using Natsurainko.FluentLauncher.Services.UI.Navigation; +using FluentLauncher.Infra.UI.Navigation; +using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; -namespace Natsurainko.FluentLauncher.Services.UI.Windows; +namespace FluentLauncher.Infra.UI.Windows; /// /// Default implementation of /// -abstract class ActivationService : IActivationService +public abstract class ActivationService : IActivationService { protected readonly IServiceProvider _windowProvider; protected readonly IReadOnlyDictionary _registeredWindows; @@ -21,7 +21,7 @@ abstract class ActivationService : IActivationService /// /// A read only dictionary that maps string keys to objects. /// An that has been configured to support window types according to the rules defined by . - internal ActivationService(IReadOnlyDictionary registeredWindows, IServiceProvider windowProvider) + public ActivationService(IReadOnlyDictionary registeredWindows, IServiceProvider windowProvider) { _registeredWindows = registeredWindows; _windowProvider = windowProvider; diff --git a/Natsurainko.FluentLauncher/Services/UI/Windows/ActivationServiceBuilder.cs b/infra/FluentLauncher.Infra.UI/Windows/ActivationServiceBuilder.cs similarity index 94% rename from Natsurainko.FluentLauncher/Services/UI/Windows/ActivationServiceBuilder.cs rename to infra/FluentLauncher.Infra.UI/Windows/ActivationServiceBuilder.cs index 470427cf..53c6cb72 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Windows/ActivationServiceBuilder.cs +++ b/infra/FluentLauncher.Infra.UI/Windows/ActivationServiceBuilder.cs @@ -2,14 +2,14 @@ using System.Collections.Generic; using System.Collections.ObjectModel; -namespace Natsurainko.FluentLauncher.Services.UI.Windows; +namespace FluentLauncher.Infra.UI.Windows; /// /// Builder of any type derived from /// /// Type of the activation service /// Base type of the window managed by the activation service -class ActivationServiceBuilder where TService : ActivationService +public class ActivationServiceBuilder where TService : ActivationService { private readonly Dictionary _registeredWindows = new(); private readonly IServiceProvider _windowProvider; diff --git a/Natsurainko.FluentLauncher/Services/UI/Windows/IActivationService.cs b/infra/FluentLauncher.Infra.UI/Windows/IActivationService.cs similarity index 92% rename from Natsurainko.FluentLauncher/Services/UI/Windows/IActivationService.cs rename to infra/FluentLauncher.Infra.UI/Windows/IActivationService.cs index 074ddba0..b273e567 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Windows/IActivationService.cs +++ b/infra/FluentLauncher.Infra.UI/Windows/IActivationService.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -namespace Natsurainko.FluentLauncher.Services.UI.Windows; - -#nullable enable +namespace FluentLauncher.Infra.UI.Windows; public record WindowDescriptor(Type WindowType, bool MultiInstance = false); @@ -11,7 +9,7 @@ public record WindowDescriptor(Type WindowType, bool MultiInstance = false); /// A service for activating app windows. /// A window can be registered as single instance or multiple instances with a string key. /// -interface IActivationService +public interface IActivationService { /// /// A dictionary of registered windows that maps a string key to a window type. diff --git a/Natsurainko.FluentLauncher/Services/UI/Windows/IWindowService.cs b/infra/FluentLauncher.Infra.UI/Windows/IWindowService.cs similarity index 78% rename from Natsurainko.FluentLauncher/Services/UI/Windows/IWindowService.cs rename to infra/FluentLauncher.Infra.UI/Windows/IWindowService.cs index d1c1aed9..1fd0cfbf 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Windows/IWindowService.cs +++ b/infra/FluentLauncher.Infra.UI/Windows/IWindowService.cs @@ -1,7 +1,7 @@ -namespace Natsurainko.FluentLauncher.Services.UI.Windows; +namespace FluentLauncher.Infra.UI.Windows; // Sevice for operations of a window -interface IWindowService +public interface IWindowService { string Title { get; set; } diff --git a/infra/FluentLauncher.Infra.WinUI/FluentLauncher.Infra.WinUI.csproj b/infra/FluentLauncher.Infra.WinUI/FluentLauncher.Infra.WinUI.csproj new file mode 100644 index 00000000..18892d41 --- /dev/null +++ b/infra/FluentLauncher.Infra.WinUI/FluentLauncher.Infra.WinUI.csproj @@ -0,0 +1,23 @@ + + + net7.0-windows10.0.19041.0 + 10.0.17763.0 + FluentLauncher.Infra.WinUI + win-x86;win-x64;win-arm64 + win10-x86;win10-x64;win10-arm64 + true + enable + true + + + + + + + + + + + + + \ No newline at end of file diff --git a/Natsurainko.FluentLauncher/Services/UI/Navigation/NavigationService.cs b/infra/FluentLauncher.Infra.WinUI/Navigation/WinUINavigationService.cs similarity index 89% rename from Natsurainko.FluentLauncher/Services/UI/Navigation/NavigationService.cs rename to infra/FluentLauncher.Infra.WinUI/Navigation/WinUINavigationService.cs index bf07a1b2..311fced3 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Navigation/NavigationService.cs +++ b/infra/FluentLauncher.Infra.WinUI/Navigation/WinUINavigationService.cs @@ -1,15 +1,14 @@ -using Microsoft.Extensions.DependencyInjection; +using FluentLauncher.Infra.UI.Navigation; +using FluentLauncher.Infra.UI.Pages; +using Microsoft.Extensions.DependencyInjection; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using Natsurainko.FluentLauncher.Services.UI.Pages; using System; using System.Collections.Generic; -#nullable enable +namespace FluentLauncher.Infra.WinUI.Navigation; -namespace Natsurainko.FluentLauncher.Services.UI.Navigation; - -public class NavigationService : INavigationService +public class WinUINavigationService : INavigationService { private INavigationProvider? _navigationProvider; public INavigationProvider NavigationProvider @@ -27,7 +26,7 @@ public IServiceScope Scope private readonly IPageProvider _pageProvider; - public NavigationService(IPageProvider pageProvider) + public WinUINavigationService(IPageProvider pageProvider) { _pageProvider = pageProvider; } @@ -113,7 +112,7 @@ private void ConfigureFrameContent(string key, object? parameter) } // After navigation - if (page.ReadLocalValue(Page.DataContextProperty) != DependencyProperty.UnsetValue && // Requires VM set for the page, rather than inherited + if (page.ReadLocalValue(FrameworkElement.DataContextProperty) != DependencyProperty.UnsetValue && // Requires VM set for the page, rather than inherited page.DataContext is INavigationAware vmAfter) vmAfter.OnNavigatedTo(parameter); } diff --git a/Natsurainko.FluentLauncher/Services/UI/Pages/WinUIPageProvider.cs b/infra/FluentLauncher.Infra.WinUI/Pages/WinUIPageProvider.cs similarity index 85% rename from Natsurainko.FluentLauncher/Services/UI/Pages/WinUIPageProvider.cs rename to infra/FluentLauncher.Infra.WinUI/Pages/WinUIPageProvider.cs index 31281c00..e84ba113 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Pages/WinUIPageProvider.cs +++ b/infra/FluentLauncher.Infra.WinUI/Pages/WinUIPageProvider.cs @@ -1,8 +1,10 @@ -using Microsoft.UI.Xaml.Controls; +using FluentLauncher.Infra.UI.Pages; +using Microsoft.UI.Xaml.Controls; using System; using System.Collections.Generic; -namespace Natsurainko.FluentLauncher.Services.UI.Pages; +namespace FluentLauncher.Infra.WinUI.Pages; + public class WinUIPageProvider : PageProvider { // Factory pattern diff --git a/Natsurainko.FluentLauncher/Services/UI/Windows/WinUIActivationService.cs b/infra/FluentLauncher.Infra.WinUI/Windows/WinUIActivationService.cs similarity index 77% rename from Natsurainko.FluentLauncher/Services/UI/Windows/WinUIActivationService.cs rename to infra/FluentLauncher.Infra.WinUI/Windows/WinUIActivationService.cs index 81b16deb..e8a659ee 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Windows/WinUIActivationService.cs +++ b/infra/FluentLauncher.Infra.WinUI/Windows/WinUIActivationService.cs @@ -1,11 +1,12 @@ -using Microsoft.Extensions.DependencyInjection; +using FluentLauncher.Infra.UI.Windows; +using Microsoft.Extensions.DependencyInjection; using Microsoft.UI.Xaml; using System; using System.Collections.Generic; -namespace Natsurainko.FluentLauncher.Services.UI.Windows; +namespace FluentLauncher.Infra.WinUI.Windows; -internal class WinUIActivationService : ActivationService +public class WinUIActivationService : ActivationService { // Factory pattern public static ActivationServiceBuilder GetBuilder(IServiceProvider windowProvider) @@ -20,7 +21,7 @@ private WinUIActivationService(IReadOnlyDictionary reg protected override IWindowService ActivateWindow(Window window) { window.Activate(); - return new WindowService(window); + return new WinUIWindowService(window); } protected override void ConfigureWindowClose(Window window, IServiceScope scope) diff --git a/Natsurainko.FluentLauncher/Services/UI/Windows/WindowService.cs b/infra/FluentLauncher.Infra.WinUI/Windows/WinUIWindowService.cs similarity index 68% rename from Natsurainko.FluentLauncher/Services/UI/Windows/WindowService.cs rename to infra/FluentLauncher.Infra.WinUI/Windows/WinUIWindowService.cs index 3a589294..75fb955a 100644 --- a/Natsurainko.FluentLauncher/Services/UI/Windows/WindowService.cs +++ b/infra/FluentLauncher.Infra.WinUI/Windows/WinUIWindowService.cs @@ -1,12 +1,13 @@ -using Microsoft.UI.Xaml; +using FluentLauncher.Infra.UI.Windows; +using Microsoft.UI.Xaml; using WinUIEx; -namespace Natsurainko.FluentLauncher.Services.UI.Windows; +namespace FluentLauncher.Infra.WinUI.Windows; /// /// Default implementation of for a WinUI window. /// -class WindowService : IWindowService +public class WinUIWindowService : IWindowService { private readonly Window _window; @@ -16,7 +17,7 @@ public string Title set => _window.Title = value; } - public WindowService(Window window) + public WinUIWindowService(Window window) { _window = window; }