XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.NetCore.WinUIHelper

【DLL】WinUI的各种工具类,帮助开发者快速构建一个模块化的WinUI项目

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.NetCore.WinUIHelper

简化服务类实现,更新项目版本

在多个服务类中移除了对 `IWinUIService<T, R>` 接口的实现,直接实现各自的服务接口。添加了 `INavigationParameterService` 的静态构造函数以注册服务。移除了 `IWinUIService` 接口及 `StandardApp`、`StandardMainWindow` 的相关实现,简化了代码结构。更新了 `GlobalServiceManager` 中的服务注册字典,确保服务正确实例化。`AppThemeHelper` 类中添加了对主窗口的引用,简化主题更改实现。项目文件版本号从 `1.0.0` 更新至 `1.0.1`,并调整了描述信息。

71345d2
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

16 个文件 +47 -85
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/AutoNavigationService.cs +1 -2
@@ -6,8 +6,7 @@ using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
6 6
7 7 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
8 8
9 /// <inheritdoc cref="IAutoNavigationService"/>
10 internal class AutoNavigationService : GlobalServiceBase, IAutoNavigationService, IWinUIService<AutoNavigationService, IAutoNavigationService>
9 internal class AutoNavigationService : GlobalServiceBase, IAutoNavigationService
11 10 {
12 11 private Frame? frame;
13 12 public bool CanGoBack => frame is not null && frame.CanGoBack;
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/DialogService.cs +1 -1
@@ -2,7 +2,7 @@
2 2
3 3 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
4 4
5 class DialogService : IDialogService, IWinUIService<DialogService, IDialogService>
5 class DialogService : IDialogService
6 6 {
7 7 private readonly Dictionary<string, ContentDialog> dialogDictionary = [];
8 8 public Dictionary<string, ContentDialog> DialogDictionary => dialogDictionary;
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/ListViewService.cs +1 -1
@@ -3,7 +3,7 @@ using XFEExtension.NetCore.WinUIHelper.Interface.Services;
3 3
4 4 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
5 5
6 class ListViewService : IListViewService, IWinUIService<ListViewService, IListViewService>
6 class ListViewService : IListViewService
7 7 {
8 8 private ListView? _listView;
9 9
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/LoadingService.cs +1 -1
@@ -5,7 +5,7 @@ using XFEExtension.NetCore.WinUIHelper.Interface.Services;
5 5
6 6 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
7 7
8 class LoadingService : GlobalServiceBase, ILoadingService, IWinUIService<LoadingService, ILoadingService>
8 class LoadingService : GlobalServiceBase, ILoadingService
9 9 {
10 10 private Grid? _loadingGrid;
11 11 private Grid? _globalLoadingGrid;
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/NavigationParameterService.cs +1 -1
@@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
4 4
5 5 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
6 6
7 class NavigationParameterService<T> : INavigationParameterService<T>, IWinUIService<NavigationParameterService<T>, INavigationParameterService<T>>
7 class NavigationParameterService<T> : INavigationParameterService<T>
8 8 {
9 9 private bool sameAsLast;
10 10 private T? currentParameter;
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/NavigationViewService.cs +1 -1
@@ -7,7 +7,7 @@ using System.Diagnostics.CodeAnalysis;
7 7
8 8 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
9 9
10 class NavigationViewService : GlobalServiceBase, INavigationViewService, IWinUIService<NavigationViewService, INavigationViewService>
10 class NavigationViewService : GlobalServiceBase, INavigationViewService
11 11 {
12 12 private NavigationView? _navigationView;
13 13 private Frame? _frame;
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/PageService.cs +1 -1
@@ -2,7 +2,7 @@
2 2
3 3 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
4 4
5 class PageService : IPageService, IWinUIService<PageService, IPageService>
5 class PageService : IPageService
6 6 {
7 7 private Page? _page;
8 8 public Page? CurrentPage => _page;
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/SettingService.cs +1 -1
@@ -5,7 +5,7 @@ using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
5 5
6 6 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
7 7
8 class SettingService : GlobalServiceBase, ISettingService, IWinUIService<SettingService, ISettingService>
8 class SettingService : GlobalServiceBase, ISettingService
9 9 {
10 10 private readonly Dictionary<object, IProfileInfoEntry> settingControls = [];
11 11
Modified XFEExtension.NetCore.WinUIHelper/Implements/Services/UserLoginService.cs +1 -1
@@ -2,7 +2,7 @@
2 2
3 3 namespace XFEExtension.NetCore.WinUIHelper.Implements.Services;
4 4
5 class UserLoginService : GlobalServiceBase, IUserLoginService, IWinUIService<UserLoginService, IUserLoginService>
5 class UserLoginService : GlobalServiceBase, IUserLoginService
6 6 {
7 7 public Func<Task<bool>>? LoginFunc { get; set; }
8 8 public Func<bool>? LogoutFunc { get; set; }
Modified XFEExtension.NetCore.WinUIHelper/Interface/Services/INavigationParameterService.cs +6 -1
@@ -1,4 +1,7 @@
1 namespace XFEExtension.NetCore.WinUIHelper.Interface.Services;
1 using XFEExtension.NetCore.WinUIHelper.Implements.Services;
2 using XFEExtension.NetCore.WinUIHelper.Utilities;
3
4 namespace XFEExtension.NetCore.WinUIHelper.Interface.Services;
2 5
3 6 /// <summary>
4 7 /// 导航参数服务
@@ -23,4 +26,6 @@ public interface INavigationParameterService<T> : IPageService
23 26 /// </summary>
24 27 /// <param name="parameter">新的参数</param>
25 28 void OnParameterChange(object? parameter);
29
30 static INavigationParameterService() => ServiceManager.RegisterService<T>(() => new NavigationParameterService<T>());
26 31 }
Deleted XFEExtension.NetCore.WinUIHelper/Interface/Services/IWinUIService.cs +0 -13
@@ -1,13 +0,0 @@
1 using XFEExtension.NetCore.WinUIHelper.Utilities;
2
3 namespace XFEExtension.NetCore.WinUIHelper.Interface.Services;
4
5 /// <summary>
6 /// WinUI服务接口
7 /// </summary>
8 /// <typeparam name="T"></typeparam>
9 /// <typeparam name="R"></typeparam>
10 public interface IWinUIService<in T, out R> where T : R, new()
11 {
12 static IWinUIService() => ServiceManager.RegisterService<R>(() => new T());
13 }
Deleted XFEExtension.NetCore.WinUIHelper/Model/StandardApp.cs +0 -12
@@ -1,12 +0,0 @@
1 namespace XFEExtension.NetCore.WinUIHelper.Model;
2
3 /// <summary>
4 /// 标准应用程序
5 /// </summary>
6 public abstract partial class StandardApp : Application
7 {
8 /// <summary>
9 /// 应用程序主窗口
10 /// </summary>
11 public static StandardMainWindow? MainWindow { get; set; }
12 }
Deleted XFEExtension.NetCore.WinUIHelper/Model/StandardMainWindow.cs +0 -37
Modified XFEExtension.NetCore.WinUIHelper/Utilities/GlobalServiceManager.cs +15 -2
Modified XFEExtension.NetCore.WinUIHelper/Utilities/Helper/AppThemeHelper.cs +12 -7
Modified XFEExtension.NetCore.WinUIHelper/XFEExtension.NetCore.WinUIHelper.csproj +5 -3