2022-08-18 17:04:54 +01:00
|
|
|
|
using Avalonia.Controls;
|
2022-05-15 12:30:15 +01:00
|
|
|
|
using Avalonia.Input;
|
|
|
|
|
using Avalonia.Interactivity;
|
2023-01-07 00:29:18 +00:00
|
|
|
|
using Avalonia.Styling;
|
|
|
|
|
using FluentAvalonia.UI.Controls;
|
2022-05-15 12:30:15 +01:00
|
|
|
|
using Ryujinx.Ava.Common.Locale;
|
2023-01-07 00:29:18 +00:00
|
|
|
|
using Ryujinx.Ava.UI.ViewModels;
|
2022-05-15 12:30:15 +01:00
|
|
|
|
using Ryujinx.Ui.Common.Helper;
|
|
|
|
|
using System.Threading.Tasks;
|
2023-01-07 00:29:18 +00:00
|
|
|
|
using Button = Avalonia.Controls.Button;
|
2022-05-15 12:30:15 +01:00
|
|
|
|
|
2022-12-29 14:24:05 +00:00
|
|
|
|
namespace Ryujinx.Ava.UI.Windows
|
2022-05-15 12:30:15 +01:00
|
|
|
|
{
|
2023-01-07 00:29:18 +00:00
|
|
|
|
public partial class AboutWindow : UserControl
|
2022-05-15 12:30:15 +01:00
|
|
|
|
{
|
|
|
|
|
public AboutWindow()
|
|
|
|
|
{
|
2023-01-07 00:29:18 +00:00
|
|
|
|
DataContext = new AboutWindowViewModel();
|
2022-05-15 12:30:15 +01:00
|
|
|
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-07 00:29:18 +00:00
|
|
|
|
public static async Task Show()
|
2022-05-15 12:30:15 +01:00
|
|
|
|
{
|
2023-01-07 00:29:18 +00:00
|
|
|
|
var content = new AboutWindow();
|
2022-05-15 12:30:15 +01:00
|
|
|
|
|
2023-01-07 00:29:18 +00:00
|
|
|
|
ContentDialog contentDialog = new()
|
2022-05-15 12:30:15 +01:00
|
|
|
|
{
|
2023-01-07 00:29:18 +00:00
|
|
|
|
PrimaryButtonText = "",
|
|
|
|
|
SecondaryButtonText = "",
|
|
|
|
|
CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose],
|
|
|
|
|
Content = content
|
|
|
|
|
};
|
2022-05-15 12:30:15 +01:00
|
|
|
|
|
2023-01-07 00:29:18 +00:00
|
|
|
|
Style closeButton = new(x => x.Name("CloseButton"));
|
|
|
|
|
closeButton.Setters.Add(new Setter(WidthProperty, 80d));
|
2022-05-15 12:30:15 +01:00
|
|
|
|
|
2023-01-07 00:29:18 +00:00
|
|
|
|
Style closeButtonParent = new(x => x.Name("CommandSpace"));
|
|
|
|
|
closeButtonParent.Setters.Add(new Setter(HorizontalAlignmentProperty, Avalonia.Layout.HorizontalAlignment.Right));
|
2022-05-15 12:30:15 +01:00
|
|
|
|
|
2023-01-07 00:29:18 +00:00
|
|
|
|
contentDialog.Styles.Add(closeButton);
|
|
|
|
|
contentDialog.Styles.Add(closeButtonParent);
|
2022-05-15 12:30:15 +01:00
|
|
|
|
|
2023-01-07 00:29:18 +00:00
|
|
|
|
await contentDialog.ShowAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Button_OnClick(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (sender is Button button)
|
2022-05-15 12:30:15 +01:00
|
|
|
|
{
|
2023-01-07 00:29:18 +00:00
|
|
|
|
OpenHelper.OpenUrl(button.Tag.ToString());
|
2022-05-15 12:30:15 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (sender is TextBlock)
|
|
|
|
|
{
|
|
|
|
|
OpenHelper.OpenUrl("https://amiiboapi.com");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|