StyleableWindow.cs 1.2 KB

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