AboutWindow.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using Gtk;
  2. using System;
  3. using System.Diagnostics;
  4. using System.Reflection;
  5. using System.Runtime.InteropServices;
  6. using GUI = Gtk.Builder.ObjectAttribute;
  7. namespace Ryujinx.Ui
  8. {
  9. public class AboutWindow : Window
  10. {
  11. #pragma warning disable CS0649
  12. #pragma warning disable IDE0044
  13. [GUI] Window _aboutWin;
  14. [GUI] Label _versionText;
  15. [GUI] Image _ryujinxLogo;
  16. [GUI] Image _patreonLogo;
  17. [GUI] Image _gitHubLogo;
  18. [GUI] Image _discordLogo;
  19. [GUI] Image _twitterLogo;
  20. #pragma warning restore CS0649
  21. #pragma warning restore IDE0044
  22. public AboutWindow() : this(new Builder("Ryujinx.Ui.AboutWindow.glade")) { }
  23. private AboutWindow(Builder builder) : base(builder.GetObject("_aboutWin").Handle)
  24. {
  25. builder.Autoconnect(this);
  26. _aboutWin.Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");
  27. _ryujinxLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png" , 100, 100);
  28. _patreonLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.PatreonLogo.png", 30 , 30 );
  29. _gitHubLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.GitHubLogo.png" , 30 , 30 );
  30. _discordLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.DiscordLogo.png", 30 , 30 );
  31. _twitterLogo.Pixbuf = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.TwitterLogo.png", 30 , 30 );
  32. _versionText.Text = Program.Version;
  33. }
  34. private static void OpenUrl(string url)
  35. {
  36. if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
  37. {
  38. Process.Start(new ProcessStartInfo("cmd", $"/c start {url}"));
  39. }
  40. else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
  41. {
  42. Process.Start("xdg-open", url);
  43. }
  44. else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
  45. {
  46. Process.Start("open", url);
  47. }
  48. }
  49. //Events
  50. private void RyujinxButton_Pressed(object sender, ButtonPressEventArgs args)
  51. {
  52. OpenUrl("https://ryujinx.org");
  53. }
  54. private void PatreonButton_Pressed(object sender, ButtonPressEventArgs args)
  55. {
  56. OpenUrl("https://www.patreon.com/ryujinx");
  57. }
  58. private void GitHubButton_Pressed(object sender, ButtonPressEventArgs args)
  59. {
  60. OpenUrl("https://github.com/Ryujinx/Ryujinx");
  61. }
  62. private void DiscordButton_Pressed(object sender, ButtonPressEventArgs args)
  63. {
  64. OpenUrl("https://discordapp.com/invite/N2FmfVc");
  65. }
  66. private void TwitterButton_Pressed(object sender, ButtonPressEventArgs args)
  67. {
  68. OpenUrl("https://twitter.com/RyujinxEmu");
  69. }
  70. private void ContributorsButton_Pressed(object sender, ButtonPressEventArgs args)
  71. {
  72. OpenUrl("https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a");
  73. }
  74. private void CloseToggle_Activated(object sender, EventArgs args)
  75. {
  76. Dispose();
  77. }
  78. }
  79. }