DosingControl.xaml.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. using MECF.Framework.Common.CommonData.Reservoir;
  2. using MECF.Framework.Common.OperationCenter;
  3. using MECF.Framework.Common.Persistent.Reservoirs;
  4. using MECF.Framework.Common.RecipeCenter;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Collections.ObjectModel;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Imaging;
  18. using System.Windows.Navigation;
  19. using System.Windows.Shapes;
  20. namespace CyberX8_Themes.UserControls
  21. {
  22. /// <summary>
  23. /// DosingControl.xaml 的交互逻辑
  24. /// </summary>
  25. public partial class DosingControl : UserControl
  26. {
  27. public DosingControl()
  28. {
  29. InitializeComponent();
  30. }
  31. #region 内部变量
  32. private int _menuID;
  33. #endregion
  34. #region 属性
  35. public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
  36. "ModuleName", typeof(string), typeof(DosingControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
  37. /// <summary>
  38. /// 模块名称
  39. /// </summary>
  40. public string ModuleName
  41. {
  42. get
  43. {
  44. return (string)this.GetValue(ModuleNameProperty);
  45. }
  46. set
  47. {
  48. this.SetValue(ModuleNameProperty, value);
  49. }
  50. }
  51. public static readonly DependencyProperty MenuNameProperty = DependencyProperty.Register(
  52. "MenuName", typeof(string), typeof(DosingControl), new FrameworkPropertyMetadata("Counters", FrameworkPropertyMetadataOptions.AffectsRender));
  53. /// <summary>
  54. /// 菜单名称
  55. /// </summary>
  56. public string MenuName
  57. {
  58. get
  59. {
  60. return (string)this.GetValue(MenuNameProperty);
  61. }
  62. set
  63. {
  64. this.SetValue(MenuNameProperty, value);
  65. }
  66. }
  67. public static readonly DependencyProperty ReplenNumProperty = DependencyProperty.Register(
  68. "ReplenNum", typeof(int), typeof(DosingControl), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.AffectsRender));
  69. /// <summary>
  70. /// Replen数量
  71. /// </summary>
  72. public int ReplenNum
  73. {
  74. get
  75. {
  76. return (int)this.GetValue(ReplenNumProperty);
  77. }
  78. set
  79. {
  80. this.SetValue(ReplenNumProperty, value);
  81. }
  82. }
  83. public static readonly DependencyProperty ReplenDatasProperty = DependencyProperty.Register(
  84. "ReplenDatas", typeof(ObservableCollection<ReplenData>), typeof(DosingControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
  85. /// <summary>
  86. /// ReplenDatas
  87. /// </summary>
  88. public ObservableCollection<ReplenData> ReplenDatas
  89. {
  90. get
  91. {
  92. return (ObservableCollection<ReplenData>)this.GetValue(ReplenDatasProperty);
  93. }
  94. set
  95. {
  96. this.SetValue(ReplenDatasProperty, value);
  97. }
  98. }
  99. public static readonly DependencyProperty ReplensPersistentCollectionProperty = DependencyProperty.Register(
  100. "ReplensPersistentCollection", typeof(ObservableCollection<ReplenPersistentValue>), typeof(DosingControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
  101. /// <summary>
  102. /// Replen Persistent数据集合
  103. /// </summary>
  104. public ObservableCollection<ReplenPersistentValue> ReplensPersistentCollection
  105. {
  106. get
  107. {
  108. return (ObservableCollection<ReplenPersistentValue>)this.GetValue(ReplensPersistentCollectionProperty);
  109. }
  110. set
  111. {
  112. this.SetValue(ReplensPersistentCollectionProperty, value);
  113. }
  114. }
  115. public static readonly DependencyProperty IsAutoEnabledProperty = DependencyProperty.Register(
  116. "IsAutoEnabled", typeof(bool), typeof(DosingControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
  117. /// <summary>
  118. /// IsAutoEnabled
  119. /// </summary>
  120. public bool IsAutoEnabled
  121. {
  122. get
  123. {
  124. return (bool)this.GetValue(IsAutoEnabledProperty);
  125. }
  126. set
  127. {
  128. this.SetValue(IsAutoEnabledProperty, value);
  129. }
  130. }
  131. public static readonly DependencyProperty IsDisableProperty = DependencyProperty.Register(
  132. "IsDisableEnabled", typeof(bool), typeof(DosingControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
  133. /// <summary>
  134. /// IsDisableEnabled
  135. /// </summary>
  136. public bool IsDisableEnabled
  137. {
  138. get
  139. {
  140. return (bool)this.GetValue(IsDisableProperty);
  141. }
  142. set
  143. {
  144. this.SetValue(IsDisableProperty, value);
  145. }
  146. }
  147. public static readonly DependencyProperty IsManualorAutoProperty = DependencyProperty.Register(
  148. "IsManualorAuto", typeof(bool), typeof(DosingControl), new FrameworkPropertyMetadata(true, FrameworkPropertyMetadataOptions.AffectsRender));
  149. /// <summary>
  150. /// IsManualorAuto
  151. /// </summary>
  152. public bool IsManualorAuto
  153. {
  154. get
  155. {
  156. return (bool)this.GetValue(IsManualorAutoProperty);
  157. }
  158. set
  159. {
  160. this.SetValue(IsManualorAutoProperty, value);
  161. }
  162. }
  163. public static readonly DependencyProperty SelectedRecipeNodeProperty = DependencyProperty.Register("SelectedRecipeNode", typeof(RecipeNode), typeof(DosingControl));
  164. /// <summary>
  165. /// SelectedReicpe节点
  166. /// </summary>
  167. public RecipeNode SelectedRecipeNode
  168. {
  169. get
  170. {
  171. return (RecipeNode)this.GetValue(SelectedRecipeNodeProperty);
  172. }
  173. set
  174. {
  175. this.SetValue(SelectedRecipeNodeProperty, value);
  176. }
  177. }
  178. public static readonly DependencyProperty SelectedRecipeBufferProperty = DependencyProperty.Register("SelectedRecipeBuffer", typeof(RecipeNode), typeof(DosingControl));
  179. /// <summary>
  180. /// SelectedReicpeBuffer
  181. /// </summary>
  182. public RecipeNode SelectedRecipeBuffer
  183. {
  184. get
  185. {
  186. return (RecipeNode)this.GetValue(SelectedRecipeBufferProperty);
  187. }
  188. set
  189. {
  190. this.SetValue(SelectedRecipeBufferProperty, value);
  191. }
  192. }
  193. #endregion
  194. /// <summary>
  195. /// 前一个Menu
  196. /// </summary>
  197. /// <param name="sender"></param>
  198. /// <param name="e"></param>
  199. private void Prev_Click(object sender, RoutedEventArgs e)
  200. {
  201. if(_menuID > 0)
  202. {
  203. _menuID --;
  204. }
  205. SetMenuVisible(_menuID);
  206. }
  207. /// <summary>
  208. /// 后一个Menu
  209. /// </summary>
  210. /// <param name="sender"></param>
  211. /// <param name="e"></param>
  212. private void Next_Click(object sender, RoutedEventArgs e)
  213. {
  214. if (_menuID < 2)
  215. {
  216. _menuID++;
  217. }
  218. SetMenuVisible(_menuID);
  219. }
  220. /// <summary>
  221. /// 设置Menu的Visibility
  222. /// </summary>
  223. /// <param name="menuID"></param>
  224. private void SetMenuVisible(int menuID)
  225. {
  226. switch (menuID)
  227. {
  228. case 0:
  229. MenuName = "Counters";
  230. Counters.Visibility = Visibility.Visible;
  231. Calibrate.Visibility = Visibility.Collapsed;
  232. Recipes.Visibility = Visibility.Collapsed;
  233. break;
  234. case 1:
  235. MenuName = "Recipes";
  236. Counters.Visibility = Visibility.Collapsed;
  237. Calibrate.Visibility = Visibility.Collapsed;
  238. Recipes.Visibility = Visibility.Visible;
  239. break;
  240. case 2:
  241. MenuName = "Calibrate";
  242. Counters.Visibility = Visibility.Collapsed;
  243. Calibrate.Visibility = Visibility.Visible;
  244. Recipes.Visibility = Visibility.Collapsed;
  245. break;
  246. default:
  247. break;
  248. }
  249. }
  250. }
  251. }