MainWindow.xaml.cs 863 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System;
  4. using Avalonia;
  5. using Avalonia.Controls;
  6. using Avalonia.Markup.Xaml;
  7. using RenderTest.ViewModels;
  8. using ReactiveUI;
  9. namespace RenderTest
  10. {
  11. public class MainWindow : Window
  12. {
  13. public MainWindow()
  14. {
  15. this.InitializeComponent();
  16. this.AttachDevTools();
  17. var vm = new MainWindowViewModel();
  18. vm.WhenAnyValue(x => x.DrawDirtyRects).Subscribe(x => Renderer.DrawDirtyRects = x);
  19. vm.WhenAnyValue(x => x.DrawFps).Subscribe(x => Renderer.DrawFps = x);
  20. this.DataContext = vm;
  21. }
  22. private void InitializeComponent()
  23. {
  24. AvaloniaXamlLoader.Load(this);
  25. }
  26. }
  27. }