App.axaml.cs 599 B

123456789101112131415161718192021222324
  1. using Avalonia;
  2. using Avalonia.Controls.ApplicationLifetimes;
  3. using Avalonia.Markup.Xaml;
  4. namespace AvaloniaApplication5
  5. {
  6. public partial class App : Application
  7. {
  8. public override void Initialize()
  9. {
  10. AvaloniaXamlLoader.Load(this);
  11. }
  12. public override void OnFrameworkInitializationCompleted()
  13. {
  14. if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
  15. {
  16. desktop.MainWindow = new MainWindow();
  17. }
  18. base.OnFrameworkInitializationCompleted();
  19. }
  20. }
  21. }