mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-08 15:08:39 +00:00
46c8129bf5
* Avalonia: Another Cleanup This PR is a cleanup to the avalonia code recently added: - Some XAML file are autoformatted like a previous PR. - Dlc is renamed to DownloadableContent (Locale exclude). - DownloadableContentManagerWindow is a bit improved (Fixes #3491). - Some nits here and there. * Fix GTK * Remove AttachDebugDevTools * Fix last warning * Fix JSON fields
79 lines
2.2 KiB
C#
79 lines
2.2 KiB
C#
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Input;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Threading;
|
|
using Ryujinx.Ava.Common.Locale;
|
|
using Ryujinx.Common.Utilities;
|
|
using Ryujinx.Ui.Common.Helper;
|
|
using System.Net.Http;
|
|
using System.Net.NetworkInformation;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Ryujinx.Ava.Ui.Windows
|
|
{
|
|
public partial class AboutWindow : StyleableWindow
|
|
{
|
|
public AboutWindow()
|
|
{
|
|
if (Program.PreviewerDetached)
|
|
{
|
|
Title = $"Ryujinx {Program.Version} - " + LocaleManager.Instance["MenuBarHelpAbout"];
|
|
}
|
|
|
|
Version = Program.Version;
|
|
|
|
DataContext = this;
|
|
|
|
InitializeComponent();
|
|
|
|
_ = DownloadPatronsJson();
|
|
}
|
|
|
|
public string Supporters { get; set; }
|
|
public string Version { get; set; }
|
|
|
|
public string Developers => string.Format(LocaleManager.Instance["AboutPageDeveloperListMore"], "gdkchan, Ac_K, Thog, rip in peri peri, LDj3SNuD, emmaus, Thealexbarney, Xpl0itR, GoffyDude, »jD«");
|
|
|
|
private void Button_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
if (sender is Button button)
|
|
{
|
|
OpenHelper.OpenUrl(button.Tag.ToString());
|
|
}
|
|
}
|
|
|
|
private async Task DownloadPatronsJson()
|
|
{
|
|
if (!NetworkInterface.GetIsNetworkAvailable())
|
|
{
|
|
Supporters = LocaleManager.Instance["ConnectionError"];
|
|
|
|
return;
|
|
}
|
|
|
|
HttpClient httpClient = new();
|
|
|
|
try
|
|
{
|
|
string patreonJsonString = await httpClient.GetStringAsync("https://patreon.ryujinx.org/");
|
|
|
|
Supporters = string.Join(", ", JsonHelper.Deserialize<string[]>(patreonJsonString));
|
|
}
|
|
catch
|
|
{
|
|
Supporters = LocaleManager.Instance["ApiError"];
|
|
}
|
|
|
|
await Dispatcher.UIThread.InvokeAsync(() => SupportersTextBlock.Text = Supporters);
|
|
}
|
|
|
|
private void AmiiboLabel_OnPointerPressed(object sender, PointerPressedEventArgs e)
|
|
{
|
|
if (sender is TextBlock)
|
|
{
|
|
OpenHelper.OpenUrl("https://amiiboapi.com");
|
|
}
|
|
}
|
|
}
|
|
} |