App.axaml.cs 537 B

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