TempCorrectionEditViewModel.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  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. var fileName = defaultTempCorrectionFile.Split('\\').LastOrDefault();
  347. CurrentParameter.Name = fileName.Split(',').FirstOrDefault();
  348. }
  349. }
  350. var recipeContent = _parameterProvider.LoadParameter(CurrentParameter.PrefixPath, CurrentParameter.Name);
  351. if (string.IsNullOrEmpty(recipeContent))
  352. {
  353. System.Windows.MessageBox.Show($"{CurrentParameter.PrefixPath}\\{CurrentParameter.Name} is empty, please confirm the file is valid.");
  354. return;
  355. }
  356. CurrentParameter.TableNumber = _columnBuilder.TableNumber;
  357. CurrentParameter.ChamberType = _columnBuilder.ChamberType;
  358. CurrentParameter.InitData(CurrentParameter.PrefixPath, CurrentParameter.Name, recipeContent, "");
  359. if (!IsEnabledControl)
  360. {
  361. AutoSelectVisibility = Visibility.Visible;
  362. if (string.IsNullOrEmpty(ResultString) || !ResultString.Contains(":"))
  363. {
  364. SetShowPanel(ShowPanel.AutoSelect);
  365. CboAutoSelectChecked = true;
  366. AutoSelectIsEnabled = false;
  367. }
  368. else
  369. {
  370. SetShowPanel(ShowPanel.Table);
  371. CboAutoSelectChecked = false;
  372. AutoSelectIsEnabled = true;
  373. var no = Convert.ToInt32(ResultString.Split(':')[0]);
  374. var selecttable = CurrentParameter.Steps.Where(x => x.StepNo == no).FirstOrDefault();
  375. selecttable.IsChecked = true;
  376. SelectTable(selecttable);
  377. }
  378. }
  379. else
  380. {
  381. AutoSelectVisibility = Visibility.Hidden;
  382. SetShowPanel(ShowPanel.AutoSelect);
  383. CboAutoSelectChecked = true;
  384. AutoSelectIsEnabled = false;
  385. }
  386. }
  387. private void SetShowPanel(ShowPanel showPanel)
  388. {
  389. switch (showPanel)
  390. {
  391. case ShowPanel.Table:
  392. TableVisibility = Visibility.Visible;
  393. break;
  394. case ShowPanel.AutoSelect:
  395. TableVisibility = Visibility.Hidden;
  396. break;
  397. default:
  398. break;
  399. }
  400. }
  401. private void LoadViewData()
  402. {
  403. if (CurrentParameter.Steps != null && CurrentParameter.Steps.Count > 0 && SelectedParameterStep == null)
  404. {
  405. SelectedStepNo = CurrentParameter.Steps[0].StepNo;
  406. var step = CurrentParameter.Steps[0];
  407. if (!string.IsNullOrEmpty(ResultString))
  408. {
  409. var strList = ResultString.Split(',');
  410. var selecteNo = strList.Skip(1).Take(1).FirstOrDefault();
  411. // var selectedName = strList.LastOrDefault();
  412. if (selecteNo != null)
  413. {
  414. SelectedStepNo = int.Parse(selecteNo);
  415. step = CurrentParameter.Steps.Where(a => a.StepNo.Equals(SelectedStepNo)).FirstOrDefault();
  416. //if (!string.IsNullOrEmpty(selectedName))
  417. //{
  418. // step.Name = selectedName;
  419. //}
  420. }
  421. }
  422. SelectTable(step);
  423. }
  424. }
  425. private void RecipeGasPanelSettingViewModel_ChangedStepEvent(Step step)
  426. {
  427. SelectTable(step);
  428. IndexNoDefault = step.StepNo - 1;
  429. }
  430. public void SelectTable(object step)
  431. {
  432. if (step != null && step is TempCorrectionTable step1)
  433. {
  434. var SelectedStep = this.CurrentParameter.Steps.Where(x => x.StepNo == step1.StepNo).FirstOrDefault();
  435. SelectedStep.IsChecked = true;
  436. SelectedStepNo = step1.StepNo;
  437. string strName = step1.Name.Trim();
  438. SelectedParameterStep = (TempCorrectionTable)SelectedStep;
  439. }
  440. SetShowPanel(ShowPanel.Table);
  441. SetCmdIsEnabled();
  442. AutoSelectIsEnabled = true;
  443. CboAutoSelectChecked = false;
  444. }
  445. private void OverWriteStep()
  446. {
  447. var windowManager = IoC.Get<IWindowManager>();
  448. if (CurrentParameter == null) return;
  449. }
  450. public void InsertPrevStep()
  451. {
  452. }
  453. public void InsertCopyStep()
  454. {
  455. var windowManager = IoC.Get<IWindowManager>();
  456. if (CurrentParameter == null) return;
  457. }
  458. //撤销修改
  459. public void RecipeIsChangeClick(object cmdName, object value)
  460. {
  461. var windowManager = IoC.Get<IWindowManager>();
  462. }
  463. public void TempSetClick(object sender)
  464. {
  465. string stSetValue = ShowNumberKeyboard(sender as Button, "");
  466. }
  467. public void RampSetClick(object sender)
  468. {
  469. string strSetRamp = ShowNumberKeyboard(sender as Button, "");
  470. }
  471. private string ShowNumberKeyboard(Control control, string defaultValue)
  472. {
  473. NumberKeyboard numberKeyboard = new NumberKeyboard("", defaultValue);
  474. var point = control.PointFromScreen(new Point(0, 0));
  475. double wx = SystemParameters.WorkArea.Width;
  476. double hy = SystemParameters.WorkArea.Height;
  477. if (-point.Y + control.ActualHeight + 5 + numberKeyboard.Height < hy)
  478. {
  479. numberKeyboard.Top = -point.Y + control.ActualHeight + 5;
  480. }
  481. else
  482. {
  483. numberKeyboard.Top = -point.Y - numberKeyboard.Height - 5;
  484. }
  485. if (-point.X + numberKeyboard.Width < wx)
  486. {
  487. numberKeyboard.Left = -point.X;
  488. }
  489. else
  490. {
  491. numberKeyboard.Left = -point.X - (numberKeyboard.Width - control.ActualWidth);
  492. }
  493. if ((bool)numberKeyboard.ShowDialog())
  494. return numberKeyboard.ValueString;
  495. else
  496. return "Cancel";
  497. }
  498. public void TempTextClick(string type, object sender)
  499. {
  500. var windowManager = IoC.Get<IWindowManager>();
  501. switch (type)
  502. {
  503. case "Mode":
  504. RecipeTempModeViewModel recipeTempModeViewModel = new RecipeTempModeViewModel();
  505. var rtn = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeTempModeViewModel, null, "Temp Mode");
  506. break;
  507. case "Correct":
  508. TempOffsetTableViewModel tempOffsetTableViewModel = new TempOffsetTableViewModel();
  509. break;
  510. case "PID":
  511. TempOffsetTableViewModel tempOffsetTableViewModel1 = new TempOffsetTableViewModel();
  512. break;
  513. default:
  514. break;
  515. }
  516. }
  517. public void TempTextChanged(string type, object sender, object item)
  518. {
  519. if (!string.IsNullOrEmpty(type) && item != null && sender != null)
  520. {
  521. TempSetData tempData = (TempSetData)item;
  522. string value = ((TextBox)sender).Text;
  523. int stepNo = SelectedParameterStep.StepNo;
  524. var step = CurrentParameter.Steps.Where(x => x.StepNo == stepNo).FirstOrDefault();
  525. }
  526. }
  527. public bool IsManualSet { get; set; }
  528. private string _resultString;
  529. public string ResultString
  530. {
  531. get => _resultString;
  532. set
  533. {
  534. _resultString = value;
  535. NotifyOfPropertyChange("ResultString");
  536. }
  537. }
  538. public void ParameterDownload()
  539. {
  540. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You are sure to set these parameters?") == DialogButton.No)
  541. return;
  542. var step = CurrentParameter.Steps.FirstOrDefault(x => x.IsChecked);
  543. InvokeClient.Instance.Service.DoOperation($"PM1.Heater.SetCorrect", $"{CurrentParameter.PrefixPath}\\{CurrentParameter.Name},{step.StepNo},{step.Name}");
  544. }
  545. public void ParameterUnload()
  546. {
  547. }
  548. public void ParameterSave()
  549. {
  550. var SelectedStep = this.CurrentParameter.Steps.Where(x => x.StepNo == SelectedStepNo).FirstOrDefault();
  551. if (IsEnabledControl)
  552. {
  553. List<string> names = new List<string>();
  554. string filmFormula = string.Empty;
  555. ParameterTable step = CurrentParameter.Steps.Where(x => x.StepNo == SelectedParameterStep.StepNo).FirstOrDefault();
  556. this.CurrentParameter.Revisor = BaseApp.Instance.UserContext.LoginName;
  557. this.CurrentParameter.ReviseTime = DateTime.Now;
  558. this.CurrentParameter.Level = this.LevelDisplay;
  559. var result = this._parameterProvider.SaveParameter(CurrentParameter.PrefixPath, CurrentParameter.Name, CurrentParameter.GetXmlString());
  560. if (result)
  561. ((Window)GetView()).DialogResult = true;
  562. }
  563. else
  564. {
  565. if (!CboAutoSelectChecked)
  566. {
  567. var step = CurrentParameter.Steps.FirstOrDefault(x => x.IsChecked);
  568. if (step != null)
  569. {
  570. ResultString = $"{FullFileName},{step.StepNo},{step.Name}";
  571. }
  572. else
  573. {
  574. ResultString = $"{FullFileName},{SelectedParameterStep.StepNo},{SelectedParameterStep.Name}";
  575. }
  576. }
  577. ((Window)GetView()).DialogResult = true;
  578. }
  579. }
  580. public void ParameterCancel()
  581. {
  582. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)
  583. return;
  584. ((Window)GetView()).DialogResult = false;
  585. }
  586. protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)
  587. {
  588. base.InvokeAfterUpdateProperty(data);
  589. if (CurrentParameter.Steps != null && CurrentParameter.Steps.Count > 0 && CheckValueChange(data))
  590. {
  591. }
  592. oldresult = data;
  593. }
  594. Dictionary<string, object> oldresult;
  595. private bool CheckValueChange(Dictionary<string, object> result)
  596. {
  597. Dictionary<string, object> temp = result;
  598. if (oldresult == null)
  599. {
  600. oldresult = result;
  601. return true;
  602. }
  603. else
  604. {
  605. List<string> strkeys = new List<string>();
  606. foreach (var key in result.Keys)
  607. {
  608. if (_subscribedKeys.Contains(key) && oldresult.ContainsKey(key) && result.ContainsKey(key))
  609. {
  610. if (result[key].GetType() == typeof(AITValveData) && ((AITValveData)oldresult[key]).VirtualFeedback != ((AITValveData)result[key]).VirtualFeedback)
  611. {
  612. return true;
  613. }
  614. else if (result[key].GetType() == typeof(AITMfcData) && ((AITMfcData)oldresult[key]).VirtualSetPoint != ((AITMfcData)result[key]).VirtualSetPoint)
  615. {
  616. return true;
  617. }
  618. else if (result[key].GetType() == typeof(bool) && (bool)oldresult[key] != (bool)result[key])
  619. {
  620. return true;
  621. }
  622. }
  623. }
  624. }
  625. return false;
  626. }
  627. public void AutoSelectClick(object sender)
  628. {
  629. if (sender is CheckBox)
  630. {
  631. if ((bool)((CheckBox)sender).IsChecked)
  632. {
  633. AutoSelectIsEnabled = false;
  634. CurrentParameter.Steps.Select(step => step.IsChecked = false);
  635. SetShowPanel(ShowPanel.AutoSelect);
  636. ResultString = "Auto";
  637. }
  638. }
  639. }
  640. }
  641. }