AboutWindow.cs 3.2 KB

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