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