MainWindow.xaml.cs 1.3 KB

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