App.axaml.cs 971 B

1234567891011121314151617181920212223242526272829303132333435
  1. using Avalonia;
  2. using Avalonia.Controls.ApplicationLifetimes;
  3. using Microsoft.EntityFrameworkCore;
  4. using Avalonia.Markup.Xaml;
  5. using AvaloniaApplication2.Models;
  6. using AvaloniaApplication2.ViewModels;
  7. using AvaloniaApplication2.Views;
  8. using Microsoft.Extensions.DependencyInjection;
  9. using Avalonia.Data.Core.Plugins;
  10. namespace AvaloniaApplication2;
  11. public partial class App : Application
  12. {
  13. public override void Initialize()
  14. {
  15. AvaloniaXamlLoader.Load(this);
  16. }
  17. public override void OnFrameworkInitializationCompleted()
  18. {
  19. if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
  20. {
  21. //Îòêðûâàåì îêíî àâòîðèçàöèè ïðè çàïóñêå ïðèëîæåíèÿ
  22. BindingPlugins.DataValidators.RemoveAt(0);
  23. desktop.MainWindow = new MainWindow
  24. {
  25. DataContext = new MainWindowViewModel(),
  26. };
  27. }
  28. base.OnFrameworkInitializationCompleted();
  29. }
  30. }