AboutWindow.axaml.cs
1 using Avalonia.Controls; 2 using Avalonia.Input; 3 using Avalonia.Interactivity; 4 using Avalonia.Layout; 5 using Avalonia.Styling; 6 using FluentAvalonia.UI.Controls; 7 using Ryujinx.Ava.Common.Locale; 8 using Ryujinx.Ava.UI.Helpers; 9 using Ryujinx.Ava.UI.ViewModels; 10 using Ryujinx.UI.Common.Helper; 11 using System.Threading.Tasks; 12 using Button = Avalonia.Controls.Button; 13 14 namespace Ryujinx.Ava.UI.Windows 15 { 16 public partial class AboutWindow : UserControl 17 { 18 public AboutWindow() 19 { 20 DataContext = new AboutWindowViewModel(); 21 22 InitializeComponent(); 23 } 24 25 public static async Task Show() 26 { 27 ContentDialog contentDialog = new() 28 { 29 PrimaryButtonText = "", 30 SecondaryButtonText = "", 31 CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose], 32 Content = new AboutWindow(), 33 }; 34 35 Style closeButton = new(x => x.Name("CloseButton")); 36 closeButton.Setters.Add(new Setter(WidthProperty, 80d)); 37 38 Style closeButtonParent = new(x => x.Name("CommandSpace")); 39 closeButtonParent.Setters.Add(new Setter(HorizontalAlignmentProperty, HorizontalAlignment.Right)); 40 41 contentDialog.Styles.Add(closeButton); 42 contentDialog.Styles.Add(closeButtonParent); 43 44 await ContentDialogHelper.ShowAsync(contentDialog); 45 } 46 47 private void Button_OnClick(object sender, RoutedEventArgs e) 48 { 49 if (sender is Button button) 50 { 51 OpenHelper.OpenUrl(button.Tag.ToString()); 52 } 53 } 54 55 private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e) 56 { 57 if (sender is TextBlock) 58 { 59 OpenHelper.OpenUrl("https://amiiboapi.com"); 60 } 61 } 62 } 63 }