AboutWindow.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using Gtk;
  2. using Ryujinx.Common.Utilities;
  3. using Ryujinx.Ui.Helper;
  4. using System.Net.Http;
  5. using System.Net.NetworkInformation;
  6. using System.Reflection;
  7. using System.Threading.Tasks;
  8. namespace Ryujinx.Ui.Windows
  9. {
  10. public partial class AboutWindow : Window
  11. {
  12. public AboutWindow() : base($"Ryujinx {Program.Version} - About")
  13. {
  14. Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.Resources.Logo_Ryujinx.png");
  15. InitializeComponent();
  16. _ = DownloadPatronsJson();
  17. }
  18. private async Task DownloadPatronsJson()
  19. {
  20. if (!NetworkInterface.GetIsNetworkAvailable())
  21. {
  22. _patreonNamesText.Buffer.Text = "Connection Error.";
  23. }
  24. HttpClient httpClient = new HttpClient();
  25. try
  26. {
  27. string patreonJsonString = await httpClient.GetStringAsync("https://patreon.ryujinx.org/");
  28. _patreonNamesText.Buffer.Text = string.Join(", ", JsonHelper.Deserialize<string[]>(patreonJsonString));
  29. }
  30. catch
  31. {
  32. _patreonNamesText.Buffer.Text = "API Error.";
  33. }
  34. }
  35. //
  36. // Events
  37. //
  38. private void RyujinxButton_Pressed(object sender, ButtonPressEventArgs args)
  39. {
  40. OpenHelper.OpenUrl("https://ryujinx.org");
  41. }
  42. private void AmiiboApiButton_Pressed(object sender, ButtonPressEventArgs args)
  43. {
  44. OpenHelper.OpenUrl("https://amiiboapi.com");
  45. }
  46. private void PatreonButton_Pressed(object sender, ButtonPressEventArgs args)
  47. {
  48. OpenHelper.OpenUrl("https://www.patreon.com/ryujinx");
  49. }
  50. private void GitHubButton_Pressed(object sender, ButtonPressEventArgs args)
  51. {
  52. OpenHelper.OpenUrl("https://github.com/Ryujinx/Ryujinx");
  53. }
  54. private void DiscordButton_Pressed(object sender, ButtonPressEventArgs args)
  55. {
  56. OpenHelper.OpenUrl("https://discordapp.com/invite/N2FmfVc");
  57. }
  58. private void TwitterButton_Pressed(object sender, ButtonPressEventArgs args)
  59. {
  60. OpenHelper.OpenUrl("https://twitter.com/RyujinxEmu");
  61. }
  62. private void ContributorsButton_Pressed(object sender, ButtonPressEventArgs args)
  63. {
  64. OpenHelper.OpenUrl("https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a");
  65. }
  66. }
  67. }