ServerMain.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace RDServer
  11. {
  12. public partial class ServerMain : Form
  13. {
  14. public ServerMain()
  15. {
  16. InitializeComponent();
  17. this.Resize += ServerMain_Resize;
  18. this.FormClosing += ServerMain_FormClosing;
  19. }
  20. private void ServerMain_FormClosing(object sender, FormClosingEventArgs e)
  21. {
  22. e.Cancel = true;
  23. this.WindowState = FormWindowState.Minimized;
  24. }
  25. private void ServerMain_Resize(object sender, EventArgs e)
  26. {
  27. if (this.WindowState == FormWindowState.Minimized)
  28. {
  29. this.Hide();
  30. //this.Visible = false;
  31. this.ShowInTaskbar = false;
  32. }
  33. }
  34. private void tlsShowMain_Click(object sender, EventArgs e)
  35. {
  36. this.Show();
  37. //this.Visible = true;
  38. this.WindowState = FormWindowState.Normal;
  39. this.ShowInTaskbar = true;
  40. }
  41. private void tlsExitAPP_Click(object sender, EventArgs e)
  42. {
  43. System.Environment.Exit(System.Environment.ExitCode);
  44. Application.ExitThread();
  45. Application.Exit();
  46. }
  47. private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
  48. {
  49. tlsShowMain_Click( sender, e);
  50. }
  51. }
  52. }