StyleableWindow.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using Avalonia.Controls;
  2. using Avalonia.Controls.Primitives;
  3. using Avalonia.Media.Imaging;
  4. using Avalonia.Platform;
  5. using FluentAvalonia.UI.Controls;
  6. using System;
  7. using System.IO;
  8. using System.Reflection;
  9. namespace Ryujinx.Ava.Ui.Windows
  10. {
  11. public class StyleableWindow : Window
  12. {
  13. public IBitmap IconImage { get; set; }
  14. public StyleableWindow()
  15. {
  16. WindowStartupLocation = WindowStartupLocation.CenterOwner;
  17. TransparencyLevelHint = WindowTransparencyLevel.None;
  18. using Stream stream = Assembly.GetAssembly(typeof(Ryujinx.Ui.Common.Configuration.ConfigurationState)).GetManifestResourceStream("Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");
  19. Icon = new WindowIcon(stream);
  20. stream.Position = 0;
  21. IconImage = new Bitmap(stream);
  22. }
  23. protected override void OnOpened(EventArgs e)
  24. {
  25. base.OnOpened(e);
  26. }
  27. protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
  28. {
  29. base.OnApplyTemplate(e);
  30. ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
  31. }
  32. }
  33. }