@@ -33,7 +33,7 @@ public override void Initialize()
33
33
34
34
private static IServiceProvider ConfigureServices ( ) => new ServiceCollection ( )
35
35
. AddTransient < MainWindowViewModel > ( )
36
- . AddTransient < ViewModels . Home . HomeViewModel > ( )
36
+ . AddTransient < HomeViewModel > ( )
37
37
. AddTransient < HomeSubViewModel > ( )
38
38
. AddTransient < VersionManagerViewModel > ( )
39
39
. AddTransient < GameSettingsViewModel > ( )
@@ -49,7 +49,7 @@ public override void Initialize()
49
49
. AddSingleton < IJavaManager , JavaManager > ( )
50
50
. AddSingleton < DownloadService > ( )
51
51
. AddSingleton < GameService > ( )
52
- . AddSingleton < GameLauncher > ( provider => new GameLauncher ( provider . GetRequiredService < GameService > ( ) ) )
52
+ . AddSingleton < GameLauncher > ( )
53
53
. AddSingleton < UserService > ( )
54
54
. BuildServiceProvider ( ) ;
55
55
@@ -65,6 +65,8 @@ public override void OnFrameworkInitializationCompleted()
65
65
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
66
66
DisableAvaloniaDataAnnotationValidation ( ) ;
67
67
desktop . MainWindow = new MainWindow { DataContext = vm } ;
68
+ // 由于导航改成了异步方法,在构造函数中无法正常导向首页,需要在此处导向
69
+ Ioc . Default . GetRequiredService < INavigationService > ( ) . GotoAsync < HomeViewModel > ( ) ;
68
70
}
69
71
70
72
base . OnFrameworkInitializationCompleted ( ) ;
0 commit comments