Skip to content

Commit

Permalink
Update propertychanged
Browse files Browse the repository at this point in the history
Update propertychanged
  • Loading branch information
Gaoyifei1011 committed Jul 25, 2023
1 parent e3ac49c commit ae98498
Show file tree
Hide file tree
Showing 61 changed files with 611 additions and 163 deletions.
2 changes: 1 addition & 1 deletion GetStoreApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions GetStoreApp/GetStoreApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@
<None Remove="Views\Pages\WebPage.xaml" />
<None Remove="Views\Pages\WinGetPage.xaml" />

<None Remove="Views\Window\MainWindow.xaml" />
<None Remove="Views\Window\TrayMenuWindow.xaml" />
<None Remove="Views\Windows\MainWindow.xaml" />
<None Remove="Views\Windows\TrayMenuWindow.xaml" />

<None Update="Assets\Resources\LICENSE" CopyToOutputDirectory="Never" />
<None Update="Mile.Aria2.conf" CopyToOutputDirectory="Never" />
Expand Down Expand Up @@ -348,8 +348,8 @@
<Page Update="Views\Pages\WebPage.xaml" Generator="MSBuild:Compile" />
<Page Update="Views\Pages\WinGetPage.xaml" Generator="MSBuild:Compile" />

<Page Update="Views\Window\MainWindow.xaml" Generator="MSBuild:Compile" />
<Page Update="Views\Window\TrayMenuWindow.xaml" Generator="MSBuild:Compile" />
<Page Update="Views\Windows\MainWindow.xaml" Generator="MSBuild:Compile" />
<Page Update="Views\Windows\TrayMenuWindow.xaml" Generator="MSBuild:Compile" />

<TrimmableAssembly Include="Microsoft.InteractiveExperiences.Projection" />
<TrimmableAssembly Include="Microsoft.Windows.ApplicationModel.DynamicDependency.Projection" />
Expand Down
19 changes: 14 additions & 5 deletions GetStoreApp/Models/Controls/Download/CompletedModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace GetStoreApp.Models.Controls.Download
{
Expand All @@ -19,7 +20,7 @@ public bool IsSelected
set
{
_isSelected = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected)));
OnPropertyChanged();
}
}

Expand All @@ -35,7 +36,7 @@ public bool IsSelectMode
set
{
_isSelectMode = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode)));
OnPropertyChanged();
}
}

Expand Down Expand Up @@ -91,7 +92,7 @@ public bool IsInstalling
set
{
_isInstalling = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsInstalling)));
OnPropertyChanged();
}
}

Expand All @@ -107,7 +108,7 @@ public double InstallValue
set
{
_installValue = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InstallValue)));
OnPropertyChanged();
}
}

Expand All @@ -121,10 +122,18 @@ public bool InstallError
set
{
_installError = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InstallError)));
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// 属性值发生变化时通知更改
/// </summary>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
23 changes: 16 additions & 7 deletions GetStoreApp/Models/Controls/Download/DownloadingModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using GetStoreApp.Services.Root;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace GetStoreApp.Models.Controls.Download
{
Expand Down Expand Up @@ -32,7 +33,7 @@ public bool IsSelected
set
{
_isSelected = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected)));
OnPropertyChanged();
}
}

Expand All @@ -48,7 +49,7 @@ public bool IsSelectMode
set
{
_isSelectMode = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode)));
OnPropertyChanged();
}
}

Expand Down Expand Up @@ -102,7 +103,7 @@ public int DownloadFlag
set
{
_downloadFlag = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadFlag)));
OnPropertyChanged();
}
}

Expand All @@ -118,7 +119,7 @@ public double TotalSize
set
{
_totalSize = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TotalSize)));
OnPropertyChanged();
}
}

Expand All @@ -134,7 +135,7 @@ public double FinishedSize
set
{
_finishedSize = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FinishedSize)));
OnPropertyChanged();
}
}

