ElectricalForm.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. using IntelligentControlForsx.MyControls;
  11. using IntelligentControlForsx.Template;
  12. using IntelligentControlForsx.MyControls.syz;
  13. using IntelligentControlForsx.Service;
  14. namespace IntelligentControlForsx.ChildForms
  15. {
  16. public partial class ElectricalForm : TemplateForm
  17. {
  18. public Dictionary<string, ZTControl> dicControl = new Dictionary<string, ZTControl>();
  19. private string stationId;
  20. public string StationId
  21. {
  22. set
  23. {
  24. ZTControl showControl = dicControl[value];
  25. showControl.Active();
  26. //showControl.AiveContro();
  27. if (String.IsNullOrWhiteSpace(stationId) == false && stationId != value)
  28. {
  29. ZTControl hideControl = dicControl[stationId];
  30. if (hideControl != null)
  31. hideControl.DeActive();
  32. }
  33. stationId = value;
  34. }
  35. get { return stationId; }
  36. }
  37. public ElectricalForm()
  38. {
  39. InitializeComponent();
  40. dicControl.Add("MHS_FDC", this.syz_mhs1);
  41. dicControl.Add("SBQ_FDC", this.syz_sbq1);
  42. dicControl.Add("XS_FDC", this.syz_xs1);
  43. dicControl.Add("NSS_FDC", this.syz_nss1);
  44. dicControl.Add("QS_FDC", this.syz_qs1);
  45. this.StationId = NavService.Instance.StationId;
  46. }
  47. public override void Active()
  48. {
  49. this.Show();
  50. ZTControl showControl = dicControl[stationId];
  51. showControl.Active();
  52. }
  53. public override void DeActive()
  54. {
  55. this.Hide();
  56. ZTControl showControl = dicControl[stationId];
  57. showControl.DeActive();
  58. }
  59. public override void SelectedStationChanged(string stationId)
  60. {
  61. this.StationId = stationId;
  62. }
  63. }
  64. }