fix achievement check status save

This commit is contained in:
DismissedLight
2023-09-13 21:26:58 +08:00
parent 706f894ea5
commit 53c484c577
3 changed files with 19 additions and 6 deletions

View File

@@ -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);

View File

@@ -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();
}
}
}
}

View File

@@ -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));
}