AboutWindow.axaml.cs 1.8 KB

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