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