diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Notification/IInfoBarService.cs b/src/Snap.Hutao/Snap.Hutao/Service/Notification/IInfoBarService.cs
index 8836ef0b..432c943b 100644
--- a/src/Snap.Hutao/Snap.Hutao/Service/Notification/IInfoBarService.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Notification/IInfoBarService.cs
@@ -22,7 +22,7 @@ internal interface IInfoBarService
///
/// 消息
/// 关闭延迟
- void Error(string message, int delay = 60000);
+ void Error(string message, int delay = 30000);
///
/// 显示错误消息
@@ -30,14 +30,14 @@ internal interface IInfoBarService
/// 标题
/// 消息
/// 关闭延迟
- void Error(string title, string message, int delay = 60000);
+ void Error(string title, string message, int delay = 30000);
///
/// 显示错误消息
///
/// 异常
/// 关闭延迟
- void Error(Exception exception, int delay = 60000);
+ void Error(Exception exception, int delay = 30000);
///
/// 显示错误消息
@@ -45,7 +45,7 @@ internal interface IInfoBarService
/// 异常
/// 标题
/// 关闭延迟
- void Error(Exception exception, string title, int delay = 60000);
+ void Error(Exception exception, string title, int delay = 30000);
///
/// 显示提示信息
@@ -82,7 +82,7 @@ internal interface IInfoBarService
///
/// 消息
/// 关闭延迟
- void Warning(string message, int delay = 30000);
+ void Warning(string message, int delay = 15000);
///
/// 显示警告信息
@@ -90,5 +90,5 @@ internal interface IInfoBarService
/// 标题
/// 消息
/// 关闭延迟
- void Warning(string title, string message, int delay = 30000);
+ void Warning(string title, string message, int delay = 15000);
}
diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs
index 8ce781a7..4bc472b2 100644
--- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs
+++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs
@@ -149,6 +149,10 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel
SelectedGameAccount ??= gameService.DetectCurrentGameAccount();
}
}
+ catch (UserdataCorruptedException ex)
+ {
+ infoBarService.Error(ex);
+ }
catch (OperationCanceledException)
{
}
diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModelSlim.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModelSlim.cs
index cf373fbe..c04150b2 100644
--- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModelSlim.cs
+++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModelSlim.cs
@@ -1,6 +1,7 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
+using Snap.Hutao.Core.ExceptionService;
using Snap.Hutao.Model.Entity;
using Snap.Hutao.Service.Game;
using Snap.Hutao.Service.Notification;
@@ -17,6 +18,7 @@ internal sealed partial class LaunchGameViewModelSlim : Abstraction.ViewModelSli
{
private readonly IGameService gameService;
private readonly ITaskContext taskContext;
+ private readonly IInfoBarService infoBarService;
private ObservableCollection? gameAccounts;
private GameAccount? selectedGameAccount;
@@ -38,8 +40,15 @@ internal sealed partial class LaunchGameViewModelSlim : Abstraction.ViewModelSli
await taskContext.SwitchToMainThreadAsync();
GameAccounts = accounts;
- // Try set to the current account.
- SelectedGameAccount ??= gameService.DetectCurrentGameAccount();
+ try
+ {
+ // Try set to the current account.
+ SelectedGameAccount ??= gameService.DetectCurrentGameAccount();
+ }
+ catch (UserdataCorruptedException ex)
+ {
+ infoBarService.Error(ex);
+ }
}
[Command("LaunchCommand", AllowConcurrentExecutions = true)]