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

XFEExtension.NetCore.WinUIHelper

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

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

XFEstudio/XFEExtension.NetCore.WinUIHelper

完善部分内容

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

代码差异

8 个文件 +32 -8
Modified XFEExtension.NetCore.WinUIHelper.TestApp/ViewModels/AppShellPageViewModel.cs +1 -1
@@ -5,7 +5,7 @@ using XFEExtension.NetCore.WinUIHelper.Utilities;
5 5
6 6 namespace XFEExtension.NetCore.WinUIHelper.TestApp.ViewModels
7 7 {
8 public partial class AppShellPageViewModel : ViewModelBase
8 public partial class AppShellPageViewModel : ObservableObject
9 9 {
10 10 [ObservableProperty]
11 11 bool canGoBack;
Modified XFEExtension.NetCore.WinUIHelper.TestApp/ViewModels/MainPageViewModel.cs +1 -1
@@ -5,7 +5,7 @@ using XFEExtension.NetCore.WinUIHelper.Utilities;
5 5
6 6 namespace XFEExtension.NetCore.WinUIHelper.TestApp.ViewModels
7 7 {
8 public partial class MainPageViewModel : ViewModelBase
8 public partial class MainPageViewModel : ObservableObject
9 9 {
10 10 [ObservableProperty]
11 11 int clickCount = 0;
Modified XFEExtension.NetCore.WinUIHelper.TestApp/ViewModels/SettingPageViewModel.cs +1 -1
@@ -11,7 +11,7 @@ using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
11 11
12 12 namespace XFEExtension.NetCore.WinUIHelper.TestApp.ViewModels
13 13 {
14 public partial class SettingPageViewModel : ViewModelBase
14 public partial class SettingPageViewModel : ObservableObject
15 15 {
16 16 [ObservableProperty]
17 17 bool isAutoStartEnable = SystemProfile.AutoStart;
Modified XFEExtension.NetCore.WinUIHelper.TestApp/ViewModels/TestPageViewModel.cs +1 -1
@@ -4,7 +4,7 @@ using XFEExtension.NetCore.WinUIHelper.Utilities;
4 4
5 5 namespace XFEExtension.NetCore.WinUIHelper.TestApp.ViewModels;
6 6
7 public partial class TestPageViewModel : ViewModelBase
7 public partial class TestPageViewModel : ObservableObject
8 8 {
9 9 [ObservableProperty]
10 10 private string? parameter;
Modified XFEExtension.NetCore.WinUIHelper.TestApp/ViewModels/WebViewTestPageViewModel.cs +1 -1
@@ -5,7 +5,7 @@ using XFEExtension.NetCore.WinUIHelper.Utilities;
5 5
6 6 namespace XFEExtension.NetCore.WinUIHelper.TestApp.ViewModels;
7 7
8 public partial class WebViewTestPageViewModel : ViewModelBase
8 public partial class WebViewTestPageViewModel : ObservableObject
9 9 {
10 10 public IAutoNavigationParameterService<string> AutoNavigationParameterService { get; } = ServiceManager.GetService<IAutoNavigationParameterService<string>>();
11 11 public IWebViewService WebViewService { get; } = ServiceManager.GetService<IWebViewService>();
Modified XFEExtension.NetCore.WinUIHelper/Implements/AutoNavigatableViewModelBase.cs +10 -2
@@ -1,9 +1,17 @@
1 using XFEExtension.NetCore.WinUIHelper.Interface.Services;
1 using CommunityToolkit.Mvvm.ComponentModel;
2 using XFEExtension.NetCore.WinUIHelper.Interface.Services;
2 3 using XFEExtension.NetCore.WinUIHelper.Utilities;
3 4
4 5 namespace XFEExtension.NetCore.WinUIHelper.Implements;
5 6
6 public abstract partial class AutoNavigatableViewModelBase<T> : ViewModelBase
7 /// <summary>
8 /// 自动导航视图模型基类
9 /// </summary>
10 /// <typeparam name="T"></typeparam>
11 public abstract partial class AutoNavigatableViewModelBase<T> : ObservableObject
7 12 {
13 /// <summary>
14 /// 自动导航参数服务
15 /// </summary>
8 16 public IAutoNavigationParameterService<T> AutoNavigationParameterService { get; } = ServiceManager.GetService<IAutoNavigationParameterService<T>>();
9 17 }
Modified XFEExtension.NetCore.WinUIHelper/Implements/SearchableViewModelBase.cs +16 -0
@@ -2,6 +2,7 @@
2 2 using System.Collections.ObjectModel;
3 3 using XFEExtension.NetCore.DelegateExtension;
4 4 using XFEExtension.NetCore.WinUIHelper.Interface;
5 using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
5 6
6 7 namespace XFEExtension.NetCore.WinUIHelper.Implements;
7 8
@@ -11,11 +12,26 @@ public abstract partial class SearchableViewModelBase<T, F> : ServiceBaseViewMod
11 12 private T? selectedItem;
12 13 [ObservableProperty]
13 14 private string searchText = string.Empty;
15 /// <summary>
16 /// 文本内容改变时自动搜索
17 /// </summary>
14 18 public bool AutoSearch { get; set; } = true;
19 /// <summary>
20 /// 前端展示视图列表
21 /// </summary>
15 22 public ObservableCollection<T> ViewList { get; set; } = [];
23 /// <summary>
24 /// 后端模型列表
25 /// </summary>
16 26 public List<T> ModelList { get; set; } = [];
27 /// <summary>
28 /// 搜索预测
29 /// </summary>
17 30 public Func<string, T, bool> SearchPredicate { get; set; } = (text, item) => ObjectHelper.Search(item, text);
18 31
32 /// <summary>
33 /// 搜索文本改变事件
34 /// </summary>
19 35 public event XFEEventHandler<string>? SearchTextChanged;
20 36
21 37 partial void OnSearchTextChanged(string value)
Modified XFEExtension.NetCore.WinUIHelper/Utilities/Helper/ObjectHelper.cs +1 -1
@@ -1,7 +1,7 @@
1 1 using System.Collections;
2 2 using System.Reflection;
3 3
4 namespace MultiPlatformTranslation.Core.Utilities.Helpers;
4 namespace XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
5 5
6 6 /// <summary>
7 7 /// 对象帮助类