TempCorrectionEditViewModel.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. using Aitex.Core.RT.SCCore;
  2. using Caliburn.Micro;
  3. using Caliburn.Micro.Core;
  4. using MECF.Framework.Common.DataCenter;
  5. using MECF.Framework.Common.OperationCenter;
  6. using MECF.Framework.Common.RecipeCenter;
  7. using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig;
  8. using MECF.Framework.UI.Client.CenterViews.Dialogs;
  9. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  10. using MECF.Framework.UI.Client.ClientBase;
  11. using OpenSEMI.ClientBase;
  12. using System;
  13. using System.Collections.Generic;
  14. using System.Collections.ObjectModel;
  15. using System.IO;
  16. using System.Linq;
  17. using System.Text;
  18. using System.Windows;
  19. //using System.Windows.Forms;
  20. using System.Windows.Controls;
  21. using FurnaceUI.Client;
  22. using FurnaceUI.Models;
  23. using FurnaceUI.Views.Editors;
  24. using Aitex.Core.Util;
  25. using Aitex.Core.Common.DeviceData;
  26. using MECF.Framework.UI.Client.CenterViews.Parameter;
  27. using MECF.Framework.Common.ParameterCenter;
  28. using RecipeEditorLib.RecipeModel.Params;
  29. using SciChart.Charting.Common.Extensions;
  30. namespace FurnaceUI.Views.Parameter
  31. {
  32. public class TempCorrectionEditViewModel : FurnaceUIViewModelBase
  33. {
  34. private UIElement _parent;
  35. enum ShowPanel
  36. {
  37. Table,
  38. AutoSelect
  39. }
  40. public void SetParent(UIElement parent)
  41. {
  42. _parent = parent;
  43. }
  44. private readonly ParameterProvider _parameterProvider = new ParameterProvider();
  45. private Dictionary<string, ObservableCollection<ParameterTemplateColumnBase>> ParameterTemplate;
  46. public TempCorrectionParameterData CurrentParameter { get; set; } = new TempCorrectionParameterData();
  47. private ParameterFormatBuilder _columnBuilder = new ParameterFormatBuilder();
  48. private TempCorrectionTable _selectedParameterStep;
  49. public TempCorrectionTable SelectedParameterStep
  50. {
  51. get => _selectedParameterStep;
  52. set
  53. {
  54. if (value != null)
  55. {
  56. _selectedParameterStep = value;
  57. NotifyOfPropertyChange("SelectedParameterStep");
  58. }
  59. else
  60. {
  61. _selectedParameterStep = null;
  62. NotifyOfPropertyChange("SelectedParameterStep");
  63. }
  64. }
  65. }
  66. private int _IndexNoDefault = -1;
  67. public int IndexNoDefault
  68. {
  69. get { return _IndexNoDefault; }
  70. set
  71. {
  72. _IndexNoDefault = value;
  73. NotifyOfPropertyChange("IndexNoDefault");
  74. }
  75. }
  76. private bool _appendStepItemIsEnabled;
  77. public bool AppendStepItemIsEnabled
  78. {
  79. get => _appendStepItemIsEnabled;
  80. set
  81. {
  82. _appendStepItemIsEnabled = value;
  83. NotifyOfPropertyChange("AppendStepItemIsEnabled");
  84. }
  85. }
  86. private bool _overWriteCopyIsEnabled;
  87. public bool OverWriteCopyIsEnabled
  88. {
  89. get => _overWriteCopyIsEnabled;
  90. set
  91. {
  92. _overWriteCopyIsEnabled = value;
  93. NotifyOfPropertyChange("OverWriteCopyIsEnabled");
  94. }
  95. }
  96. private bool _insertCopyIsEnabled;
  97. public bool InsertCopyIsEnabled
  98. {
  99. get => _insertCopyIsEnabled;
  100. set
  101. {
  102. _insertCopyIsEnabled = value;
  103. NotifyOfPropertyChange("InsertCopyIsEnabled");
  104. }
  105. }
  106. private bool _prevStepOverwriteIsEnabled;
  107. public bool PrevStepOverwriteIsEnabled
  108. {
  109. get => _prevStepOverwriteIsEnabled;
  110. set
  111. {
  112. _prevStepOverwriteIsEnabled = value;
  113. NotifyOfPropertyChange("PrevStepOverwriteIsEnabled");
  114. }
  115. }
  116. private bool _prevStepInsertIsEnabled;
  117. public bool PrevStepInsertIsEnabled
  118. {
  119. get => _prevStepInsertIsEnabled;
  120. set
  121. {
  122. _prevStepInsertIsEnabled = value;
  123. NotifyOfPropertyChange("PrevStepInsertIsEnabled");
  124. }
  125. }
  126. private bool _prevStepItemIsEnabled;
  127. public bool PrevStepItemIsEnabled
  128. {
  129. get => _prevStepItemIsEnabled;
  130. set
  131. {
  132. _prevStepItemIsEnabled = value;
  133. NotifyOfPropertyChange("PrevStepItemIsEnabled");
  134. }
  135. }
  136. private bool _currStepDeleteIsEnabled;
  137. public bool CurrStepDeleteIsEnabled
  138. {
  139. get => _currStepDeleteIsEnabled;
  140. set
  141. {
  142. _currStepDeleteIsEnabled = value;
  143. NotifyOfPropertyChange("CurrStepDeleteIsEnabled");
  144. }
  145. }
  146. private bool _multStepsDeleteIsEnabled;
  147. public bool MultStepsDeleteIsEnabled
  148. {
  149. get => _multStepsDeleteIsEnabled;
  150. set
  151. {
  152. _multStepsDeleteIsEnabled = value;
  153. NotifyOfPropertyChange("MultStepsDeleteIsEnabled");
  154. }
  155. }
  156. private bool _settingButtonEnable;
  157. public bool SettingButtonEnable
  158. {
  159. get => _settingButtonEnable;
  160. set
  161. {
  162. _settingButtonEnable = value;
  163. NotifyOfPropertyChange("SettingButtonEnable");
  164. }
  165. }
  166. private string _eventSetting;
  167. public string EventSetting
  168. {
  169. get => _eventSetting;
  170. set
  171. {
  172. _eventSetting = value;
  173. NotifyOfPropertyChange("EventSetting");
  174. }
  175. }
  176. private bool _isEnable;
  177. public bool IsEnable
  178. {
  179. get { return _isEnable; }
  180. set { _isEnable = value; this.NotifyOfPropertyChange(nameof(IsEnable)); }
  181. }
  182. public string EditRecipeStepName { get; set; }
  183. private RecipeDataBase _CurrentRecipe;
  184. public RecipeDataBase CurrentRecipe
  185. {
  186. get { return _CurrentRecipe; }
  187. set { _CurrentRecipe = value; this.NotifyOfPropertyChange(nameof(CurrentRecipe)); }
  188. }
  189. private bool _autoSelectIsEnabled = true;
  190. public bool AutoSelectIsEnabled
  191. {
  192. get => _autoSelectIsEnabled;
  193. set
  194. {
  195. _autoSelectIsEnabled = value;
  196. NotifyOfPropertyChange("AutoSelectIsEnabled");
  197. }
  198. }
  199. private bool _cboAutoSelectChecked;
  200. public bool CboAutoSelectChecked
  201. {
  202. get => _cboAutoSelectChecked;
  203. set
  204. {
  205. _cboAutoSelectChecked = value;
  206. NotifyOfPropertyChange("CboAutoSelectChecked");
  207. }
  208. }
  209. public string FullFileName { get; set; }
  210. public void SetCmdIsEnabled()
  211. {
  212. if (CurrentParameter.Steps == null || CurrentParameter.Steps.Count == 0)
  213. {
  214. SelectedParameterStep = null;
  215. AppendStepItemIsEnabled = true;
  216. OverWriteCopyIsEnabled = false;
  217. InsertCopyIsEnabled = false;
  218. PrevStepOverwriteIsEnabled = false;
  219. PrevStepInsertIsEnabled = false;
  220. PrevStepItemIsEnabled = false;
  221. CurrStepDeleteIsEnabled = false;
  222. MultStepsDeleteIsEnabled = false;
  223. SettingButtonEnable = false;
  224. }
  225. }
  226. public int SelectedStepNo { get; set; }
  227. private List<ConfigNode> _ConfigNodes = new List<ConfigNode>();
  228. public List<ConfigNode> ConfigNodes
  229. {
  230. get { return _ConfigNodes; }
  231. set { _ConfigNodes = value; NotifyOfPropertyChange("ConfigNodes"); }
  232. }
  233. public string ParameterType { get; set; }
  234. private Visibility _autoSelectVisibility = Visibility.Hidden;
  235. public Visibility AutoSelectVisibility
  236. {
  237. get => _autoSelectVisibility;
  238. set
  239. {
  240. _autoSelectVisibility = value;
  241. NotifyOfPropertyChange("AutoSelectVisibility");
  242. }
  243. }
  244. private Visibility _tableVisibility = Visibility.Visible;
  245. public Visibility TableVisibility
  246. {
  247. get => _tableVisibility;
  248. set
  249. {
  250. _tableVisibility = value;
  251. NotifyOfPropertyChange("TableVisibility");
  252. }
  253. }
  254. private bool _isEnabledControl = true;
  255. public bool IsEnabledControl
  256. {
  257. get => _isEnabledControl;
  258. set
  259. {
  260. _isEnabledControl = value;
  261. NotifyOfPropertyChange("IsEnabledControl");
  262. }
  263. }
  264. public TempCorrectionEditViewModel(string strPrefixPath, string strRecipeName, string permission = "")
  265. {
  266. _parameterProvider.GetParameterFormatXml(strPrefixPath);
  267. ParameterTemplate = _parameterProvider.GetGroupParameterTemplate();
  268. _columnBuilder.Build(strPrefixPath);
  269. CurrentParameter.PrefixPath = strPrefixPath;
  270. CurrentParameter.Name = strRecipeName;
  271. CurrentParameter.Permission = permission;
  272. }
  273. public TempCorrectionEditViewModel()
  274. {
  275. _parameterProvider.GetParameterFormatXml($"Parameter\\TempCorrection");
  276. ParameterTemplate = _parameterProvider.GetGroupParameterTemplate();
  277. _columnBuilder.Build($"Parameter\\TempCorrection");
  278. CurrentParameter.PrefixPath = $"Parameter\\TempCorrection";
  279. }
  280. protected override void OnViewLoaded(object view)
  281. {
  282. base.OnViewLoaded(view);
  283. }
  284. protected override void OnActivate()
  285. {
  286. base.OnActivate();
  287. }
  288. protected override void OnDeactivate(bool close)
  289. {
  290. base.OnDeactivate(close);
  291. InvokeClient.Instance.Service.DoOperation($"PM1.SetSensorPROCManualOK", "");
  292. }
  293. protected override void OnInitialize()
  294. {
  295. base.OnInitialize();
  296. // GetHeaderConfig();
  297. LoadData();
  298. LoadViewData();
  299. SetCmdIsEnabled();
  300. IsEnable = IsManualSet == true ? IsManualSet : CGlobal.RecipeProcessEditViewEnable;
  301. }
  302. public void SetValue(object sender, string isFullKeyboard = "")
  303. {
  304. string value = ((TextBox)sender).Text;
  305. if (!string.IsNullOrEmpty(isFullKeyboard))
  306. {
  307. FullKeyboard fullKeyboard1 = new FullKeyboard("", value);
  308. if ((bool)fullKeyboard1.ShowDialog())
  309. {
  310. ((TextBox)sender).Text = fullKeyboard1.ValueString;
  311. }
  312. }
  313. else
  314. {
  315. NumberKeyboard fullKeyboard = new NumberKeyboard("", value);
  316. if ((bool)fullKeyboard.ShowDialog())
  317. {
  318. ((TextBox)sender).Text = fullKeyboard.ValueString;
  319. }
  320. }
  321. }
  322. private void LoadData()
  323. {
  324. if (CurrentRecipe != null)
  325. {
  326. CurrentParameter.PrefixPath = $"Parameter\\TempCorrection";
  327. StringParam tempCorrection = CurrentRecipe.ConfigItems.FirstOrDefault(x => x.Name == "Combination.TempCorrection") as StringParam;
  328. if (tempCorrection != null && !string.IsNullOrEmpty(tempCorrection.Value))
  329. {
  330. CurrentParameter.Name = tempCorrection.Value;
  331. CurrentParameter.Permission = "";
  332. FullFileName = $"{CurrentParameter.PrefixPath}\\{CurrentParameter.Name}";
  333. }
  334. else
  335. {
  336. DialogBox.ShowDialog(DialogButton.Cancel, DialogType.INFO, "Please set the Combination default Temp Correction file!");
  337. return;
  338. }
  339. }
  340. if (string.IsNullOrEmpty(CurrentParameter.Name) && CurrentRecipe == null)
  341. {
  342. var defaultTempCorrectionFile = (string)QueryDataClient.Instance.Service.GetConfig("PM1.TempCorrection");
  343. if (!string.IsNullOrEmpty(defaultTempCorrectionFile))
  344. {
  345. CurrentParameter.Name = defaultTempCorrectionFile.Split('\\').LastOrDefault();
  346. }
  347. }
  348. var recipeContent = _parameterProvider.LoadParameter(CurrentParameter.PrefixPath, CurrentParameter.Name);
  349. if (string.IsNullOrEmpty(recipeContent))
  350. {
  351. System.Windows.MessageBox.Show($"{CurrentParameter.PrefixPath}\\{CurrentParameter.Name} is empty, please confirm the file is valid.");
  352. return;
  353. }
  354. CurrentParameter.TableNumber = _columnBuilder.TableNumber;
  355. CurrentParameter.ChamberType = _columnBuilder.ChamberType;
  356. CurrentParameter.InitData(CurrentParameter.PrefixPath, CurrentParameter.Name, recipeContent, "");
  357. if (!IsEnabledControl)
  358. {
  359. AutoSelectVisibility = Visibility.Visible;
  360. if (string.IsNullOrEmpty(ResultString) || !ResultString.Contains(":"))
  361. {
  362. SetShowPanel(ShowPanel.AutoSelect);
  363. CboAutoSelectChecked = true;
  364. AutoSelectIsEnabled = false;
  365. }
  366. else
  367. {
  368. SetShowPanel(ShowPanel.Table);
  369. CboAutoSelectChecked = false;
  370. AutoSelectIsEnabled = true;
  371. var no = Convert.ToInt32(ResultString.Split(':')[0]);
  372. var selecttable = CurrentParameter.Steps.Where(x => x.StepNo == no).FirstOrDefault();
  373. selecttable.IsChecked = true;
  374. SelectTable(selecttable);
  375. }
  376. }
  377. else
  378. {
  379. AutoSelectVisibility = Visibility.Hidden;
  380. SetShowPanel(ShowPanel.AutoSelect);
  381. CboAutoSelectChecked = true;
  382. AutoSelectIsEnabled = false;
  383. }
  384. }
  385. private void SetShowPanel(ShowPanel showPanel)
  386. {
  387. switch (showPanel)
  388. {
  389. case ShowPanel.Table:
  390. TableVisibility = Visibility.Visible;
  391. break;
  392. case ShowPanel.AutoSelect:
  393. TableVisibility = Visibility.Hidden;
  394. break;
  395. default:
  396. break;
  397. }
  398. }
  399. private void LoadViewData()
  400. {
  401. if (CurrentParameter.Steps != null && CurrentParameter.Steps.Count > 0 && SelectedParameterStep == null)
  402. {
  403. SelectedStepNo = CurrentParameter.Steps[0].StepNo;
  404. var step = CurrentParameter.Steps[0];
  405. if (!string.IsNullOrEmpty(ResultString))
  406. {
  407. var strList = ResultString.Split(',');
  408. var selecteNo = strList.Skip(1).Take(1).FirstOrDefault();
  409. // var selectedName = strList.LastOrDefault();
  410. if (selecteNo != null)
  411. {
  412. SelectedStepNo = int.Parse(selecteNo);
  413. step = CurrentParameter.Steps.Where(a => a.StepNo.Equals(SelectedStepNo)).FirstOrDefault();
  414. //if (!string.IsNullOrEmpty(selectedName))
  415. //{
  416. // step.Name = selectedName;
  417. //}
  418. }
  419. }
  420. SelectTable(step);
  421. }
  422. }
  423. private void RecipeGasPanelSettingViewModel_ChangedStepEvent(Step step)
  424. {
  425. SelectTable(step);
  426. IndexNoDefault = step.StepNo - 1;
  427. }
  428. public void SelectTable(object step)
  429. {
  430. if (step != null && step is TempCorrectionTable step1)
  431. {
  432. var SelectedStep = this.CurrentParameter.Steps.Where(x => x.StepNo == step1.StepNo).FirstOrDefault();
  433. SelectedStep.IsChecked = true;
  434. SelectedStepNo = step1.StepNo;
  435. string strName = step1.Name.Trim();
  436. SelectedParameterStep = (TempCorrectionTable)SelectedStep;
  437. }
  438. SetShowPanel(ShowPanel.Table);
  439. SetCmdIsEnabled();
  440. AutoSelectIsEnabled = true;
  441. CboAutoSelectChecked = false;
  442. }
  443. private void OverWriteStep()
  444. {
  445. var windowManager = IoC.Get<IWindowManager>();
  446. if (CurrentParameter == null) return;
  447. }
  448. public void InsertPrevStep()
  449. {
  450. }
  451. public void InsertCopyStep()
  452. {
  453. var windowManager = IoC.Get<IWindowManager>();
  454. if (CurrentParameter == null) return;
  455. }
  456. //撤销修改
  457. public void RecipeIsChangeClick(object cmdName, object value)
  458. {
  459. var windowManager = IoC.Get<IWindowManager>();
  460. }
  461. public void TempSetClick(object sender)
  462. {
  463. string stSetValue = ShowNumberKeyboard(sender as Button, "");
  464. }
  465. public void RampSetClick(object sender)
  466. {
  467. string strSetRamp = ShowNumberKeyboard(sender as Button, "");
  468. }
  469. private string ShowNumberKeyboard(Control control, string defaultValue)
  470. {
  471. NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
  472. var point = control.PointFromScreen(new Point(0, 0));
  473. double wx = SystemParameters.WorkArea.Width;
  474. double hy = SystemParameters.WorkArea.Height;
  475. if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
  476. {
  477. numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
  478. }
  479. else
  480. {
  481. numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
  482. }
  483. if (-point.X + numberKeyboard.Width < wx)
  484. {
  485. numberKeyboard.Left = -point.X;
  486. }
  487. else
  488. {
  489. numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
  490. }
  491. if ((bool)numberKeyboard.ShowDialog())
  492. return numberKeyboard.ValueString;
  493. else
  494. return "Cancel";
  495. }
  496. public void TempTextClick(string type, object sender)
  497. {
  498. var windowManager = IoC.Get<IWindowManager>();
  499. switch (type)
  500. {
  501. case "Mode":
  502. RecipeTempModeViewModel recipeTempModeViewModel = new RecipeTempModeViewModel();
  503. var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempModeViewModel, null, "Temp Mode");
  504. break;
  505. case "Correct":
  506. TempOffsetTableViewModel tempOffsetTableViewModel = new TempOffsetTableViewModel();
  507. break;
  508. case "PID":
  509. TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
  510. break;
  511. default:
  512. break;
  513. }
  514. }
  515. public void TempTextChanged(string type, object sender, object item)
  516. {
  517. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  518. {
  519. TempSetData tempData = (TempSetData)item;
  520. string value = ((TextBox)sender).Text;
  521. int stepNo = SelectedParameterStep.StepNo;
  522. var step = CurrentParameter.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault();
  523. }
  524. }
  525. public bool IsManualSet { get; set; }
  526. private string _resultString;
  527. public string ResultString
  528. {
  529. get => _resultString;
  530. set
  531. {
  532. _resultString = value;
  533. NotifyOfPropertyChange("ResultString");
  534. }
  535. }
  536. public void ParameterDownload()
  537. {
  538. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You are sure to set these parameters?") == DialogButton.No)
  539. return;
  540. var step = CurrentParameter.Steps.FirstOrDefault(x => x.IsChecked);
  541. InvokeClient.Instance.Service.DoOperation($"PM1.Heater.SetCorrect", $"{CurrentParameter.PrefixPath}\\{CurrentParameter.Name},{step.StepNo},{step.Name}");
  542. }
  543. public void ParameterUnload()
  544. {
  545. }
  546. public void ParameterSave()
  547. {
  548. var SelectedStep = this.CurrentParameter.Steps.Where(x => x.StepNo == SelectedStepNo).FirstOrDefault();
  549. if (IsEnabledControl)
  550. {
  551. List<string> names = new List<string>();
  552. string filmFormula = string.Empty;
  553. ParameterTable step = CurrentParameter.Steps.Where(x => x.StepNo == SelectedParameterStep.StepNo).FirstOrDefault();
  554. this.CurrentParameter.Revisor = BaseApp.Instance.UserContext.LoginName;
  555. this.CurrentParameter.ReviseTime = DateTime.Now;
  556. this.CurrentParameter.Level = this.LevelDisplay;
  557. var result = this._parameterProvider.SaveParameter(CurrentParameter.PrefixPath, CurrentParameter.Name, CurrentParameter.GetXmlString());
  558. if (result)
  559. ((Window)GetView()).DialogResult = true;
  560. }
  561. else
  562. {
  563. if (!CboAutoSelectChecked)
  564. {
  565. var step = CurrentParameter.Steps.FirstOrDefault(x => x.IsChecked);
  566. if (step != null)
  567. {
  568. ResultString = $"{FullFileName},{step.StepNo},{step.Name}";
  569. }
  570. else
  571. {
  572. ResultString = $"{FullFileName},{SelectedParameterStep.StepNo},{SelectedParameterStep.Name}";
  573. }
  574. }
  575. ((Window)GetView()).DialogResult = true;
  576. }
  577. }
  578. public void ParameterCancel()
  579. {
  580. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  581. return;
  582. ((Window)GetView()).DialogResult = false;
  583. }
  584. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  585. {
  586. base.InvokeAfterUpdateProperty(data);
  587. if (CurrentParameter.Steps != null && CurrentParameter.Steps.Count > 0 && CheckValueChange(data))
  588. {
  589. }
  590. oldresult = data;
  591. }
  592. Dictionary<string, object> oldresult;
  593. private bool CheckValueChange(Dictionary<string, object> result)
  594. {
  595. Dictionary<string, object> temp = result;
  596. if (oldresult == null)
  597. {
  598. oldresult = result;
  599. return true;
  600. }
  601. else
  602. {
  603. List<string> strkeys = new List<string>();
  604. foreach (var key in result.Keys)
  605. {
  606. if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
  607. {
  608. if (result[key].GetType() == typeof(AITValveData) && ((AITValveData)oldresult[key]).VirtualFeedback != ((AITValveData)result[key]).VirtualFeedback)
  609. {
  610. return true;
  611. }
  612. else if (result[key].GetType() == typeof(AITMfcData) && ((AITMfcData)oldresult[key]).VirtualSetPoint != ((AITMfcData)result[key]).VirtualSetPoint)
  613. {
  614. return true;
  615. }
  616. else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] != (bool)result[key])
  617. {
  618. return true;
  619. }
  620. }
  621. }
  622. }
  623. return false;
  624. }
  625. public void AutoSelectClick(object sender)
  626. {
  627. if (sender is CheckBox)
  628. {
  629. if ((bool)((CheckBox)sender).IsChecked)
  630. {
  631. AutoSelectIsEnabled = false;
  632. CurrentParameter.Steps.Select(step => step.IsChecked = false);
  633. SetShowPanel(ShowPanel.AutoSelect);
  634. ResultString = "Auto";
  635. }
  636. }
  637. }
  638. }
  639. }