mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
unify achievement mvvm
This commit is contained in:
@@ -8,7 +8,7 @@ using EntityAchievement = Snap.Hutao.Model.Entity.Achievement;
|
||||
namespace Snap.Hutao.Service.Achievement;
|
||||
|
||||
[ConstructorGenerated]
|
||||
[Injection(InjectAs.Scoped, typeof(IAchievementStatisticsService))]
|
||||
[Injection(InjectAs.Transient, typeof(IAchievementStatisticsService))]
|
||||
internal sealed partial class AchievementStatisticsService : IAchievementStatisticsService
|
||||
{
|
||||
private const int AchievementCardTakeCount = 2;
|
||||
|
||||
@@ -18,7 +18,7 @@ internal abstract partial class ViewModelSlim : ObservableObject
|
||||
protected IServiceProvider ServiceProvider { get => serviceProvider; }
|
||||
|
||||
[Command("LoadCommand")]
|
||||
protected virtual Task OpenUIAsync()
|
||||
protected virtual Task LoadAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -8,22 +8,15 @@ using Snap.Hutao.UI.Xaml.View.Page;
|
||||
|
||||
namespace Snap.Hutao.ViewModel.Achievement;
|
||||
|
||||
/// <summary>
|
||||
/// 简化的成就视图模型
|
||||
/// </summary>
|
||||
[ConstructorGenerated(CallBaseConstructor = true)]
|
||||
[Injection(InjectAs.Transient)]
|
||||
internal sealed partial class AchievementViewModelSlim : Abstraction.ViewModelSlim<AchievementPage>
|
||||
{
|
||||
private List<AchievementStatistics>? statisticsList;
|
||||
|
||||
/// <summary>
|
||||
/// 统计列表
|
||||
/// </summary>
|
||||
public List<AchievementStatistics>? StatisticsList { get => statisticsList; set => SetProperty(ref statisticsList, value); }
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override async Task OpenUIAsync()
|
||||
protected override async Task LoadAsync()
|
||||
{
|
||||
using (IServiceScope scope = ServiceProvider.CreateScope())
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ internal sealed partial class DailyNoteViewModelSlim : Abstraction.ViewModelSlim
|
||||
public List<DailyNoteEntry>? DailyNoteEntries { get => dailyNoteEntries; set => SetProperty(ref dailyNoteEntries, value); }
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override async Task OpenUIAsync()
|
||||
protected override async Task LoadAsync()
|
||||
{
|
||||
if (await metadataService.InitializeAsync().ConfigureAwait(false))
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ internal sealed partial class GachaLogViewModelSlim : Abstraction.ViewModelSlim<
|
||||
public List<GachaStatisticsSlim>? StatisticsList { get => statisticsList; set => SetProperty(ref statisticsList, value); }
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override async Task OpenUIAsync()
|
||||
protected override async Task LoadAsync()
|
||||
{
|
||||
using (IServiceScope scope = ServiceProvider.CreateScope())
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ internal sealed partial class HutaoCloudStatisticsViewModel : Abstraction.ViewMo
|
||||
|
||||
public HutaoStatistics? Statistics { get => statistics; set => SetProperty(ref statistics, value); }
|
||||
|
||||
protected override async Task OpenUIAsync()
|
||||
protected override async Task LoadAsync()
|
||||
{
|
||||
await taskContext.SwitchToBackgroundAsync();
|
||||
(bool isOk, HutaoStatistics statistics) = await hutaoCloudService.GetCurrentEventStatisticsAsync().ConfigureAwait(false);
|
||||
|
||||
@@ -40,7 +40,7 @@ internal sealed partial class LaunchGameViewModelSlim : Abstraction.ViewModelSli
|
||||
public GameAccount? SelectedGameAccount { get => selectedGameAccount; set => SetProperty(ref selectedGameAccount, value); }
|
||||
|
||||
/// <inheritdoc/>
|
||||
protected override async Task OpenUIAsync()
|
||||
protected override async Task LoadAsync()
|
||||
{
|
||||
LaunchScheme? scheme = launchGameShared.GetCurrentLaunchSchemeFromConfigFile();
|
||||
ObservableCollection<GameAccount> accounts = gameService.GameAccountCollection;
|
||||
|
||||
Reference in New Issue
Block a user