WpfWindturbine8ZT.xaml.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace IntelligentControlForsx.MyControls
  16. {
  17. /// <summary>
  18. /// WpfWindturbine.xaml 的交互逻辑
  19. /// </summary>
  20. public partial class WpfWindturbine8ZT : UserControl
  21. {
  22. public WpfWindturbine8ZT()
  23. {
  24. InitializeComponent();
  25. this.WState = 1;
  26. }
  27. public static readonly DependencyProperty StateProperty =
  28. DependencyProperty.Register("WState", typeof(int), typeof(WpfWindturbine));
  29. public int WState
  30. {
  31. get { return (int)GetValue(StateProperty); }
  32. set
  33. {
  34. //this.Dispatcher.Invoke(new Action(delegate {
  35. // //这里写代码
  36. SetValue(StateProperty, value);
  37. //}));
  38. switch (value)
  39. {
  40. // 0-停机-TJTS、 1-上电-SDTS、2-待机-DJTS、3-启动-QDTS、4-并网-BWTS、5-故障-GZTS、6-维护-WHTS、 7-离线-LXTS
  41. case 0:
  42. VisualStateManager.GoToState(this, "Stop", false);
  43. break;
  44. case 1:
  45. VisualStateManager.GoToState(this, "OnPower", true);
  46. break;
  47. case 2:
  48. VisualStateManager.GoToState(this, "Standby", false);
  49. break;
  50. case 3:
  51. VisualStateManager.GoToState(this, "Start", false);
  52. break;
  53. case 4:
  54. VisualStateManager.GoToState(this, "Online", false);
  55. break;
  56. case 5:
  57. VisualStateManager.GoToState(this, "Fault", false);
  58. break;
  59. case 6:
  60. VisualStateManager.GoToState(this, "Maintain", false);
  61. break;
  62. default:
  63. VisualStateManager.GoToState(this, "Offline", false);
  64. break;
  65. }
  66. }
  67. }
  68. /// <summary>
  69. /// 测点编码
  70. /// </summary>
  71. [Browsable(true), Category("Appearance")]
  72. public string TestPointId
  73. {
  74. get;
  75. set;
  76. }
  77. /// <summary>
  78. /// 统一编码
  79. /// </summary>
  80. [Browsable(true), Category("Appearance")]
  81. public string UniformCode
  82. {
  83. get;
  84. set;
  85. }
  86. /// <summary>
  87. /// 风机编码
  88. /// </summary>
  89. [Browsable(true), Category("Appearance")]
  90. public string WindTurbineId
  91. {
  92. get;
  93. set;
  94. }
  95. /// <summary>
  96. /// 风场编码
  97. /// </summary>
  98. [Browsable(true), Category("Appearance")]
  99. public string WindPowerId
  100. {
  101. get;
  102. set;
  103. }
  104. public event EventHandler MyClick;
  105. public event EventHandler MyMouseEnter;
  106. public event EventHandler MyMouseLeave;
  107. private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
  108. {
  109. if (MyClick != null)
  110. {
  111. MyClick(this, e);
  112. }
  113. }
  114. private void Grid_MouseEnter_1(object sender, MouseEventArgs e)
  115. {
  116. if (MyMouseEnter != null)
  117. {
  118. MyMouseEnter(this, e);
  119. }
  120. }
  121. private void Grid_MouseLeave_1(object sender, MouseEventArgs e)
  122. {
  123. if (MyMouseLeave != null)
  124. {
  125. MyMouseLeave(this, e);
  126. }
  127. }
  128. }
  129. }