RefreshForm2.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 IntelligentControlForsx.Test
  11. {
  12. public partial class RefreshForm2 : Form
  13. {
  14. public RefreshForm2()
  15. {
  16. InitializeComponent();
  17. }
  18. private void btnChangeToMartix_Click(object sender, EventArgs e)
  19. {
  20. if (CacheForm.dicMain1Form.ContainsKey("mainForm1"))
  21. {
  22. RefreshForm f = (RefreshForm)CacheForm.dicMain1Form["mainForm1"];
  23. f.TopLevel = true;
  24. }
  25. if (CacheForm.dicMain2Form.ContainsKey("mainForm2"))
  26. {
  27. Form f = CacheForm.dicMain2Form["mainForm2"];
  28. //f.TopLevel = false;
  29. f.Hide();
  30. }
  31. }
  32. private void btnHome_Click(object sender, EventArgs e)
  33. {
  34. PageChange("home");
  35. }
  36. private void btnWindturbineInfo_Click(object sender, EventArgs e)
  37. {
  38. PageChange("info");
  39. }
  40. private void btnControl_Click(object sender, EventArgs e)
  41. {
  42. PageChange("control");
  43. }
  44. public void PageChange(string pageString)
  45. {
  46. IList<string> formKeyList = CacheForm.dicMain2Form.Keys.ToList();
  47. for (int i = 0; i < formKeyList.Count; i++)
  48. {
  49. Form f = CacheForm.dicMain2Form[formKeyList[i]];
  50. if (formKeyList[i] != "mainForm2")
  51. if (formKeyList[i] == pageString)
  52. f.Show();
  53. else
  54. f.Hide();
  55. }
  56. }
  57. }
  58. }