App.axaml.cs 761 B

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