mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
fix #1052 & user account add crash
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
using Snap.Hutao.Core;
|
||||
using Snap.Hutao.Core.ExceptionService;
|
||||
using Snap.Hutao.Core.IO.Ini;
|
||||
using Snap.Hutao.Factory.Abstraction;
|
||||
using Snap.Hutao.Model.Entity;
|
||||
using Snap.Hutao.Service.Game.Locator;
|
||||
using Snap.Hutao.Service.Game.Package;
|
||||
@@ -25,6 +26,7 @@ namespace Snap.Hutao.Service.Game;
|
||||
[Injection(InjectAs.Singleton, typeof(IGameService))]
|
||||
internal sealed partial class GameService : IGameService
|
||||
{
|
||||
private readonly IContentDialogFactory contentDialogFactory;
|
||||
private readonly PackageConverter packageConverter;
|
||||
private readonly IServiceProvider serviceProvider;
|
||||
private readonly IGameDbService gameDbService;
|
||||
@@ -300,7 +302,7 @@ internal sealed partial class GameService : IGameService
|
||||
{
|
||||
// ContentDialog must be created by main thread.
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
LaunchGameAccountNameDialog dialog = serviceProvider.CreateInstance<LaunchGameAccountNameDialog>();
|
||||
LaunchGameAccountNameDialog dialog = await contentDialogFactory.CreateInstanceAsync<LaunchGameAccountNameDialog>().ConfigureAwait(false);
|
||||
(bool isOk, string name) = await dialog.GetInputNameAsync().ConfigureAwait(false);
|
||||
|
||||
if (isOk)
|
||||
|
||||
@@ -280,7 +280,6 @@
|
||||
Text="{shcm:ResourceString Name=ViewUserUser}"/>
|
||||
<ListView
|
||||
Grid.Row="1"
|
||||
MaxHeight="224"
|
||||
Margin="4"
|
||||
ItemsSource="{Binding Users}"
|
||||
SelectedItem="{Binding SelectedUser, Mode=TwoWay}"
|
||||
|
||||
@@ -7,6 +7,7 @@ using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Snap.Hutao.Core;
|
||||
using Snap.Hutao.Core.ExceptionService;
|
||||
using Snap.Hutao.Core.IO.DataTransfer;
|
||||
using Snap.Hutao.Factory.Abstraction;
|
||||
using Snap.Hutao.Service.Navigation;
|
||||
using Snap.Hutao.Service.Notification;
|
||||
using Snap.Hutao.Service.SignIn;
|
||||
@@ -28,6 +29,7 @@ namespace Snap.Hutao.ViewModel.User;
|
||||
[Injection(InjectAs.Singleton)]
|
||||
internal sealed partial class UserViewModel : ObservableObject
|
||||
{
|
||||
private readonly IContentDialogFactory contentDialogFactory;
|
||||
private readonly IDocumentationProvider documentationProvider;
|
||||
private readonly INavigationService navigationService;
|
||||
private readonly IServiceProvider serviceProvider;
|
||||
@@ -131,7 +133,7 @@ internal sealed partial class UserViewModel : ObservableObject
|
||||
await taskContext.SwitchToMainThreadAsync();
|
||||
|
||||
// Get cookie from user input
|
||||
UserDialog dialog = serviceProvider.CreateInstance<UserDialog>();
|
||||
UserDialog dialog = await contentDialogFactory.CreateInstanceAsync<UserDialog>().ConfigureAwait(false);
|
||||
ValueResult<bool, string> result = await dialog.GetInputCookieAsync().ConfigureAwait(false);
|
||||
|
||||
// User confirms the input
|
||||
|
||||
Reference in New Issue
Block a user