Expand All @@ -150,7 +151,7 @@ public double CurrentSpeed
set
{
_currentSpeed = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentSpeed)));
OnPropertyChanged();
}
}

Expand All @@ -166,7 +167,7 @@ public bool IsFileDownloading
set
{
_isFileDownloading = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsFileDownloading)));
OnPropertyChanged();
}
}

Expand Down Expand Up @@ -208,5 +209,13 @@ public string GetDownloadingToolTip(double size, string toolTipType)
return string.Empty;
}
}

/// <summary>
/// 属性值发生变化时通知更改
/// </summary>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
13 changes: 11 additions & 2 deletions GetStoreApp/Models/Controls/Download/UnfinishedModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace GetStoreApp.Models.Controls.Download
{
Expand All @@ -19,7 +20,7 @@ public bool IsSelected
set
{
_isSelected = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected)));
OnPropertyChanged();
}
}

Expand All @@ -35,7 +36,7 @@ public bool IsSelectMode
set
{
_isSelectMode = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode)));
OnPropertyChanged();
}
}

Expand Down Expand Up @@ -80,5 +81,13 @@ public bool IsSelectMode
public double TotalSize { get; set; }

public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// 属性值发生变化时通知更改
/// </summary>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
13 changes: 11 additions & 2 deletions GetStoreApp/Models/Controls/History/HistoryModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace GetStoreApp.Models.Controls.History
{
Expand All @@ -19,7 +20,7 @@ public bool IsSelected
set
{
_isSelected = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected)));
OnPropertyChanged();
}
}

Expand All @@ -32,7 +33,7 @@ public bool IsSelectMode
set
{
_isSelectMode = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode)));
OnPropertyChanged();
}
}

Expand Down Expand Up @@ -62,5 +63,13 @@ public bool IsSelectMode
public string HistoryLink { get; set; }

public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// 属性值发生变化时通知更改
/// </summary>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
13 changes: 11 additions & 2 deletions GetStoreApp/Models/Controls/Store/ResultModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace GetStoreApp.Models.Controls.Store
{
Expand All @@ -19,7 +20,7 @@ public bool IsSelected
set
{
_isSelected = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected)));
OnPropertyChanged();
}
}

Expand All @@ -35,7 +36,7 @@ public bool IsSelectMode
set
{
_isSelectMode = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelectMode)));
OnPropertyChanged();
}
}

Expand Down Expand Up @@ -65,5 +66,13 @@ public bool IsSelectMode
public string FileSize { get; set; }

public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// 属性值发生变化时通知更改
/// </summary>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
17 changes: 13 additions & 4 deletions GetStoreApp/Models/Controls/WinGet/InstallingAppsModel.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -45,7 +46,7 @@ public double DownloadProgress
set
{
_downloadProgress = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadProgress)));
OnPropertyChanged();
}
}

Expand All @@ -61,7 +62,7 @@ public string DownloadedFileSize
set
{
_downloadedFileSize = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DownloadedFileSize)));
OnPropertyChanged();
}
}

Expand All @@ -77,7 +78,7 @@ public string TotalFileSize
set
{
_totalFileSize = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(TotalFileSize)));
OnPropertyChanged();
}
}

Expand All @@ -93,7 +94,7 @@ public PackageInstallProgressState InstallProgressState
set
{
_installProgressState = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(InstallProgressState)));
OnPropertyChanged();
}
}

Expand Down Expand Up @@ -156,5 +157,13 @@ public string InstallToolTip(string appName, PackageInstallProgressState install
}
return builder.ToString();
}

/// <summary>
/// 属性值发生变化时通知更改
/// </summary>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
11 changes: 10 additions & 1 deletion GetStoreApp/Models/Controls/WinGet/SearchAppsModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace GetStoreApp.Models.Controls.WinGet
{
Expand Down Expand Up @@ -39,10 +40,18 @@ public bool IsInstalling
set
{
_isInstalling = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsInstalling)));
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// 属性值发生变化时通知更改
/// </summary>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Loading

0 comments on commit ae98498

Please sign in to comment.