StyleableWindow.cs
1 using Avalonia.Controls; 2 using Avalonia.Controls.Primitives; 3 using Avalonia.Media; 4 using Avalonia.Media.Imaging; 5 using Avalonia.Platform; 6 using Ryujinx.Ava.Common.Locale; 7 using Ryujinx.UI.Common.Configuration; 8 using System.IO; 9 using System.Reflection; 10 11 namespace Ryujinx.Ava.UI.Windows 12 { 13 public class StyleableWindow : Window 14 { 15 public Bitmap IconImage { get; set; } 16 17 public StyleableWindow() 18 { 19 WindowStartupLocation = WindowStartupLocation.CenterOwner; 20 TransparencyLevelHint = new[] { WindowTransparencyLevel.None }; 21 22 using Stream stream = Assembly.GetAssembly(typeof(ConfigurationState)).GetManifestResourceStream("Ryujinx.UI.Common.Resources.Logo_Ryujinx.png"); 23 24 Icon = new WindowIcon(stream); 25 stream.Position = 0; 26 IconImage = new Bitmap(stream); 27 28 LocaleManager.Instance.LocaleChanged += LocaleChanged; 29 LocaleChanged(); 30 } 31 32 private void LocaleChanged() 33 { 34 FlowDirection = LocaleManager.Instance.IsRTL() ? FlowDirection.RightToLeft : FlowDirection.LeftToRight; 35 } 36 37 protected override void OnApplyTemplate(TemplateAppliedEventArgs e) 38 { 39 base.OnApplyTemplate(e); 40 41 ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome | ExtendClientAreaChromeHints.OSXThickTitleBar; 42 } 43 } 44 }