App.xaml.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using Avalonia;
  2. using Avalonia.Controls.ApplicationLifetimes;
  3. using Avalonia.Markup.Xaml;
  4. namespace RenderDemo
  5. {
  6. public 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. desktop.MainWindow = new MainWindow();
  16. base.OnFrameworkInitializationCompleted();
  17. }
  18. // TODO: Make this work with GTK/Skia/Cairo depending on command-line args
  19. // again.
  20. static void Main(string[] args)
  21. => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
  22. // App configuration, used by the entry point and previewer
  23. static AppBuilder BuildAvaloniaApp()
  24. => AppBuilder.Configure<App>()
  25. .With(new Win32PlatformOptions
  26. {
  27. OverlayPopups = true,
  28. })
  29. .UsePlatformDetect()
  30. .LogToTrace();
  31. }
  32. }