AboutWindow.axaml.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.Helpers;
  8. using Ryujinx.Ava.UI.ViewModels;
  9. using Ryujinx.Ui.Common.Helper;
  10. using System.Threading.Tasks;
  11. using Button = Avalonia.Controls.Button;
  12. namespace Ryujinx.Ava.UI.Windows
  13. {
  14. public partial class AboutWindow : UserControl
  15. {
  16. public AboutWindow()
  17. {
  18. DataContext = new AboutWindowViewModel();
  19. InitializeComponent();
  20. }
  21. public static async Task Show()
  22. {
  23. ContentDialog contentDialog = new()
  24. {
  25. PrimaryButtonText = "",
  26. SecondaryButtonText = "",
  27. CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose],
  28. Content = new AboutWindow()
  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 ContentDialogHelper.ShowAsync(contentDialog);
  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. }