mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix achievement check status save
This commit is contained in:
@@ -21,7 +21,7 @@ internal sealed partial class InvokeCommandOnLoadedBehavior : BehaviorBase<UIEle
|
||||
base.OnAttached();
|
||||
|
||||
// FrameworkElement in a ItemsRepeater gets attached twice
|
||||
if (!executed && AssociatedObject is FrameworkElement { IsLoaded: true })
|
||||
if (AssociatedObject is FrameworkElement { IsLoaded: true })
|
||||
{
|
||||
TryExecuteCommand();
|
||||
}
|
||||
@@ -35,6 +35,11 @@ internal sealed partial class InvokeCommandOnLoadedBehavior : BehaviorBase<UIEle
|
||||
|
||||
private void TryExecuteCommand()
|
||||
{
|
||||
if (executed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Command is not null && Command.CanExecute(CommandParameter))
|
||||
{
|
||||
Command.Execute(CommandParameter);
|
||||
|
||||
@@ -270,10 +270,18 @@ internal sealed partial class Activation : IActivation
|
||||
}
|
||||
else
|
||||
{
|
||||
await serviceProvider
|
||||
.GetRequiredService<INavigationService>()
|
||||
.NavigateAsync<View.Page.LaunchGamePage>(INavigationAwaiter.Default, true)
|
||||
.ConfigureAwait(false);
|
||||
if (currentWindowReference.Window is MainWindow)
|
||||
{
|
||||
await serviceProvider
|
||||
.GetRequiredService<INavigationService>()
|
||||
.NavigateAsync<View.Page.LaunchGamePage>(INavigationAwaiter.Default, true)
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have a non-Main Window, just exit current process anyway
|
||||
Process.GetCurrentProcess().Kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ internal sealed class AchievementView : ObservableObject, IEntityWithMetadata<Mo
|
||||
{
|
||||
(Entity.Status, Entity.Time) = value
|
||||
? (AchievementStatus.STATUS_REWARD_TAKEN, DateTimeOffset.Now)
|
||||
: (AchievementStatus.STATUS_FINISHED, default);
|
||||
: (AchievementStatus.STATUS_INVALID, default);
|
||||
|
||||
OnPropertyChanged(nameof(Time));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user