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