MainWindow.xaml.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Avalonia;
  2. using Avalonia.Controls;
  3. using Avalonia.Controls.Notifications;
  4. using Avalonia.Controls.Primitives;
  5. using Avalonia.Markup.Xaml;
  6. using Avalonia.Threading;
  7. using ControlCatalog.ViewModels;
  8. using System;
  9. using System.Threading.Tasks;
  10. namespace ControlCatalog
  11. {
  12. public class MainWindow : Window
  13. {
  14. private WindowNotificationManager _notificationArea;
  15. public MainWindow()
  16. {
  17. this.InitializeComponent();
  18. this.AttachDevTools();
  19. //Renderer.DrawFps = true;
  20. //Renderer.DrawDirtyRects = Renderer.DrawFps = true;
  21. _notificationArea = new WindowNotificationManager(this)
  22. {
  23. Position = NotificationPosition.TopRight,
  24. MaxItems = 3
  25. };
  26. DataContext = new MainWindowViewModel(_notificationArea);
  27. }
  28. private void InitializeComponent()
  29. {
  30. // TODO: iOS does not support dynamically loading assemblies
  31. // so we must refer to this resource DLL statically. For
  32. // now I am doing that here. But we need a better solution!!
  33. var theme = new Avalonia.Themes.Default.DefaultTheme();
  34. theme.TryGetResource("Button", out _);
  35. AvaloniaXamlLoader.Load(this);
  36. }
  37. }
  38. }