aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs')
-rw-r--r--Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs69
1 files changed, 27 insertions, 42 deletions
diff --git a/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs b/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs
index 99280b87..5dbbbcdd 100644
--- a/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs
+++ b/Ryujinx.Ava/UI/Windows/AboutWindow.axaml.cs
@@ -1,70 +1,55 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
-using Avalonia.Threading;
+using Avalonia.Styling;
+using FluentAvalonia.UI.Controls;
using Ryujinx.Ava.Common.Locale;
-using Ryujinx.Common.Utilities;
+using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Ui.Common.Helper;
-using System.Net.Http;
-using System.Net.NetworkInformation;
using System.Threading.Tasks;
+using Button = Avalonia.Controls.Button;
namespace Ryujinx.Ava.UI.Windows
{
- public partial class AboutWindow : StyleableWindow
+ public partial class AboutWindow : UserControl
{
public AboutWindow()
{
- if (Program.PreviewerDetached)
- {
- Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance[LocaleKeys.MenuBarHelpAbout];
- }
-
- Version = Program.Version;
-
- DataContext = this;
+ DataContext = new AboutWindowViewModel();
InitializeComponent();
-
- _ = DownloadPatronsJson();
}
- public string Supporters { get; set; }
- public string Version { get; set; }
-
- public string Developers => string.Format(LocaleManager.Instance[LocaleKeys.AboutPageDeveloperListMore], "gdkchan, Ac_K, Thog, rip in peri peri, LDj3SNuD, emmaus, Thealexbarney, Xpl0itR, GoffyDude, »jD«");
-
- private void Button_OnClick(object sender, RoutedEventArgs e)
+ public static async Task Show()
{
- if (sender is Button button)
- {
- OpenHelper.OpenUrl(button.Tag.ToString());
- }
- }
+ var content = new AboutWindow();
- private async Task DownloadPatronsJson()
- {
- if (!NetworkInterface.GetIsNetworkAvailable())
+ ContentDialog contentDialog = new()
{
- Supporters = LocaleManager.Instance[LocaleKeys.ConnectionError];
+ PrimaryButtonText = "",
+ SecondaryButtonText = "",
+ CloseButtonText = LocaleManager.Instance[LocaleKeys.UserProfilesClose],
+ Content = content
+ };
- return;
- }
+ Style closeButton = new(x => x.Name("CloseButton"));
+ closeButton.Setters.Add(new Setter(WidthProperty, 80d));
- HttpClient httpClient = new();
+ Style closeButtonParent = new(x => x.Name("CommandSpace"));
+ closeButtonParent.Setters.Add(new Setter(HorizontalAlignmentProperty, Avalonia.Layout.HorizontalAlignment.Right));
- try
- {
- string patreonJsonString = await httpClient.GetStringAsync("https://patreon.ryujinx.org/");
+ contentDialog.Styles.Add(closeButton);
+ contentDialog.Styles.Add(closeButtonParent);
- Supporters = string.Join(", ", JsonHelper.Deserialize<string[]>(patreonJsonString));
- }
- catch
+ await contentDialog.ShowAsync();
+ }
+
+ private void Button_OnClick(object sender, RoutedEventArgs e)
+ {
+ if (sender is Button button)
{
- Supporters = LocaleManager.Instance[LocaleKeys.ApiError];
+ OpenHelper.OpenUrl(button.Tag.ToString());
}
-
- await Dispatcher.UIThread.InvokeAsync(() => SupportersTextBlock.Text = Supporters);
}
private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e)