diff --git a/GetStoreApp/App.xaml.cs b/GetStoreApp/App.xaml.cs index fe2499a30..1d37a0e39 100644 --- a/GetStoreApp/App.xaml.cs +++ b/GetStoreApp/App.xaml.cs @@ -5,7 +5,7 @@ using GetStoreApp.Services.Controls.Download; using GetStoreApp.Services.Controls.Settings.Appearance; using GetStoreApp.Services.Root; -using GetStoreApp.Views.Window; +using GetStoreApp.Views.Windows; using GetStoreApp.WindowsAPI.PInvoke.Kernel32; using GetStoreApp.WindowsAPI.PInvoke.User32; using Microsoft.UI; diff --git a/GetStoreApp/GetStoreApp.csproj b/GetStoreApp/GetStoreApp.csproj index fd5b5b214..a05730bdd 100644 --- a/GetStoreApp/GetStoreApp.csproj +++ b/GetStoreApp/GetStoreApp.csproj @@ -228,8 +228,8 @@ - - + + @@ -348,8 +348,8 @@ - - + + diff --git a/GetStoreApp/Models/Controls/Download/CompletedModel.cs b/GetStoreApp/Models/Controls/Download/CompletedModel.cs index 268fd1991..f097307a2 100644 --- a/GetStoreApp/Models/Controls/Download/CompletedModel.cs +++ b/GetStoreApp/Models/Controls/Download/CompletedModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Models.Controls.Download { @@ -19,7 +20,7 @@ public bool IsSelected set { _isSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected))); + OnPropertyChanged(); } } @@ -35,7 +36,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -91,7 +92,7 @@ public bool IsInstalling set { _isInstalling = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsInstalling))); + OnPropertyChanged(); } } @@ -107,7 +108,7 @@ public double InstallValue set { _installValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InstallValue))); + OnPropertyChanged(); } } @@ -121,10 +122,18 @@ public bool InstallError set { _installError = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InstallError))); + OnPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Models/Controls/Download/DownloadingModel.cs b/GetStoreApp/Models/Controls/Download/DownloadingModel.cs index 0e42b958b..25c1f4d0f 100644 --- a/GetStoreApp/Models/Controls/Download/DownloadingModel.cs +++ b/GetStoreApp/Models/Controls/Download/DownloadingModel.cs @@ -2,6 +2,7 @@ using GetStoreApp.Services.Root; using System; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Models.Controls.Download { @@ -32,7 +33,7 @@ public bool IsSelected set { _isSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected))); + OnPropertyChanged(); } } @@ -48,7 +49,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -102,7 +103,7 @@ public int DownloadFlag set { _downloadFlag = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadFlag))); + OnPropertyChanged(); } } @@ -118,7 +119,7 @@ public double TotalSize set { _totalSize = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TotalSize))); + OnPropertyChanged(); } } @@ -134,7 +135,7 @@ public double FinishedSize set { _finishedSize = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FinishedSize))); + OnPropertyChanged(); } } @@ -150,7 +151,7 @@ public double CurrentSpeed set { _currentSpeed = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentSpeed))); + OnPropertyChanged(); } } @@ -166,7 +167,7 @@ public bool IsFileDownloading set { _isFileDownloading = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsFileDownloading))); + OnPropertyChanged(); } } @@ -208,5 +209,13 @@ public string GetDownloadingToolTip(double size, string toolTipType) return string.Empty; } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Models/Controls/Download/UnfinishedModel.cs b/GetStoreApp/Models/Controls/Download/UnfinishedModel.cs index e382de2da..c774c8daf 100644 --- a/GetStoreApp/Models/Controls/Download/UnfinishedModel.cs +++ b/GetStoreApp/Models/Controls/Download/UnfinishedModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Models.Controls.Download { @@ -19,7 +20,7 @@ public bool IsSelected set { _isSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected))); + OnPropertyChanged(); } } @@ -35,7 +36,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -80,5 +81,13 @@ public bool IsSelectMode public double TotalSize { get; set; } public event PropertyChangedEventHandler PropertyChanged; + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Models/Controls/History/HistoryModel.cs b/GetStoreApp/Models/Controls/History/HistoryModel.cs index c31230ce8..40251e478 100644 --- a/GetStoreApp/Models/Controls/History/HistoryModel.cs +++ b/GetStoreApp/Models/Controls/History/HistoryModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Models.Controls.History { @@ -19,7 +20,7 @@ public bool IsSelected set { _isSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected))); + OnPropertyChanged(); } } @@ -32,7 +33,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -62,5 +63,13 @@ public bool IsSelectMode public string HistoryLink { get; set; } public event PropertyChangedEventHandler PropertyChanged; + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Models/Controls/Store/ResultModel.cs b/GetStoreApp/Models/Controls/Store/ResultModel.cs index cd5b7ae06..8f0bf0fb5 100644 --- a/GetStoreApp/Models/Controls/Store/ResultModel.cs +++ b/GetStoreApp/Models/Controls/Store/ResultModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Models.Controls.Store { @@ -19,7 +20,7 @@ public bool IsSelected set { _isSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected))); + OnPropertyChanged(); } } @@ -35,7 +36,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -65,5 +66,13 @@ public bool IsSelectMode public string FileSize { get; set; } public event PropertyChangedEventHandler PropertyChanged; + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Models/Controls/WinGet/InstallingAppsModel.cs b/GetStoreApp/Models/Controls/WinGet/InstallingAppsModel.cs index 91c9a6d6c..def231890 100644 --- a/GetStoreApp/Models/Controls/WinGet/InstallingAppsModel.cs +++ b/GetStoreApp/Models/Controls/WinGet/InstallingAppsModel.cs @@ -1,6 +1,7 @@ using GetStoreApp.Services.Root; using Microsoft.Management.Deployment; using System.ComponentModel; +using System.Runtime.CompilerServices; using System.Text; namespace GetStoreApp.Models.Controls.WinGet @@ -45,7 +46,7 @@ public double DownloadProgress set { _downloadProgress = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadProgress))); + OnPropertyChanged(); } } @@ -61,7 +62,7 @@ public string DownloadedFileSize set { _downloadedFileSize = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadedFileSize))); + OnPropertyChanged(); } } @@ -77,7 +78,7 @@ public string TotalFileSize set { _totalFileSize = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TotalFileSize))); + OnPropertyChanged(); } } @@ -93,7 +94,7 @@ public PackageInstallProgressState InstallProgressState set { _installProgressState = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InstallProgressState))); + OnPropertyChanged(); } } @@ -156,5 +157,13 @@ public string InstallToolTip(string appName, PackageInstallProgressState install } return builder.ToString(); } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Models/Controls/WinGet/SearchAppsModel.cs b/GetStoreApp/Models/Controls/WinGet/SearchAppsModel.cs index facc9f2ff..3e845052e 100644 --- a/GetStoreApp/Models/Controls/WinGet/SearchAppsModel.cs +++ b/GetStoreApp/Models/Controls/WinGet/SearchAppsModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Models.Controls.WinGet { @@ -39,10 +40,18 @@ public bool IsInstalling set { _isInstalling = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsInstalling))); + OnPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Models/Controls/WinGet/UpgradableAppsModel.cs b/GetStoreApp/Models/Controls/WinGet/UpgradableAppsModel.cs index 0f5b7c643..62f3e8bfc 100644 --- a/GetStoreApp/Models/Controls/WinGet/UpgradableAppsModel.cs +++ b/GetStoreApp/Models/Controls/WinGet/UpgradableAppsModel.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Models.Controls.WinGet { @@ -44,10 +45,18 @@ public bool IsUpgrading set { _isUpgrading = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsUpgrading))); + OnPropertyChanged(); } } public event PropertyChangedEventHandler PropertyChanged; + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Models/Dialogs/Settings/TraceCleanupModel.cs b/GetStoreApp/Models/Dialogs/Settings/TraceCleanupModel.cs index 7e0eb858e..89cd6185a 100644 --- a/GetStoreApp/Models/Dialogs/Settings/TraceCleanupModel.cs +++ b/GetStoreApp/Models/Dialogs/Settings/TraceCleanupModel.cs @@ -1,5 +1,6 @@ using GetStoreApp.Extensions.DataType.Enums; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Models.Dialogs.Settings { @@ -20,7 +21,7 @@ public bool IsSelected set { _isSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected))); + OnPropertyChanged(); } } @@ -36,7 +37,7 @@ public bool IsCleanFailed set { _isCleanFailed = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsCleanFailed))); + OnPropertyChanged(); } } @@ -56,5 +57,13 @@ public bool IsCleanFailed public string CleanFailedText { get; set; } public event PropertyChangedEventHandler PropertyChanged; + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Properties/AssemblyInfo.cs b/GetStoreApp/Properties/AssemblyInfo.cs index 0b4d9477a..7b97f3c0e 100644 --- a/GetStoreApp/Properties/AssemblyInfo.cs +++ b/GetStoreApp/Properties/AssemblyInfo.cs @@ -6,11 +6,11 @@ // 程序集信息设置 [assembly: AssemblyCopyright("Copyright ©2022-2023 高怡飞, All Rights Reserved.")] [assembly: AssemblyDescription("获取商店应用")] -[assembly: AssemblyFileVersion("2.2.723.0")] -[assembly: AssemblyInformationalVersion("2.2.723.0")] +[assembly: AssemblyFileVersion("2.2.725.0")] +[assembly: AssemblyInformationalVersion("2.2.725.0")] [assembly: AssemblyProduct("获取商店应用")] [assembly: AssemblyTitle("获取商店应用")] -[assembly: AssemblyVersion("2.2.723.0")] +[assembly: AssemblyVersion("2.2.725.0")] // 设置程序集对COM组件的访问权限 [assembly: ComVisible(false)] diff --git a/GetStoreApp/UI/Controls/Download/CompletedControl.xaml.cs b/GetStoreApp/UI/Controls/Download/CompletedControl.xaml.cs index 592d301f2..2751d26ef 100644 --- a/GetStoreApp/UI/Controls/Download/CompletedControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Download/CompletedControl.xaml.cs @@ -6,7 +6,6 @@ using GetStoreApp.Services.Controls.Settings.Advanced; using GetStoreApp.Services.Controls.Settings.Common; using GetStoreApp.Services.Root; -using GetStoreApp.UI.Dialogs.About; using GetStoreApp.UI.Dialogs.Common; using GetStoreApp.UI.Dialogs.Download; using GetStoreApp.UI.Notifications; @@ -22,6 +21,7 @@ using System.ComponentModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading.Tasks; using Windows.ApplicationModel.DataTransfer; using Windows.Management.Deployment; @@ -49,7 +49,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -693,5 +693,13 @@ public async Task GetCompletedDataListAsync() lock (CompletedDataListLock) isUpdatingNow = false; } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Download/DownloadingControl.xaml.cs b/GetStoreApp/UI/Controls/Download/DownloadingControl.xaml.cs index d17abf98a..390783834 100644 --- a/GetStoreApp/UI/Controls/Download/DownloadingControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Download/DownloadingControl.xaml.cs @@ -15,6 +15,7 @@ using System.ComponentModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace GetStoreApp.UI.Controls.Download @@ -44,7 +45,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -351,6 +352,14 @@ public void StopDownloadingTimer(bool needUnRegister) } } + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + /// /// 从下载调度服务中获取正在下载和等待下载的数据 /// diff --git a/GetStoreApp/UI/Controls/Download/UnfinishedControl.xaml.cs b/GetStoreApp/UI/Controls/Download/UnfinishedControl.xaml.cs index 714fad455..46a8bb649 100644 --- a/GetStoreApp/UI/Controls/Download/UnfinishedControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Download/UnfinishedControl.xaml.cs @@ -18,6 +18,7 @@ using System.ComponentModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace GetStoreApp.UI.Controls.Download @@ -41,7 +42,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -487,5 +488,13 @@ public async Task GetUnfinishedDataListAsync() lock (UnfinishedDataListLock) isUpdatingNow = false; } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Advanced/AppExitControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Advanced/AppExitControl.xaml.cs index 7a02ce2fa..92bba139a 100644 --- a/GetStoreApp/UI/Controls/Settings/Advanced/AppExitControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Advanced/AppExitControl.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Advanced @@ -23,7 +24,7 @@ public AppExitModel AppExit set { _appExit = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AppExit))); + OnPropertyChanged(); } } @@ -53,5 +54,13 @@ public async void OnAppExitSelectClicked(object sender, RoutedEventArgs args) await AppExitService.SetAppExitAsync(AppExit); } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Advanced/InstallModeControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Advanced/InstallModeControl.xaml.cs index 956e18095..fc015b1d6 100644 --- a/GetStoreApp/UI/Controls/Settings/Advanced/InstallModeControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Advanced/InstallModeControl.xaml.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Advanced @@ -26,7 +27,7 @@ public InstallModeModel InstallMode set { _installMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InstallMode))); + OnPropertyChanged(); } } @@ -64,5 +65,13 @@ public async void OnInstallModeSelectClicked(object sender, RoutedEventArgs args await InstallModeService.SetInstallModeAsync(InstallMode); } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Advanced/TraceCleanupControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Advanced/TraceCleanupControl.xaml.cs index f15786cf1..f306e787e 100644 --- a/GetStoreApp/UI/Controls/Settings/Advanced/TraceCleanupControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Advanced/TraceCleanupControl.xaml.cs @@ -1,12 +1,10 @@ using GetStoreApp.Extensions.DataType.Enums; using GetStoreApp.Helpers.Controls.Extensions; using GetStoreApp.Services.Window; -using GetStoreApp.UI.Dialogs.Download; using GetStoreApp.UI.Dialogs.Settings; using GetStoreApp.Views.Pages; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; -using System; namespace GetStoreApp.UI.Controls.Settings.Advanced { diff --git a/GetStoreApp/UI/Controls/Settings/Appearance/AlwaysShowBackdropControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Appearance/AlwaysShowBackdropControl.xaml.cs index 4470e6ea0..1f2421ce6 100644 --- a/GetStoreApp/UI/Controls/Settings/Appearance/AlwaysShowBackdropControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Appearance/AlwaysShowBackdropControl.xaml.cs @@ -2,6 +2,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Appearance @@ -20,7 +21,7 @@ public bool AlwaysShowBackdropValue set { _alwaysShowBackdropValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AlwaysShowBackdropValue))); + OnPropertyChanged(); } } @@ -43,5 +44,13 @@ public async void OnToggled(object sender, RoutedEventArgs args) AlwaysShowBackdropValue = toggleSwitch.IsOn; } } + + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Appearance/BackdropControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Appearance/BackdropControl.xaml.cs index 0e266cf6c..1c034008c 100644 --- a/GetStoreApp/UI/Controls/Settings/Appearance/BackdropControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Appearance/BackdropControl.xaml.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Appearance @@ -29,7 +30,7 @@ public BackdropModel Backdrop set { _backdrop = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Backdrop))); + OnPropertyChanged(); } } @@ -70,5 +71,13 @@ public async void OnBackdropSelectClicked(object sender, RoutedEventArgs args) BackdropService.SetAppBackdrop(); } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Appearance/LauguageControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Appearance/LauguageControl.xaml.cs index be9750d4c..43e612ff4 100644 --- a/GetStoreApp/UI/Controls/Settings/Appearance/LauguageControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Appearance/LauguageControl.xaml.cs @@ -8,6 +8,7 @@ using Microsoft.UI.Xaml.Controls; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Controls.Settings.Appearance { @@ -25,7 +26,7 @@ public LanguageModel AppLanguage set { _appLanguage = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AppLanguage))); + OnPropertyChanged(); } } @@ -58,5 +59,13 @@ public async void OnSelectionChanged(object sender, SelectionChangedEventArgs ar new LanguageChangeNotification(this).Show(); } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Appearance/ThemeControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Appearance/ThemeControl.xaml.cs index b9741ccf8..8df32e662 100644 --- a/GetStoreApp/UI/Controls/Settings/Appearance/ThemeControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Appearance/ThemeControl.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using Windows.System; using WinRT; @@ -24,7 +25,7 @@ public ThemeModel Theme set { _theme = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Theme))); + OnPropertyChanged(); } } @@ -37,7 +38,7 @@ public NotifyIconMenuThemeModel NotifyIconMenuTheme set { _notifyIconMenuTheme = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(NotifyIconMenuTheme))); + OnPropertyChanged(); } } @@ -93,5 +94,13 @@ public async void OnNotifyIconMenuThemeSelectClicked(object sender, RoutedEventA ThemeService.SetTrayWindowTheme(); } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Appearance/TopMostControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Appearance/TopMostControl.xaml.cs index f02bad329..6aa00e3cc 100644 --- a/GetStoreApp/UI/Controls/Settings/Appearance/TopMostControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Appearance/TopMostControl.xaml.cs @@ -2,6 +2,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Appearance @@ -20,7 +21,7 @@ public bool TopMostValue set { _topMostValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TopMostValue))); + OnPropertyChanged(); } } @@ -44,5 +45,13 @@ public async void OnToggled(object sender, RoutedEventArgs args) TopMostValue = toggleSwitch.IsOn; } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Common/DownloadOptionsControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Common/DownloadOptionsControl.xaml.cs index 263e6c47e..afba7bb35 100644 --- a/GetStoreApp/UI/Controls/Settings/Common/DownloadOptionsControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Common/DownloadOptionsControl.xaml.cs @@ -10,6 +10,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using Windows.Storage; using WinRT; @@ -29,7 +30,7 @@ public StorageFolder DownloadFolder set { _downloadFolder = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadFolder))); + OnPropertyChanged(); } } @@ -42,7 +43,7 @@ public int DownloadItem set { _downloadItem = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadItem))); + OnPropertyChanged(); } } @@ -55,7 +56,7 @@ public DownloadModeModel DownloadMode set { _downloadMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadMode))); + OnPropertyChanged(); } } @@ -148,5 +149,13 @@ public async void OnDownloadModeSelectClicked(object sender, RoutedEventArgs arg await DownloadOptionsService.SetModeAsync(DownloadMode); } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Common/HistoryRecordControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Common/HistoryRecordControl.xaml.cs index c6389dd30..9e7bb07b1 100644 --- a/GetStoreApp/UI/Controls/Settings/Common/HistoryRecordControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Common/HistoryRecordControl.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Common @@ -23,7 +24,7 @@ public HistoryLiteNumModel HistoryLiteItem set { _historyLiteItem = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HistoryLiteItem))); + OnPropertyChanged(); } } @@ -36,7 +37,7 @@ public HistoryJumpListNumModel HistoryJumpListItem set { _historyJumpListItem = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(HistoryJumpListItem))); + OnPropertyChanged(); } } @@ -87,5 +88,13 @@ public async void OnHistoryJumpListSelectClicked(object sender, RoutedEventArgs await HistoryRecordService.UpdateHistoryJumpListAsync(HistoryJumpListItem); } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Common/LinkFilterControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Common/LinkFilterControl.xaml.cs index 995d96f82..e1a926aa1 100644 --- a/GetStoreApp/UI/Controls/Settings/Common/LinkFilterControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Common/LinkFilterControl.xaml.cs @@ -5,6 +5,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Common @@ -23,7 +24,7 @@ public bool StartsWithEFilterValue set { _startsWithEFilterValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StartsWithEFilterValue))); + OnPropertyChanged(); } } @@ -36,7 +37,7 @@ public bool BlockMapFilterValue set { _blockMapFilterValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(BlockMapFilterValue))); + OnPropertyChanged(); } } @@ -80,5 +81,13 @@ public async void OnBlockMapToggled(object sender, RoutedEventArgs args) BlockMapFilterValue = toggleSwitch.IsOn; } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Common/NotificationControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Common/NotificationControl.xaml.cs index b4ab0a621..e02be9a01 100644 --- a/GetStoreApp/UI/Controls/Settings/Common/NotificationControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Common/NotificationControl.xaml.cs @@ -3,6 +3,7 @@ using Microsoft.UI.Xaml.Controls; using System; using System.ComponentModel; +using System.Runtime.CompilerServices; using Windows.System; using WinRT; @@ -22,7 +23,7 @@ public bool Notification set { _notification = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Notification))); + OnPropertyChanged(); } } @@ -53,5 +54,13 @@ public async void OnToggled(object sender, RoutedEventArgs args) Notification = toggleSwitch.IsOn; } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Common/UseInstructionControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Common/UseInstructionControl.xaml.cs index 996f0d216..e72070bc0 100644 --- a/GetStoreApp/UI/Controls/Settings/Common/UseInstructionControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Common/UseInstructionControl.xaml.cs @@ -2,6 +2,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Common @@ -20,7 +21,7 @@ public bool UseInsVisValue set { _useInsVisValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UseInsVisValue))); + OnPropertyChanged(); } } @@ -43,5 +44,13 @@ public async void OnToggled(object sender, RoutedEventArgs args) UseInsVisValue = toggleSwitch.IsOn; } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Common/WinGetConfigControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Common/WinGetConfigControl.xaml.cs index f74469937..9ad9d99c0 100644 --- a/GetStoreApp/UI/Controls/Settings/Common/WinGetConfigControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Common/WinGetConfigControl.xaml.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Windows.System; using WinRT; @@ -35,7 +36,7 @@ public bool UseDevVersion set { _useDevVersion = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UseDevVersion))); + OnPropertyChanged(); } } @@ -48,7 +49,7 @@ public WinGetInstallModeModel WinGetInstallMode set { _winGetInstallMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(WinGetInstallMode))); + OnPropertyChanged(); } } @@ -164,5 +165,13 @@ public void OnWinGetConfigInstructionClicked(object sender, RoutedEventArgs args { NavigationService.NavigateTo(typeof(AboutPage), AppNaviagtionArgs.SettingsHelp); } + + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Settings/Experiment/NetWorkMonitorControl.xaml.cs b/GetStoreApp/UI/Controls/Settings/Experiment/NetWorkMonitorControl.xaml.cs index c27cff946..515db68d8 100644 --- a/GetStoreApp/UI/Controls/Settings/Experiment/NetWorkMonitorControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Settings/Experiment/NetWorkMonitorControl.xaml.cs @@ -2,6 +2,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Settings.Experiment @@ -20,7 +21,7 @@ public bool NetWorkMonitorValue set { _netWorkMonitorValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(NetWorkMonitorValue))); + OnPropertyChanged(); } } @@ -43,5 +44,13 @@ public async void OnToggled(object sender, RoutedEventArgs args) NetWorkMonitorValue = toggleSwitch.IsOn; } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Store/RequestControl.xaml.cs b/GetStoreApp/UI/Controls/Store/RequestControl.xaml.cs index 33bcd7373..cf4b606e8 100644 --- a/GetStoreApp/UI/Controls/Store/RequestControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Store/RequestControl.xaml.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; using System.Threading.Tasks; using Windows.UI.StartScreen; using WinRT; @@ -53,7 +54,7 @@ public TypeModel SelectedType set { _selectedType = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedType))); + OnPropertyChanged(); } } @@ -66,7 +67,7 @@ public ChannelModel SelectedChannel set { _selectedChannel = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedChannel))); + OnPropertyChanged(); } } @@ -79,7 +80,7 @@ public string LinkPlaceHolderText set { _linkPlaceHolderText = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(LinkPlaceHolderText))); + OnPropertyChanged(); } } @@ -92,7 +93,7 @@ public string LinkText set { _linkText = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(LinkText))); + OnPropertyChanged(); } } @@ -105,7 +106,7 @@ public bool IsGettingLinks set { _isGettingLinks = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsGettingLinks))); + OnPropertyChanged(); } } @@ -191,6 +192,14 @@ public void InitializeStorePageControl(HistoryLiteControl historyLiteControl, St resultInstance = resultControl; } + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + /// /// 获取链接 /// diff --git a/GetStoreApp/UI/Controls/Store/ResultControl.xaml.cs b/GetStoreApp/UI/Controls/Store/ResultControl.xaml.cs index b0b34be21..35304b4aa 100644 --- a/GetStoreApp/UI/Controls/Store/ResultControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Store/ResultControl.xaml.cs @@ -22,6 +22,7 @@ using System.ComponentModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using Windows.System; using WinRT; @@ -42,7 +43,7 @@ public bool ResultControlVisable set { _resultCotnrolVisable = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ResultControlVisable))); + OnPropertyChanged(); } } @@ -55,7 +56,7 @@ public string CategoryId set { _categoryId = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CategoryId))); + OnPropertyChanged(); } } @@ -68,7 +69,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -495,5 +496,13 @@ public void OnItemClicked(object sender, ItemClickEventArgs args) ResultDataList[ClickedIndex].IsSelected = !ResultDataList[ClickedIndex].IsSelected; } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/Store/StatusBarControl.xaml.cs b/GetStoreApp/UI/Controls/Store/StatusBarControl.xaml.cs index dec896453..7aa7b3848 100644 --- a/GetStoreApp/UI/Controls/Store/StatusBarControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Store/StatusBarControl.xaml.cs @@ -5,6 +5,7 @@ using Microsoft.UI.Xaml.Controls; using System.Collections.Generic; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Controls.Store { @@ -24,7 +25,7 @@ public InfoBarSeverity InfoBarSeverity set { _infoSeverity = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InfoBarSeverity))); + OnPropertyChanged(); } } @@ -37,7 +38,7 @@ public string StateInfoText set { _stateInfoText = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StateInfoText))); + OnPropertyChanged(); } } @@ -50,7 +51,7 @@ public bool StatePrRingActValue set { _statePrRingActValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StatePrRingActValue))); + OnPropertyChanged(); } } @@ -63,7 +64,7 @@ public bool StatePrRingVisValue set { _statePrRingVisValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(StatePrRingVisValue))); + OnPropertyChanged(); } } @@ -73,7 +74,7 @@ public StatusBarControl() { InitializeComponent(); StateInfoText = ResourceService.GetLocalized("Store/StatusInfoWelcome"); - PropertyChanged += OnPropertyChanged; + PropertyChanged += OnStatusBarPropertyChanged; } /// @@ -87,10 +88,18 @@ public void SetControlState(int state) StatePrRingActValue = StatusBarStateList[state].StatePrRingActValue; } + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + /// /// 圆环动画状态修改时修改任务栏的动画显示 /// - private void OnPropertyChanged(object sender, PropertyChangedEventArgs args) + private void OnStatusBarPropertyChanged(object sender, PropertyChangedEventArgs args) { if (args.PropertyName == nameof(StatePrRingActValue)) { diff --git a/GetStoreApp/UI/Controls/WinGet/InstalledAppsControl.xaml.cs b/GetStoreApp/UI/Controls/WinGet/InstalledAppsControl.xaml.cs index 73621bd4d..52c36c7d6 100644 --- a/GetStoreApp/UI/Controls/WinGet/InstalledAppsControl.xaml.cs +++ b/GetStoreApp/UI/Controls/WinGet/InstalledAppsControl.xaml.cs @@ -17,6 +17,7 @@ using System.ComponentModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading.Tasks; @@ -39,7 +40,7 @@ public bool IsLoadedCompleted set { _isLoadedCompleted = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsLoadedCompleted))); + OnPropertyChanged(); } } @@ -52,7 +53,7 @@ public bool IsInstalledAppsEmpty set { _isInstalledAppsEmpty = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsInstalledAppsEmpty))); + OnPropertyChanged(); } } @@ -65,7 +66,7 @@ public string SearchText set { _searchText = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SearchText))); + OnPropertyChanged(); } } @@ -85,7 +86,7 @@ public InstalledAppsControl() { InitializeComponent(); - PropertyChanged += OnPropertyChanged; + PropertyChanged += OnInstalledAppsPropertyChanged; UnInstallCommand.ExecuteRequested += async (sender, args) => { InstalledAppsModel installedApps = args.Parameter as InstalledAppsModel; @@ -176,7 +177,7 @@ public InstalledAppsControl() ~InstalledAppsControl() { - PropertyChanged -= OnPropertyChanged; + PropertyChanged -= OnInstalledAppsPropertyChanged; } /// @@ -245,7 +246,7 @@ public void OnQuerySubmitted(object sender, AutoSuggestBoxQuerySubmittedEventArg /// /// ıΪʱԭԭ /// - public void OnPropertyChanged(object sender, PropertyChangedEventArgs args) + public void OnInstalledAppsPropertyChanged(object sender, PropertyChangedEventArgs args) { if (args.PropertyName == nameof(SearchText)) { @@ -256,6 +257,14 @@ public void OnPropertyChanged(object sender, PropertyChangedEventArgs args) } } + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + /// /// ϵͳѰװӦϢ /// diff --git a/GetStoreApp/UI/Controls/WinGet/SearchAppsControl.xaml.cs b/GetStoreApp/UI/Controls/WinGet/SearchAppsControl.xaml.cs index 465c9baad..465509f17 100644 --- a/GetStoreApp/UI/Controls/WinGet/SearchAppsControl.xaml.cs +++ b/GetStoreApp/UI/Controls/WinGet/SearchAppsControl.xaml.cs @@ -19,6 +19,7 @@ using System.ComponentModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -47,7 +48,7 @@ public bool NotSearched set { _notSearched = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(NotSearched))); + OnPropertyChanged(); } } @@ -60,7 +61,7 @@ public bool IsSearchCompleted set { _isSearchCompleted = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSearchCompleted))); + OnPropertyChanged(); } } @@ -73,7 +74,7 @@ public string SearchText set { _searchText = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SearchText))); + OnPropertyChanged(); } } @@ -575,5 +576,13 @@ public void InitializeData() } } } + + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Controls/WinGet/UpgradableAppsControl.xaml.cs b/GetStoreApp/UI/Controls/WinGet/UpgradableAppsControl.xaml.cs index 34d53dc71..32810e540 100644 --- a/GetStoreApp/UI/Controls/WinGet/UpgradableAppsControl.xaml.cs +++ b/GetStoreApp/UI/Controls/WinGet/UpgradableAppsControl.xaml.cs @@ -19,6 +19,7 @@ using System.ComponentModel; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; @@ -42,7 +43,7 @@ public bool IsLoadedCompleted set { _isLoadedCompleted = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsLoadedCompleted))); + OnPropertyChanged(); } } @@ -55,7 +56,7 @@ public bool IsUpgradableAppsEmpty set { _isUpgradableAppsEmpty = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsUpgradableAppsEmpty))); + OnPropertyChanged(); } } @@ -485,6 +486,14 @@ public async void OnRefreshClicked(object sender, RoutedEventArgs args) IsLoadedCompleted = true; } + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + /// /// ϵͳӦϢ /// diff --git a/GetStoreApp/UI/Controls/Window/AppTitleBarControl.xaml.cs b/GetStoreApp/UI/Controls/Window/AppTitleBarControl.xaml.cs index 4eb3fcfcc..92cf7edeb 100644 --- a/GetStoreApp/UI/Controls/Window/AppTitleBarControl.xaml.cs +++ b/GetStoreApp/UI/Controls/Window/AppTitleBarControl.xaml.cs @@ -2,6 +2,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.UI.Controls.Window @@ -20,7 +21,7 @@ public bool IsWindowMaximized set { _isWindowMaximized = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsWindowMaximized))); + OnPropertyChanged(); } } @@ -88,5 +89,13 @@ public void OnSizeClicked(object sender, RoutedEventArgs args) User32Library.SendMessage(Program.ApplicationRoot.MainWindow.Handle, WindowMessage.WM_SYSCOMMAND, 0xF000, 0); } } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Dialogs/About/AppInformationDialog.xaml.cs b/GetStoreApp/UI/Dialogs/About/AppInformationDialog.xaml.cs index aa2e65b89..bb2578f1d 100644 --- a/GetStoreApp/UI/Dialogs/About/AppInformationDialog.xaml.cs +++ b/GetStoreApp/UI/Dialogs/About/AppInformationDialog.xaml.cs @@ -82,11 +82,6 @@ public AppInformationDialog() InitializeComponent(); } - private void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - /// /// ӦϢ /// @@ -154,5 +149,10 @@ public async void OnLoaded(object sender, RoutedEventArgs args) // .NET 汾Ϣ DoNetVersion = Convert.ToString(Environment.Version); } + + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Dialogs/About/LicenseDialog.xaml.cs b/GetStoreApp/UI/Dialogs/About/LicenseDialog.xaml.cs index 1bbe59b77..5453def17 100644 --- a/GetStoreApp/UI/Dialogs/About/LicenseDialog.xaml.cs +++ b/GetStoreApp/UI/Dialogs/About/LicenseDialog.xaml.cs @@ -1,5 +1,6 @@ using Microsoft.UI.Xaml.Controls; using System.ComponentModel; +using System.Runtime.CompilerServices; using System.Text; namespace GetStoreApp.UI.Dialogs.About @@ -18,7 +19,7 @@ public string LicenseText set { _licenseText = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(LicenseText))); + OnPropertyChanged(); } } @@ -29,5 +30,13 @@ public LicenseDialog() InitializeComponent(); LicenseText = Encoding.UTF8.GetString(Properties.Resources.LICENSE); } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Dialogs/Download/FileInformationDialog.xaml.cs b/GetStoreApp/UI/Dialogs/Download/FileInformationDialog.xaml.cs index b283dc5ff..777ce51af 100644 --- a/GetStoreApp/UI/Dialogs/Download/FileInformationDialog.xaml.cs +++ b/GetStoreApp/UI/Dialogs/Download/FileInformationDialog.xaml.cs @@ -6,6 +6,7 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System.ComponentModel; +using System.Runtime.CompilerServices; using System.Text; namespace GetStoreApp.UI.Dialogs.Download @@ -34,7 +35,7 @@ public bool FileCheckState set { _fileCheckState = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FileCheckState))); + OnPropertyChanged(); } } @@ -47,7 +48,7 @@ public string CheckFileSHA1 set { _checkFileSHA1 = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CheckFileSHA1))); + OnPropertyChanged(); } } @@ -97,5 +98,13 @@ public async void OnLoaded(object sender, RoutedEventArgs args) CheckFileSHA1 = await IOHelper.GetFileSHA1Async(FilePath); FileCheckState = true; } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Dialogs/Settings/ExperimentalConfigDialog.xaml.cs b/GetStoreApp/UI/Dialogs/Settings/ExperimentalConfigDialog.xaml.cs index d71d504b0..03fca605e 100644 --- a/GetStoreApp/UI/Dialogs/Settings/ExperimentalConfigDialog.xaml.cs +++ b/GetStoreApp/UI/Dialogs/Settings/ExperimentalConfigDialog.xaml.cs @@ -5,6 +5,7 @@ using Microsoft.UI.Xaml.Controls; using System; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Dialogs.Settings { @@ -26,7 +27,7 @@ public bool IsMessageVisable set { _isMessageVisable = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsMessageVisable))); + OnPropertyChanged(); } } @@ -68,6 +69,14 @@ public async void OnRestoreDefaultClicked(ContentDialog sender, ContentDialogBut } } + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + private void DisplayTimerTick(object sender, object args) { if (CountDown > 0) diff --git a/GetStoreApp/UI/Dialogs/Settings/TraceCleanupPromptDialog.xaml.cs b/GetStoreApp/UI/Dialogs/Settings/TraceCleanupPromptDialog.xaml.cs index 4fb595916..88723da40 100644 --- a/GetStoreApp/UI/Dialogs/Settings/TraceCleanupPromptDialog.xaml.cs +++ b/GetStoreApp/UI/Dialogs/Settings/TraceCleanupPromptDialog.xaml.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace GetStoreApp.UI.Dialogs.Settings @@ -24,7 +25,7 @@ public bool IsSelected set { _isSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected))); + OnPropertyChanged(); } } @@ -37,7 +38,7 @@ public bool IsCleaning set { _isCleaning = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsCleaning))); + OnPropertyChanged(); } } @@ -52,7 +53,7 @@ public TraceCleanupPromptDialog() { traceCleanupItem.IsSelected = false; traceCleanupItem.IsCleanFailed = false; - traceCleanupItem.PropertyChanged += OnPropertyChanged; + traceCleanupItem.PropertyChanged += OnTraceCleanupPropertyChanged; TraceCleanupList.Add(traceCleanupItem); }); @@ -95,7 +96,15 @@ public async void OnCleanupNowClicked(ContentDialog sender, ContentDialogButtonC IsCleaning = false; } - private void OnPropertyChanged(object sender, PropertyChangedEventArgs args) + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + private void OnTraceCleanupPropertyChanged(object sender, PropertyChangedEventArgs args) { IsSelected = TraceCleanupList.Exists(item => item.IsSelected); } diff --git a/GetStoreApp/UI/Notifications/DownloadCreateNotification.xaml.cs b/GetStoreApp/UI/Notifications/DownloadCreateNotification.xaml.cs index 28ac59467..dd39b4c9d 100644 --- a/GetStoreApp/UI/Notifications/DownloadCreateNotification.xaml.cs +++ b/GetStoreApp/UI/Notifications/DownloadCreateNotification.xaml.cs @@ -1,6 +1,7 @@ using GetStoreApp.Views.CustomControls.Notifications; using Microsoft.UI.Xaml; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Notifications { @@ -18,7 +19,7 @@ public bool IsDownloadCreated set { _isDownloadCreated = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsDownloadCreated))); + OnPropertyChanged(); } } @@ -29,5 +30,13 @@ public DownloadCreateNotification(FrameworkElement element, bool isDownloadCreat InitializeComponent(); IsDownloadCreated = isDownloadCreated; } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Notifications/HistoryCopyNotification.xaml.cs b/GetStoreApp/UI/Notifications/HistoryCopyNotification.xaml.cs index 186120f9e..2d2ebe0f4 100644 --- a/GetStoreApp/UI/Notifications/HistoryCopyNotification.xaml.cs +++ b/GetStoreApp/UI/Notifications/HistoryCopyNotification.xaml.cs @@ -2,6 +2,7 @@ using GetStoreApp.Views.CustomControls.Notifications; using Microsoft.UI.Xaml; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Notifications { @@ -21,7 +22,7 @@ public bool IsMultiSelected set { _isMultiSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsMultiSelected))); + OnPropertyChanged(); } } @@ -38,5 +39,13 @@ public void CopySelectedSuccessLoaded(object sender, RoutedEventArgs args) { CopySelectedSuccess.Text = string.Format(ResourceService.GetLocalized("Notification/HistorySelectedCopy"), Count); } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Notifications/LogCleanNotification.xaml.cs b/GetStoreApp/UI/Notifications/LogCleanNotification.xaml.cs index 5812e2eee..dfd576fa8 100644 --- a/GetStoreApp/UI/Notifications/LogCleanNotification.xaml.cs +++ b/GetStoreApp/UI/Notifications/LogCleanNotification.xaml.cs @@ -1,6 +1,7 @@ using GetStoreApp.Views.CustomControls.Notifications; using Microsoft.UI.Xaml; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Notifications { @@ -18,7 +19,7 @@ public bool SetResult set { _setResult = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SetResult))); + OnPropertyChanged(); } } @@ -29,5 +30,13 @@ public LogCleanNotification(FrameworkElement element, bool setResult = false) : InitializeComponent(); SetResult = setResult; } + + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Notifications/QuickOperationNotification.xaml.cs b/GetStoreApp/UI/Notifications/QuickOperationNotification.xaml.cs index 26a051a93..c3a21014b 100644 --- a/GetStoreApp/UI/Notifications/QuickOperationNotification.xaml.cs +++ b/GetStoreApp/UI/Notifications/QuickOperationNotification.xaml.cs @@ -2,6 +2,7 @@ using GetStoreApp.Views.CustomControls.Notifications; using Microsoft.UI.Xaml; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Notifications { @@ -19,7 +20,7 @@ public QuickOperationType OperationType set { _operationType = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OperationType))); + OnPropertyChanged(); } } @@ -32,7 +33,7 @@ public bool IsPinnedSuccessfully set { _isPinnedSuccessfully = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsPinnedSuccessfully))); + OnPropertyChanged(); } } @@ -76,5 +77,13 @@ public bool ControlLoad(QuickOperationType operationType, bool isPinnedSuccessfu return false; } } + + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Notifications/ResultContentCopyNotification.xaml.cs b/GetStoreApp/UI/Notifications/ResultContentCopyNotification.xaml.cs index b72ae4aa4..ea35913ce 100644 --- a/GetStoreApp/UI/Notifications/ResultContentCopyNotification.xaml.cs +++ b/GetStoreApp/UI/Notifications/ResultContentCopyNotification.xaml.cs @@ -2,6 +2,7 @@ using GetStoreApp.Views.CustomControls.Notifications; using Microsoft.UI.Xaml; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Notifications { @@ -21,7 +22,7 @@ public bool IsMultiSelected set { _isMultiSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsMultiSelected))); + OnPropertyChanged(); } } @@ -38,5 +39,13 @@ public void CopySelectedSuccessLoaded(object sender, RoutedEventArgs args) { CopySelectedSuccess.Text = string.Format(ResourceService.GetLocalized("Notification/ResultContentSelectedCopy"), Count); } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Notifications/ResultLinkCopyNotification.xaml.cs b/GetStoreApp/UI/Notifications/ResultLinkCopyNotification.xaml.cs index a64bdac1c..d2af17f98 100644 --- a/GetStoreApp/UI/Notifications/ResultLinkCopyNotification.xaml.cs +++ b/GetStoreApp/UI/Notifications/ResultLinkCopyNotification.xaml.cs @@ -2,6 +2,7 @@ using GetStoreApp.Views.CustomControls.Notifications; using Microsoft.UI.Xaml; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Notifications { @@ -21,7 +22,7 @@ public bool IsMultiSelected set { _isMultiSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsMultiSelected))); + OnPropertyChanged(); } } @@ -38,5 +39,13 @@ public void CopySelectedSuccessLoaded(object sender, RoutedEventArgs args) { CopySelectedSuccess.Text = string.Format(ResourceService.GetLocalized("Notification/ResultLinkSelectedCopy"), Count); } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Notifications/ShareFailedNotification.xaml.cs b/GetStoreApp/UI/Notifications/ShareFailedNotification.xaml.cs index 188532c97..e239d4f17 100644 --- a/GetStoreApp/UI/Notifications/ShareFailedNotification.xaml.cs +++ b/GetStoreApp/UI/Notifications/ShareFailedNotification.xaml.cs @@ -2,6 +2,7 @@ using GetStoreApp.Views.CustomControls.Notifications; using Microsoft.UI.Xaml; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Notifications { @@ -21,7 +22,7 @@ public bool IsMultiSelected set { _isMultiSelected = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsMultiSelected))); + OnPropertyChanged(); } } @@ -38,5 +39,13 @@ public void ShareSelectedFailedLoaded(object sender, RoutedEventArgs args) { ShareSelectedFailed.Text = string.Format(ResourceService.GetLocalized("Notification/ShareSelectedFailed"), Count); } + + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/UI/Notifications/WinGetCopyNotification.xaml.cs b/GetStoreApp/UI/Notifications/WinGetCopyNotification.xaml.cs index ede7ce744..171d0a2e8 100644 --- a/GetStoreApp/UI/Notifications/WinGetCopyNotification.xaml.cs +++ b/GetStoreApp/UI/Notifications/WinGetCopyNotification.xaml.cs @@ -2,6 +2,7 @@ using GetStoreApp.Views.CustomControls.Notifications; using Microsoft.UI.Xaml; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.UI.Notifications { @@ -19,7 +20,7 @@ public WinGetOptionArgs OptionArgs set { _optionArgs = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OptionArgs))); + OnPropertyChanged(); } } @@ -50,5 +51,13 @@ public bool ControlLoaded(WinGetOptionArgs optionArgs, string controlName) return false; } } + + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Views/Pages/DownloadPage.xaml.cs b/GetStoreApp/Views/Pages/DownloadPage.xaml.cs index b90d59efc..47c69e427 100644 --- a/GetStoreApp/Views/Pages/DownloadPage.xaml.cs +++ b/GetStoreApp/Views/Pages/DownloadPage.xaml.cs @@ -6,6 +6,7 @@ using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Navigation; using System.ComponentModel; +using System.Runtime.CompilerServices; using WinRT; namespace GetStoreApp.Views.Pages @@ -24,7 +25,7 @@ public bool UseInsVisValue set { _useInsVisValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UseInsVisValue))); + OnPropertyChanged(); } } @@ -95,5 +96,13 @@ public void OnLearnMoreClicked(object sender, RoutedEventArgs args) DownloadFlyout.Hide(); NavigationService.NavigateTo(typeof(AboutPage), AppNaviagtionArgs.SettingsHelp); } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Views/Pages/HistoryPage.xaml.cs b/GetStoreApp/Views/Pages/HistoryPage.xaml.cs index 181aadea6..265b59f9e 100644 --- a/GetStoreApp/Views/Pages/HistoryPage.xaml.cs +++ b/GetStoreApp/Views/Pages/HistoryPage.xaml.cs @@ -18,6 +18,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using WinRT; @@ -49,7 +50,7 @@ public bool IsLoadedCompleted set { _isLoadedCompleted = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsLoadedCompleted))); + OnPropertyChanged(); } } @@ -62,7 +63,7 @@ public bool IsSelectMode set { _isSelectMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode))); + OnPropertyChanged(); } } @@ -75,7 +76,7 @@ public bool IsHistoryEmpty set { _isHistoryEmpty = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsHistoryEmpty))); + OnPropertyChanged(); } } @@ -88,7 +89,7 @@ public bool IsHistoryEmptyAfterFilter set { _isHistoryEmptyAfterFilter = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsHistoryEmptyAfterFilter))); + OnPropertyChanged(); } } @@ -104,7 +105,7 @@ public bool TimeSortOrder set { _timeSortOrder = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TimeSortOrder))); + OnPropertyChanged(); } } @@ -117,7 +118,7 @@ public string TypeFilter set { _typeFilter = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TypeFilter))); + OnPropertyChanged(); } } @@ -130,7 +131,7 @@ public string ChannelFilter set { _channelFilter = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ChannelFilter))); + OnPropertyChanged(); } } @@ -406,6 +407,14 @@ public string LocalizeHistoryCountInfo(int count) } } + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + /// /// 从数据库中加载数据 /// diff --git a/GetStoreApp/Views/Pages/SettingsPage.xaml.cs b/GetStoreApp/Views/Pages/SettingsPage.xaml.cs index 22c3982b7..9d513ca1a 100644 --- a/GetStoreApp/Views/Pages/SettingsPage.xaml.cs +++ b/GetStoreApp/Views/Pages/SettingsPage.xaml.cs @@ -1,6 +1,5 @@ using GetStoreApp.Extensions.DataType.Enums; using GetStoreApp.Helpers.Controls.Extensions; -using GetStoreApp.UI.Dialogs.Download; using GetStoreApp.UI.Dialogs.Settings; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/GetStoreApp/Views/Pages/StorePage.xaml.cs b/GetStoreApp/Views/Pages/StorePage.xaml.cs index 172e2a67a..57841ea76 100644 --- a/GetStoreApp/Views/Pages/StorePage.xaml.cs +++ b/GetStoreApp/Views/Pages/StorePage.xaml.cs @@ -6,6 +6,7 @@ using Microsoft.UI.Xaml.Navigation; using System; using System.ComponentModel; +using System.Runtime.CompilerServices; namespace GetStoreApp.Views.Pages { @@ -25,7 +26,7 @@ public bool UseInsVisValue set { _useInsVisValue = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(UseInsVisValue))); + OnPropertyChanged(); } } @@ -83,5 +84,13 @@ public void OnUseInstructionClicked(object sender, RoutedEventArgs args) { NavigationService.NavigateTo(typeof(AboutPage), AppNaviagtionArgs.Instructions); } + + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } } } diff --git a/GetStoreApp/Views/Pages/WebPage.xaml.cs b/GetStoreApp/Views/Pages/WebPage.xaml.cs index 64b6afb95..0e4f421e4 100644 --- a/GetStoreApp/Views/Pages/WebPage.xaml.cs +++ b/GetStoreApp/Views/Pages/WebPage.xaml.cs @@ -8,7 +8,6 @@ using GetStoreApp.Services.Root; using GetStoreApp.Services.Window; using GetStoreApp.UI.Dialogs.Common; -using GetStoreApp.UI.Dialogs.Download; using GetStoreApp.UI.Dialogs.Web; using GetStoreApp.UI.Notifications; using Microsoft.UI.Xaml; @@ -19,6 +18,7 @@ using System; using System.ComponentModel; using System.IO; +using System.Runtime.CompilerServices; using System.Threading; using Windows.Foundation; using Windows.Storage; @@ -47,7 +47,7 @@ public bool CanGoBack set { _canGoBack = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CanGoBack))); + OnPropertyChanged(); } } @@ -60,7 +60,7 @@ public bool CanGoForward set { _canGoForward = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CanGoForward))); + OnPropertyChanged(); } } @@ -73,7 +73,7 @@ public Uri Source set { _source = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Source))); + OnPropertyChanged(); } } @@ -86,7 +86,7 @@ public bool IsLoading set { _isLoading = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsLoading))); + OnPropertyChanged(); } } @@ -99,7 +99,7 @@ public bool IsClearWebCacheEnabled set { _isClearWebCacheEnabled = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsClearWebCacheEnabled))); + OnPropertyChanged(); } } @@ -282,6 +282,14 @@ public void OnNavigatedFrom() } } + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + /// /// 捕捉打开新窗口事件,并禁止弹窗 /// diff --git a/GetStoreApp/Views/Pages/WinGetPage.xaml.cs b/GetStoreApp/Views/Pages/WinGetPage.xaml.cs index f00190e4a..0ab053ba2 100644 --- a/GetStoreApp/Views/Pages/WinGetPage.xaml.cs +++ b/GetStoreApp/Views/Pages/WinGetPage.xaml.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; +using System.Runtime.CompilerServices; using System.Threading; namespace GetStoreApp.Views.Pages @@ -24,7 +25,7 @@ public int SelectedIndex set { _selectedIndex = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedIndex))); + OnPropertyChanged(); } } @@ -60,15 +61,6 @@ public WinGetPage() }; } - /// - /// ʼ WinGet - /// - private void OnInitializeSuccessLoaded() - { - SearchApps.WinGetInstance = this; - UpgradableApps.WinGetInstance = this; - } - /// /// ж WinGet Ƿ /// @@ -84,5 +76,22 @@ public bool IsWinGetExisted(bool isOfficialVersionExisted, bool isDevVersionExis return result; } } + + /// + /// ֵ仯ʱ֪ͨ + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + /// + /// ʼ WinGet + /// + private void OnInitializeSuccessLoaded() + { + SearchApps.WinGetInstance = this; + UpgradableApps.WinGetInstance = this; + } } } diff --git a/GetStoreApp/Views/Window/MainWindow.xaml b/GetStoreApp/Views/Windows/MainWindow.xaml similarity index 99% rename from GetStoreApp/Views/Window/MainWindow.xaml rename to GetStoreApp/Views/Windows/MainWindow.xaml index ccf96876b..902a6dcac 100644 --- a/GetStoreApp/Views/Window/MainWindow.xaml +++ b/GetStoreApp/Views/Windows/MainWindow.xaml @@ -1,5 +1,5 @@  /// 应用主窗口 /// - public sealed partial class MainWindow : Microsoft.UI.Xaml.Window, INotifyPropertyChanged + public sealed partial class MainWindow : Window, INotifyPropertyChanged { private WNDPROC newMainWindowWndProc = null; private IntPtr oldMainWindowWndProc = IntPtr.Zero; @@ -61,7 +62,7 @@ public ElementTheme WindowTheme set { _windowTheme = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(WindowTheme))); + OnPropertyChanged(); } } @@ -74,7 +75,7 @@ public SolidColorBrush WindowBackground set { _windowBackground = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(WindowBackground))); + OnPropertyChanged(); } } @@ -87,7 +88,7 @@ public Thickness AppTitleBarMargin set { _appTitleBarMargin = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AppTitleBarMargin))); + OnPropertyChanged(); } } @@ -100,7 +101,7 @@ public bool IsBackEnabled set { _isBackEnabled = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsBackEnabled))); + OnPropertyChanged(); } } @@ -113,7 +114,7 @@ public bool IsPaneToggleButtonVisible set { _isPaneToggleButtonVisible = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsPaneToggleButtonVisible))); + OnPropertyChanged(); } } @@ -126,7 +127,7 @@ public NavigationViewPaneDisplayMode PaneDisplayMode set { _paneDisplayMode = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PaneDisplayMode))); + OnPropertyChanged(); } } @@ -139,7 +140,7 @@ public NavigationViewItem SelectedItem set { _selectedItem = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedItem))); + OnPropertyChanged(); } } @@ -475,6 +476,14 @@ public async void OnIconLoaded(object sender, RoutedEventArgs args) } } + /// + /// 属性值发生变化时通知更改 + /// + private void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + /// /// 设置应用的背景色 /// diff --git a/GetStoreApp/Views/Window/TrayMenuWindow.xaml b/GetStoreApp/Views/Windows/TrayMenuWindow.xaml similarity index 98% rename from GetStoreApp/Views/Window/TrayMenuWindow.xaml rename to GetStoreApp/Views/Windows/TrayMenuWindow.xaml index a34d75de7..233845955 100644 --- a/GetStoreApp/Views/Window/TrayMenuWindow.xaml +++ b/GetStoreApp/Views/Windows/TrayMenuWindow.xaml @@ -1,5 +1,5 @@ /// ӦҼ˵ /// - public sealed partial class TrayMenuWindow : Microsoft.UI.Xaml.Window, INotifyPropertyChanged + public sealed partial class TrayMenuWindow : Window, INotifyPropertyChanged { private WNDPROC newWndProc = null; private IntPtr oldWndProc = IntPtr.Zero; @@ -34,7 +35,7 @@ public ElementTheme WindowTheme set { _windowTheme = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(WindowTheme))); + OnPropertyChanged(); } } @@ -119,33 +120,26 @@ public void OnShowOrHideWindowClicked(object sender, RoutedEventArgs args) } /// - /// ָڵ + /// ָڵĴ /// - private int GetWindowLongAuto(IntPtr hWnd, WindowLongIndexFlags nIndex) + private IntPtr SetWindowLongAuto(IntPtr hWnd, WindowLongIndexFlags nIndex, IntPtr dwNewLong) { if (IntPtr.Size == 8) { - return User32Library.GetWindowLongPtr(hWnd, nIndex); + return User32Library.SetWindowLongPtr(hWnd, nIndex, dwNewLong); } else { - return User32Library.GetWindowLong(hWnd, nIndex); + return User32Library.SetWindowLong(hWnd, nIndex, dwNewLong); } } /// - /// ָڵĴ + /// ֵ仯ʱ֪ͨ /// - private IntPtr SetWindowLongAuto(IntPtr hWnd, WindowLongIndexFlags nIndex, IntPtr dwNewLong) + private void OnPropertyChanged([CallerMemberName] string propertyName = null) { - if (IntPtr.Size == 8) - { - return User32Library.SetWindowLongPtr(hWnd, nIndex, dwNewLong); - } - else - { - return User32Library.SetWindowLong(hWnd, nIndex, dwNewLong); - } + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } /// diff --git a/GetStoreAppPackage/Package.appxmanifest b/GetStoreAppPackage/Package.appxmanifest index 684f3a752..6746e5599 100644 --- a/GetStoreAppPackage/Package.appxmanifest +++ b/GetStoreAppPackage/Package.appxmanifest @@ -15,7 +15,7 @@ + Version="2.2.725.0" /> ms-resource:PackageDisplayName