RecipeLayoutViewModel.cs 69 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722
  1. using Aitex.Core.RT.Log;
  2. using Caliburn.Micro;
  3. using Caliburn.Micro.Core;
  4. using FurnaceUI.Common;
  5. using FurnaceUI.Models;
  6. using FurnaceUI.Views.Editors;
  7. using MECF.Framework.Common.DataCenter;
  8. using MECF.Framework.UI.Client.CenterViews.Editors;
  9. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  10. using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
  11. using MECF.Framework.UI.Client.ClientBase;
  12. using OpenSEMI.ClientBase;
  13. using OpenSEMI.ClientBase.Command;
  14. using RecipeEditorLib.RecipeModel.Params;
  15. using SciChart.Core.Extensions;
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Collections.ObjectModel;
  19. using System.Linq;
  20. using System.Windows;
  21. using System.Windows.Input;
  22. namespace FurnaceUI.Views.Recipes
  23. {
  24. public class RecipeLayoutViewModel : FurnaceUIViewModelBase
  25. {
  26. public bool IsPermission { get => this.Permission == 3; }//&& RtStatus != "AutoRunning";
  27. private ICommand _RenameFolderCommand;
  28. public ICommand RenameFolderCommand
  29. {
  30. get
  31. {
  32. if (this._RenameFolderCommand == null)
  33. this._RenameFolderCommand = new BaseCommand(() => this.RenameFolder());
  34. return this._RenameFolderCommand;
  35. }
  36. }
  37. private ICommand _DeleteFolderCommand;
  38. public ICommand DeleteFolderCommand
  39. {
  40. get
  41. {
  42. if (this._DeleteFolderCommand == null)
  43. this._DeleteFolderCommand = new BaseCommand(() => this.DeleteFolder());
  44. return this._DeleteFolderCommand;
  45. }
  46. }
  47. private ICommand _NewFolderCommand;
  48. public ICommand NewFolderCommand
  49. {
  50. get
  51. {
  52. if (this._NewFolderCommand == null)
  53. this._NewFolderCommand = new BaseCommand(() => this.NewFolder());
  54. return this._NewFolderCommand;
  55. }
  56. }
  57. private ICommand _NewFolderRootCommand;
  58. public ICommand NewFolderRootCommand
  59. {
  60. get
  61. {
  62. if (this._NewFolderRootCommand == null)
  63. this._NewFolderRootCommand = new BaseCommand(() => this.NewFolderRoot());
  64. return this._NewFolderRootCommand;
  65. }
  66. }
  67. private ICommand _NewRecipeCommand;
  68. public ICommand NewRecipeCommand
  69. {
  70. get
  71. {
  72. if (this._NewRecipeCommand == null)
  73. this._NewRecipeCommand = new BaseCommand(() => this.NewRecipe());
  74. return this._NewRecipeCommand;
  75. }
  76. }
  77. private ICommand _NewRecipeRootCommand;
  78. public ICommand NewRecipeRootCommand
  79. {
  80. get
  81. {
  82. if (this._NewRecipeRootCommand == null)
  83. this._NewRecipeRootCommand = new BaseCommand(() => this.NewRecipeRoot());
  84. return this._NewRecipeRootCommand;
  85. }
  86. }
  87. private ICommand _RenameRecipeCommand;
  88. public ICommand RenameRecipeCommand
  89. {
  90. get
  91. {
  92. if (this._RenameRecipeCommand == null)
  93. this._RenameRecipeCommand = new BaseCommand(() => this.RenameRecipe());
  94. return this._RenameRecipeCommand;
  95. }
  96. }
  97. private ICommand _DeleteRecipeCommand;
  98. public ICommand DeleteRecipeCommand
  99. {
  100. get
  101. {
  102. if (this._DeleteRecipeCommand == null)
  103. this._DeleteRecipeCommand = new BaseCommand(() => this.DeleteRecipe());
  104. return this._DeleteRecipeCommand;
  105. }
  106. }
  107. private ICommand _SaveAsRecipeCommand;
  108. public ICommand SaveAsRecipeCommand
  109. {
  110. get
  111. {
  112. if (this._SaveAsRecipeCommand == null)
  113. this._SaveAsRecipeCommand = new BaseCommand(() => this.SaveAsRecipe());
  114. return this._SaveAsRecipeCommand;
  115. }
  116. }
  117. private ICommand _EditRecipeCommand;
  118. public ICommand EditRecipeCommand
  119. {
  120. get
  121. {
  122. if (this._EditRecipeCommand == null)
  123. this._EditRecipeCommand = new BaseCommand(() => this.EditRecipe());
  124. return this._EditRecipeCommand;
  125. }
  126. }
  127. private ICommand _SelectRecipeTypeCommand;
  128. public ICommand SelectRecipeTypeCommand
  129. {
  130. get
  131. {
  132. if (this._SelectRecipeTypeCommand == null)
  133. this._SelectRecipeTypeCommand = new BaseCommand(() => this.SelectRecipeType());
  134. return this._SelectRecipeTypeCommand;
  135. }
  136. }
  137. private ICommand _ViewRecipeCommand;
  138. public ICommand ViewRecipeCommand
  139. {
  140. get
  141. {
  142. if (this._ViewRecipeCommand == null)
  143. this._ViewRecipeCommand = new BaseCommand(() => this.ViewRecipe());
  144. return this._ViewRecipeCommand;
  145. }
  146. }
  147. private ICommand _ChangePermission;
  148. public ICommand ChangePermission
  149. {
  150. get
  151. {
  152. if (this._ChangePermission == null)
  153. this._ChangePermission = new BaseCommand(() => this.SavePermission());
  154. return this._ChangePermission;
  155. }
  156. }
  157. private ICommand _ExportRecipeCommand;
  158. public ICommand ExportRecipeCommand
  159. {
  160. get
  161. {
  162. //if (this._ExportRecipeCommand == null)
  163. // this._ExportRecipeCommand = new BaseCommand(() => this.ExportRecipe());
  164. return this._ExportRecipeCommand;
  165. }
  166. }
  167. private ICommand _historyRecipeCommand;
  168. public ICommand HistoryRecipeCommand
  169. {
  170. get
  171. {
  172. //if (this._historyRecipeCommand == null)
  173. // this._historyRecipeCommand = new BaseCommand(() => this.HistoryRecipe());
  174. return this._historyRecipeCommand;
  175. }
  176. }
  177. private List<FileNode> _recipeFileList = new List<FileNode>();
  178. public List<FileNode> RecipeFileList
  179. {
  180. get { return _recipeFileList; }
  181. set { _recipeFileList = value; this.NotifyOfPropertyChange(nameof(RecipeFileList)); }
  182. }
  183. private List<ProcessTypeFileItem> _processTypeFileList = new List<ProcessTypeFileItem>();
  184. public List<ProcessTypeFileItem> ProcessTypeFileList
  185. {
  186. get { return _processTypeFileList; }
  187. set { _processTypeFileList = value; this.NotifyOfPropertyChange(nameof(ProcessTypeFileList)); }
  188. }
  189. public RecipeDataLayout CurrentRecipe { get; private set; }
  190. public FileNode CurrentFileNode { get; set; }
  191. public bool IsCurrentNodePath { get => CurrentFileNode != null; }
  192. public bool IsCurrentNodeFile { get => CurrentFileNode != null && CurrentFileNode.IsFile; }
  193. private bool _isReadAndWritePermission = false;
  194. public bool IsReadAndWritePermission
  195. {
  196. get
  197. {
  198. // _isReadAndWritePermission = IsSelectPermission;
  199. return _isReadAndWritePermission;
  200. }
  201. set
  202. {
  203. _isReadAndWritePermission = value;
  204. NotifyOfPropertyChange(nameof(IsReadAndWritePermission));
  205. }
  206. }
  207. private bool _isFreePermission = false;
  208. public bool IsFreePermission
  209. {
  210. get
  211. {
  212. //_isFreePermission = IsSelectPermission;
  213. return _isFreePermission;
  214. }
  215. set
  216. {
  217. _isFreePermission = value;
  218. NotifyOfPropertyChange(nameof(IsFreePermission));
  219. }
  220. }
  221. private bool _isSelectPermission = false;
  222. public bool IsSelectPermission
  223. {
  224. get
  225. {
  226. _isSelectPermission = LevelDisplay != "LEVEL1" && IsCurrentNodeFile;
  227. return _isSelectPermission;
  228. }
  229. set
  230. {
  231. _isSelectPermission = value;
  232. NotifyOfPropertyChange(nameof(IsSelectPermission));
  233. }
  234. }
  235. public bool IsSingleSelectPermission
  236. {
  237. get => _isSelectPermission && !IsSingleFile;
  238. }
  239. private bool _isEnabledFolderPermission = false;
  240. public bool IsEnabledFolderPermission
  241. {
  242. get
  243. {
  244. _isEnabledFolderPermission = !IsCurrentNodeFile && !IsSingleFile;
  245. return _isEnabledFolderPermission;
  246. }
  247. set
  248. {
  249. _isEnabledFolderPermission = value;
  250. NotifyOfPropertyChange(nameof(IsEnabledFolderPermission));
  251. }
  252. }
  253. private bool _isEnabledNewRecipe = false;
  254. public bool IsEnabledNewRecipe
  255. {
  256. get
  257. {
  258. return _isEnabledNewRecipe;
  259. }
  260. set
  261. {
  262. _isEnabledNewRecipe = value;
  263. NotifyOfPropertyChange(nameof(IsEnabledNewRecipe));
  264. }
  265. }
  266. private bool IsChanged
  267. {
  268. get
  269. {
  270. return editMode == EditMode.Edit || (CurrentRecipe != null && CurrentRecipe.IsChanged);
  271. }
  272. }
  273. private RecipeFormatBuilder _columnBuilder = new RecipeFormatBuilder();
  274. private EditMode editMode;
  275. private RecipeProvider _recipeProvider = new RecipeProvider();
  276. public ObservableCollection<string> ChamberType { get; set; } = new ObservableCollection<string>();
  277. public int ChamberTypeIndexSelection { get; set; }
  278. private int _ProcessTypeIndexSelection;
  279. public int ProcessTypeIndexSelection
  280. {
  281. get
  282. {
  283. return _ProcessTypeIndexSelection;
  284. }
  285. set
  286. {
  287. _ProcessTypeIndexSelection = value;
  288. NotifyOfPropertyChange(nameof(ProcessTypeIndexSelection));
  289. }
  290. }
  291. public string CurrentChamberType
  292. {
  293. get
  294. {
  295. return ChamberType[ChamberTypeIndexSelection];
  296. }
  297. }
  298. public string CurrentProcessType
  299. {
  300. get
  301. {
  302. return ProcessTypeFileList[ProcessTypeIndexSelection].ProcessType;
  303. }
  304. }
  305. public Visibility MultiChamberVisibility
  306. {
  307. get;
  308. set;
  309. }
  310. public Visibility ToleranceVisibility
  311. {
  312. get;
  313. set;
  314. }
  315. public ObservableCollection<string> Chambers { get; set; }
  316. public string SelectedChamber { get; set; }
  317. public object View { get; set; }
  318. private string _SelectRecipeTypeName;
  319. public string SelectRecipeTypeName
  320. {
  321. get
  322. {
  323. return _SelectRecipeTypeName;
  324. }
  325. set
  326. {
  327. _SelectRecipeTypeName = value;
  328. NotifyOfPropertyChange("SelectRecipeTypeName");
  329. }
  330. }
  331. private bool IsSingleFile { get; set; } = false;
  332. protected override void OnInitialize()
  333. {
  334. base.OnInitialize();
  335. InitializeDefault();
  336. }
  337. private void InitializeDefault(bool isLoadOtherData = true)
  338. {
  339. var chamberType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedChamberType");
  340. ChamberType.Clear();
  341. if (chamberType == null)
  342. {
  343. ChamberType.Add("Default");
  344. }
  345. else
  346. {
  347. (((string)(chamberType)).Split(',')).ToList().ForEach(x => ChamberType.Add(x));
  348. }
  349. ChamberTypeIndexSelection = 0;
  350. //Etch:Process,Clean,Chuck,Dechuck;CVD:Process,Clean;
  351. var processType = QueryDataClient.Instance.Service.GetConfig($"System.Recipe.{CurrentMenuID}");
  352. if (processType == null)
  353. {
  354. processType = CurrentMenuID;
  355. }
  356. if (processType == null) processType = "alarm";
  357. string[] recipeProcessType = ((string)processType).Split(',');
  358. for (int i = 0; i < recipeProcessType.Length; i++)
  359. {
  360. var type = new ProcessTypeFileItem();
  361. type.ProcessType = recipeProcessType[i];
  362. var prefix = $"{ChamberType[ChamberTypeIndexSelection]}\\{recipeProcessType[i]}";
  363. // var recipes = _recipeProvider.GetXmlRecipeList(prefix);
  364. type.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList(prefix);// RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
  365. ProcessTypeFileList.Add(type);
  366. if (type.FileListByProcessType?.Count > 0 && !type.FileListByProcessType.Any(r => r.IsSelected))//default
  367. {
  368. type.FileListByProcessType.First().IsSelected = true;
  369. }
  370. RecipeFileList = type.FileListByProcessType.FirstOrDefault()?.Files.ToList();
  371. }
  372. //if (ProcessTypeFileList[0].FileListByProcessType.Count > 0)
  373. // CurrentFileNode = ProcessTypeFileList[0].FileListByProcessType[ProcessTypeFileList[0].FileListByProcessType.Count - 1];
  374. if (isLoadOtherData)
  375. {
  376. SelectRecipeTypeName = processType + " Recipe";
  377. UpdateRecipeFormat();
  378. if (CurrentFileNode != null && CurrentFileNode.IsFile)
  379. {
  380. if (CurrentRecipe != null)
  381. {
  382. CurrentRecipe.PrefixPath = CurrentFileNode.PrefixPath;
  383. CurrentRecipe.Name = CurrentFileNode.FullPath;
  384. }
  385. //this.LoadData(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath);
  386. }
  387. GetRecipeType();
  388. _columnBuilder.Build(CurrentProcessType);
  389. }
  390. }
  391. private void GetRecipeType()
  392. {
  393. var single = QueryDataClient.Instance.Service.GetConfig($"System.Recipe.SingleRecipeFileType");
  394. if (single != null && !string.IsNullOrEmpty((string)single))
  395. {
  396. string[] singleTypes = ((string)single).ToLower().Split(';');
  397. if (singleTypes != null)
  398. {
  399. int findIndex = Array.IndexOf(singleTypes, CurrentMenuID.ToLower());
  400. if (findIndex != -1)
  401. {
  402. CreateDefaultRecipe();
  403. IsSingleFile = true;
  404. }
  405. }
  406. }
  407. }
  408. private void CreateDefaultRecipe()
  409. {
  410. var defaultFileName = QueryDataClient.Instance.Service.GetConfig($"System.Recipe.DefaultFileName");
  411. string fileName = "default";
  412. if (defaultFileName != null && !string.IsNullOrEmpty((string)defaultFileName))
  413. {
  414. fileName = (string)defaultFileName;
  415. }
  416. string recipeName = fileName.Trim();
  417. string description = "";
  418. string prefix = CurrentChamberType + "\\" + CurrentProcessType;
  419. if (!IsExist(recipeName.ToLower(), true))
  420. {
  421. RecipeDataLayout recipe = new RecipeDataLayout();
  422. recipe.Name = recipeName;
  423. recipe.PrefixPath = prefix;
  424. recipe.Creator = BaseApp.Instance.UserContext.LoginName;
  425. recipe.CreateTime = DateTime.Now;
  426. recipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  427. recipe.ReviseTime = DateTime.Now;
  428. recipe.Description = description;
  429. recipe.RecipeLevel = LevelDisplay;
  430. recipe.RecipePermission = "Free";
  431. if (!Save(recipe, true))
  432. return;
  433. }
  434. ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, recipeName, false);
  435. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
  436. var tempFile = item.FileListByProcessType.FirstOrDefault(x => x.Name == fileName);
  437. if (tempFile != null)
  438. {
  439. TreeSelectChanged(tempFile);
  440. }
  441. }
  442. protected override void OnActivate()
  443. {
  444. base.OnActivate();
  445. }
  446. protected override void OnDeactivate(bool close)
  447. {
  448. base.OnDeactivate(close);
  449. if (this.IsChanged)
  450. {
  451. if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, $"Recipe {CurrentRecipe.Name} content is changed, do you want to save it?") == DialogButton.Yes)
  452. {
  453. this.SaveRecipe();
  454. }
  455. }
  456. }
  457. public void TabSelectionChanged()
  458. {
  459. UpdateRecipeFormat();
  460. OnViewLoaded(View);
  461. }
  462. public void UpdateRecipeFormat()
  463. {
  464. this.CurrentRecipe = new RecipeDataLayout();
  465. CurrentRecipe.RecipeChamberType = _columnBuilder.RecipeChamberType;
  466. CurrentRecipe.RecipeVersion = _columnBuilder.RecipeVersion;
  467. this.editMode = EditMode.None;
  468. var chamber = QueryDataClient.Instance.Service.GetConfig("System.Recipe.ChamberModules");
  469. if (chamber == null)
  470. {
  471. chamber = "PM1";
  472. }
  473. Chambers = new ObservableCollection<string>(((string)chamber).Split(','));
  474. SelectedChamber = Chambers[0];
  475. MultiChamberVisibility = Chambers.Count > 1 ? Visibility.Visible : Visibility.Collapsed;
  476. ToleranceVisibility = CurrentRecipe.ToleranceEnable ? Visibility.Visible : Visibility.Collapsed;
  477. }
  478. public void TreeSelectChanged(FileNode node)
  479. {
  480. if (IsChanged)
  481. {
  482. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  483. DialogType.CONFIRM,
  484. $"Recipe {CurrentRecipe.Name} is changed, do you want to save it?");
  485. if (selection == DialogButton.Yes)
  486. {
  487. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  488. this.CurrentRecipe.ReviseTime = DateTime.Now;
  489. // this.Save(this.CurrentRecipe, false);
  490. }
  491. }
  492. if (node != null && !node.IsFile)
  493. {
  494. ProcessTypeFileList[0].FileListByProcessType.ForEachDo(a =>
  495. {
  496. a.IsSelected = false;
  497. if (a.Name == node.Name)
  498. {
  499. a.IsSelected = true;
  500. a.Files.ForEachDo(e => e.IsSelected = false);
  501. return;
  502. }
  503. });
  504. RecipeFileList = RecipeSequenceTreeBuilder.GetFileNodeParameterList(node.FullPath).ToList();
  505. }
  506. CurrentFileNode = node;
  507. IsFreePermission = true;
  508. IsReadAndWritePermission = true;
  509. NotifyOfPropertyChange(nameof(IsCurrentNodeFile));
  510. NotifyOfPropertyChange(nameof(IsCurrentNodePath));
  511. NotifyOfPropertyChange(nameof(IsSelectPermission));
  512. NotifyOfPropertyChange(nameof(IsSingleSelectPermission));
  513. NotifyOfPropertyChange(nameof(IsEnabledFolderPermission));
  514. if (node != null && node.IsFile)
  515. {
  516. if (CurrentRecipe != null)
  517. {
  518. CurrentRecipe.Name = node.Name;
  519. CurrentRecipe.PrefixPath = node.PrefixPath;
  520. }
  521. // this.LoadData(node.PrefixPath, node.FullPath);
  522. }
  523. else
  524. {
  525. this.ClearData();
  526. this.editMode = EditMode.None;
  527. }
  528. this.UpdateView();
  529. GetIsEnabledNewRecipe();
  530. }
  531. private void GetIsEnabledNewRecipe()
  532. {
  533. if (!IsSingleFile && ProcessTypeFileList != null && ProcessTypeFileList.FirstOrDefault() != null && ProcessTypeFileList.FirstOrDefault().FileListByProcessType != null && ProcessTypeFileList.FirstOrDefault().FileListByProcessType.Count > 0)
  534. {
  535. IsEnabledNewRecipe = true;
  536. }
  537. else
  538. {
  539. IsEnabledNewRecipe = false;
  540. }
  541. }
  542. #region folder
  543. public void SelectRecipeType()
  544. {
  545. var windowManager = IoC.Get<IWindowManager>();
  546. RecipeSelectRecipeTypeViewModel recipeSelectRecipeTypeViewModel = new RecipeSelectRecipeTypeViewModel();
  547. (windowManager as WindowManager)?.ShowDialogWithTitle(recipeSelectRecipeTypeViewModel, null, "Select Recipe Type");
  548. if (recipeSelectRecipeTypeViewModel.SelectRecipeType != null)
  549. {
  550. var selectRecipeType = recipeSelectRecipeTypeViewModel.SelectRecipeType;
  551. var processType = QueryDataClient.Instance.Service.GetConfig($"System.Recipe.{selectRecipeType}");
  552. if (processType == null)
  553. {
  554. processType = selectRecipeType;
  555. }
  556. ProcessTypeFileList = new List<ProcessTypeFileItem>();
  557. string[] recipeProcessType = ((string)processType).Split(',');
  558. for (int i = 0; i < recipeProcessType.Length; i++)
  559. {
  560. var type = new ProcessTypeFileItem();
  561. type.ProcessType = recipeProcessType[i];
  562. var prefix = $"{ChamberType[ChamberTypeIndexSelection]}\\{recipeProcessType[i]}";
  563. // var recipes = _recipeProvider.GetXmlRecipeList(prefix);
  564. type.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList(prefix);// RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
  565. ProcessTypeFileList.Add(type);
  566. }
  567. SelectRecipeTypeName = processType + " Recipe";
  568. this.NotifyOfPropertyChange("ProcessTypeFileList");
  569. if (ProcessTypeFileList[0].FileListByProcessType.Count > 0)
  570. CurrentFileNode = ProcessTypeFileList[0].FileListByProcessType[ProcessTypeFileList[0].FileListByProcessType.Count - 1];
  571. NotifyOfPropertyChange(nameof(IsCurrentNodeFile));
  572. NotifyOfPropertyChange(nameof(IsCurrentNodePath));
  573. NotifyOfPropertyChange(nameof(IsSelectPermission));
  574. NotifyOfPropertyChange(nameof(IsReadAndWritePermission));
  575. // NotifyOfPropertyChange(nameof(IsFreePermission));
  576. ProcessTypeIndexSelection = 0;
  577. }
  578. }
  579. public void NewFolder()
  580. {
  581. if (IsChanged)
  582. {
  583. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No | DialogButton.Cancel, DialogType.CONFIRM, $"Recipe {CurrentRecipe.Name} is changed, do you want to save it?");
  584. if (selection == DialogButton.Cancel)
  585. return;
  586. if (selection == DialogButton.Yes)
  587. {
  588. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  589. this.CurrentRecipe.ReviseTime = DateTime.Now;
  590. // this.Save(this.CurrentRecipe, false);
  591. }
  592. }
  593. InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel("Input New Folder Name", ProcessTypeFileList[0].FileListByProcessType, "", Visibility.Visible, Visibility.Collapsed);
  594. // dialog.FileName = "new folder";
  595. WindowManager wm = new WindowManager();
  596. bool? dialogReturn = wm.ShowDialog(dialog);
  597. if (!dialogReturn.HasValue || !dialogReturn.Value)
  598. return;
  599. if (string.IsNullOrWhiteSpace(dialog.FileName))
  600. {
  601. DialogBox.ShowWarning("Folder name should not be empty");
  602. }
  603. else
  604. {
  605. string name = dialog.FileName.Trim();
  606. FileNode selectNode = dialog.SelectNode;
  607. string prefix = ChamberType[ChamberTypeIndexSelection] + "\\" + ProcessTypeFileList[ProcessTypeIndexSelection].ProcessType;
  608. string newFolder = string.Empty;
  609. string folder = string.Empty;
  610. if (selectNode != null)
  611. {
  612. prefix = selectNode.PrefixPath;
  613. folder = selectNode.FullPath.Replace($"{prefix}\\", "");
  614. newFolder = $"{folder}\\{name}";
  615. }
  616. else
  617. {
  618. newFolder = name;
  619. }
  620. if (IsExist(newFolder, false))
  621. {
  622. DialogBox.ShowWarning($"Can not create folder {newFolder}, Folder with the same name already exist.");
  623. return;
  624. }
  625. if (newFolder.Length > 200)
  626. {
  627. DialogBox.ShowWarning($"Can not create folder {newFolder}, Folder name too long, should be less 200.");
  628. return;
  629. }
  630. prefix = GetPrefix(prefix, selectNode);
  631. _recipeProvider.CreateRecipeFolder(prefix, name);
  632. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
  633. if (item == null)
  634. {
  635. LOG.Write("error reload recipe file list, type = " + CurrentProcessType);
  636. }
  637. //var recipes = _recipeProvider.GetXmlRecipeList(prefix);
  638. item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
  639. FindSelectedFile(item.FileListByProcessType, $"{prefix}\\{newFolder}");
  640. item.InvokePropertyChanged();
  641. TreeSelectChanged(CurrentFileNode);
  642. }
  643. }
  644. private string GetPrefix(string prefix, FileNode CurrentFileNode)
  645. {
  646. string temppreFix = prefix;
  647. if (CurrentFileNode != null)
  648. {
  649. if (string.IsNullOrEmpty(CurrentFileNode.AllParentPath))
  650. {
  651. if (CurrentFileNode.IsFile)
  652. {
  653. return temppreFix;
  654. }
  655. else
  656. {
  657. temppreFix = CurrentFileNode.FullPath;
  658. }
  659. }
  660. else
  661. {
  662. if (CurrentFileNode.IsFile)
  663. {
  664. if (temppreFix.EndsWith("\\"))
  665. {
  666. temppreFix = $"{temppreFix}{CurrentFileNode.AllParentPath}";
  667. }
  668. else
  669. {
  670. temppreFix = $"{temppreFix}\\{CurrentFileNode.AllParentPath}";
  671. }
  672. }
  673. else
  674. {
  675. temppreFix = $"{temppreFix}\\{CurrentFileNode.AllParentPath}\\{CurrentFileNode.Name}";
  676. }
  677. }
  678. }
  679. return temppreFix;
  680. }
  681. public void NewFolderRoot()
  682. {
  683. if (IsChanged)
  684. {
  685. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No | DialogButton.Cancel, DialogType.CONFIRM, $"Recipe {CurrentRecipe.Name} is changed, do you want to save it?");
  686. if (selection == DialogButton.Cancel)
  687. return;
  688. if (selection == DialogButton.Yes)
  689. {
  690. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  691. this.CurrentRecipe.ReviseTime = DateTime.Now;
  692. // this.Save(this.CurrentRecipe, false);
  693. }
  694. }
  695. InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel("Input New Folder Name", ProcessTypeFileList[0].FileListByProcessType);
  696. dialog.FileName = "new folder";
  697. WindowManager wm = new WindowManager();
  698. bool? dialogReturn = wm.ShowDialog(dialog);
  699. if (!dialogReturn.HasValue || !dialogReturn.Value)
  700. return;
  701. string name = dialog.FileName.Trim();
  702. if (string.IsNullOrEmpty(name))
  703. {
  704. DialogBox.ShowWarning("Folder name should not be empty");
  705. return;
  706. }
  707. if (IsExist(name, false))
  708. {
  709. DialogBox.ShowWarning($"Can not create folder {name}, Folder with the same name already exist.");
  710. return;
  711. }
  712. if (name.Length > 200)
  713. {
  714. DialogBox.ShowWarning($"Can not create folder {name}, Folder name too long, should be less 200.");
  715. return;
  716. }
  717. string prefix = ChamberType[ChamberTypeIndexSelection] + "\\" + ProcessTypeFileList[ProcessTypeIndexSelection].ProcessType;
  718. _recipeProvider.CreateRecipeFolder(prefix, name);
  719. ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, name, true);
  720. }
  721. public void DeleteFolder()
  722. {
  723. if (CurrentFileNode == null || CurrentFileNode.IsFile)
  724. return;
  725. if (CurrentFileNode.Files.Count > 0)
  726. {
  727. DialogBox.ShowWarning($"Can not delete non-empty folder, Remove the files or folders under \r\n{CurrentFileNode.FullPath}.");
  728. return;
  729. }
  730. var prefix = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
  731. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM,
  732. $"Are you sure you want to delete \r\n {prefix}?");
  733. if (selection == DialogButton.No)
  734. return;
  735. //string nextFocus = CurrentFileNode.Parent.FullPath;
  736. //bool isFolder = true;
  737. //if (CurrentFileNode.Parent!=null&&CurrentFileNode.Parent.Files.Count > 1)
  738. //{
  739. // for (int i = 0; i < CurrentFileNode.Parent.Files.Count; i++)
  740. // {
  741. // if (CurrentFileNode.Parent.Files[i] == CurrentFileNode)
  742. // {
  743. // if (i == 0)
  744. // {
  745. // nextFocus = CurrentFileNode.Parent.Files[i + 1].FullPath;
  746. // isFolder = !CurrentFileNode.Parent.Files[i + 1].IsFile;
  747. // }
  748. // else
  749. // {
  750. // nextFocus = CurrentFileNode.Parent.Files[i - 1].FullPath;
  751. // isFolder = !CurrentFileNode.Parent.Files[i - 1].IsFile;
  752. // }
  753. // }
  754. // }
  755. //}
  756. prefix = prefix.Replace($"\\{CurrentFileNode.Name}", "");
  757. _recipeProvider.DeleteRecipeFolder(prefix, CurrentFileNode.Name);
  758. ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, "", false, true);
  759. GetIsEnabledNewRecipe();
  760. }
  761. public void RenameFolder()
  762. {
  763. if (CurrentFileNode == null || CurrentFileNode.IsFile)
  764. return;
  765. InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel("Input New Folder Name", ProcessTypeFileList[0].FileListByProcessType, "", Visibility.Hidden, Visibility.Collapsed);
  766. dialog.FileName = CurrentFileNode.Name;
  767. WindowManager wm = new WindowManager();
  768. bool? dialogReturn = wm.ShowDialog(dialog);
  769. if (!dialogReturn.HasValue || !dialogReturn.Value)
  770. return;
  771. string name = dialog.FileName.Trim();
  772. if (string.IsNullOrEmpty(name))
  773. return;
  774. string newFolder = CurrentFileNode.FullPath.Substring(0, CurrentFileNode.FullPath.LastIndexOf("\\") + 1);
  775. if (!string.IsNullOrEmpty(newFolder))
  776. newFolder = newFolder + name;
  777. else
  778. newFolder = name;
  779. if (newFolder == CurrentFileNode.FullPath)
  780. return;
  781. if (IsExist(newFolder, false))
  782. {
  783. DialogBox.ShowWarning($"Can not rename to {newFolder}, Folder with the same name already exist.");
  784. return;
  785. }
  786. if (newFolder.Length > 200)
  787. {
  788. DialogBox.ShowWarning($"Can not create folder {newFolder}, Folder name too long, should be less 200.");
  789. return;
  790. }
  791. if (_recipeProvider.RenameFolder(CurrentFileNode.PrefixPath, CurrentFileNode.Name, name))
  792. {
  793. foreach (var node in CurrentFileNode.Files)
  794. {
  795. UIGlobalVariable.Instance.ProcessModifiedRecipe[node.FullPath] = $"Folder Rename from [{CurrentFileNode.FullPath}] to [{name}] {DateTime.Now}";
  796. }
  797. }
  798. ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, name, true, true);
  799. }
  800. #endregion
  801. #region recipe
  802. public void NewRecipe()
  803. {
  804. if (IsChanged)
  805. {
  806. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No | DialogButton.Cancel, DialogType.CONFIRM, $"Recipe {CurrentRecipe.Name} is changed, do you want to save it?");
  807. if (selection == DialogButton.Cancel)
  808. return;
  809. if (selection == DialogButton.Yes)
  810. {
  811. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  812. this.CurrentRecipe.ReviseTime = DateTime.Now;
  813. this.Save(this.CurrentRecipe, false);
  814. }
  815. }
  816. InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel("Input New Recipe Name", ProcessTypeFileList[0].FileListByProcessType, "");
  817. dialog.SelectIndex = ProcessTypeFileList[0].FileListByProcessType.IndexOf(ProcessTypeFileList[0].FileListByProcessType.FirstOrDefault(a => a.IsSelected));
  818. //dialog.FileName = (string)QueryDataClient.Instance.Service.GetConfig($"System.Recipe.DefaultProcessRecipeName");
  819. WindowManager wm = new WindowManager();
  820. bool? dialogReturn = wm.ShowDialog(dialog);
  821. if (!dialogReturn.HasValue || !dialogReturn.Value)
  822. return;
  823. if (string.IsNullOrEmpty(dialog.FileName))
  824. {
  825. DialogBox.ShowWarning("Recipe file name should not be empty");
  826. return;
  827. }
  828. string recipeName = dialog.FileName.Trim();
  829. string filepath = dialog.FilePath;
  830. string description = dialog.Comment;
  831. string prefix;
  832. if (filepath.Contains("\\"))
  833. {
  834. prefix = filepath;
  835. }
  836. else
  837. {
  838. prefix = CurrentChamberType + "\\" + CurrentProcessType + "\\" + filepath;
  839. if (CurrentFileNode != null)
  840. {
  841. //获取目录
  842. prefix = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
  843. }
  844. }
  845. if (RecipeFileList != null && RecipeFileList.Find(a => a.Name == recipeName.ToLower()) != null)
  846. {
  847. DialogBox.ShowWarning($"Can not create {recipeName}, Recipe with the same name already exist.");
  848. return;
  849. }
  850. if ((prefix + recipeName).Length > 200)
  851. {
  852. DialogBox.ShowWarning($"Can not create folder {recipeName}, Folder name too long, should be less 200.");
  853. return;
  854. }
  855. RecipeDataLayout recipe = new RecipeDataLayout();
  856. recipe.Name = recipeName;
  857. recipe.PrefixPath = prefix;
  858. recipe.Creator = BaseApp.Instance.UserContext.LoginName;
  859. recipe.CreateTime = DateTime.Now;
  860. recipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  861. recipe.ReviseTime = DateTime.Now;
  862. recipe.Description = description;
  863. recipe.RecipeLevel = LevelDisplay;
  864. recipe.RecipePermission = "Free";
  865. if (!Save(recipe, true))
  866. return;
  867. var types = prefix.Split('\\');
  868. string newfile = string.Empty;
  869. if (types.Length > 2)
  870. {
  871. newfile = $"{string.Join("\\", types.Skip(2))}\\{recipeName}";
  872. }
  873. else
  874. {
  875. newfile = recipeName;
  876. }
  877. //ReloadRecipeFileList(types[0], types[1], newfile, false);
  878. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == types[1]);
  879. item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
  880. FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{newfile}");
  881. TreeSelectChanged(CurrentFileNode);
  882. item.FileListByProcessType.ForEachDo(a =>
  883. {
  884. a.IsSelected = false;
  885. if (a.FullPath == prefix)
  886. {
  887. a.IsSelected = true;
  888. RecipeFileList = a.Files.ToList();
  889. return;
  890. }
  891. });
  892. }
  893. public void NewRecipeRoot()
  894. {
  895. if (IsChanged)
  896. {
  897. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No | DialogButton.Cancel, DialogType.CONFIRM, $"Recipe {CurrentRecipe.Name} is changed, do you want to save it?");
  898. if (selection == DialogButton.Cancel)
  899. return;
  900. if (selection == DialogButton.Yes)
  901. {
  902. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  903. this.CurrentRecipe.ReviseTime = DateTime.Now;
  904. this.Save(this.CurrentRecipe, false);
  905. }
  906. }
  907. InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel("Input New Recipe Name", ProcessTypeFileList[0].FileListByProcessType, CurrentRecipe.Description);
  908. dialog.FileName = "new recipe";
  909. WindowManager wm = new WindowManager();
  910. bool? dialogReturn = wm.ShowDialog(dialog);
  911. if (!dialogReturn.HasValue || !dialogReturn.Value)
  912. return;
  913. string recipeName = dialog.FileName.Trim();
  914. string description = dialog.Comment;
  915. if (string.IsNullOrEmpty(dialog.FileName))
  916. {
  917. DialogBox.ShowWarning("Recipe file name should not be empty");
  918. return;
  919. }
  920. if (IsExist(recipeName, true))
  921. {
  922. DialogBox.ShowWarning($"Can not create {recipeName}, Recipe with the same name already exist.");
  923. return;
  924. }
  925. if (recipeName.Length > 200)
  926. {
  927. DialogBox.ShowWarning($"Can not create folder {recipeName}, Folder name too long, should be less 200.");
  928. return;
  929. }
  930. }
  931. private void ReloadRecipeFileList(string chamberType, string processType, string selectedFile, bool selectionIsFolder, bool isRefreshFlod = false)
  932. {
  933. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == processType);
  934. if (item == null)
  935. {
  936. LOG.Write("error reload recipe file list, type = " + processType);
  937. }
  938. var prefix = $"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}";
  939. //var recipes = _recipeProvider.GetXmlRecipeList(prefix);
  940. item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList(prefix);// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
  941. FindSelectedFile(item.FileListByProcessType, $"{prefix}\\{selectedFile}");
  942. if (isRefreshFlod)
  943. item.InvokePropertyChanged();
  944. }
  945. private bool FindSelectedFile(ObservableCollection<FileNode> nodes, string selectedFile)
  946. {
  947. foreach (var recipe in nodes)
  948. {
  949. recipe.IsSelected = false;
  950. if (!recipe.IsFile)
  951. {
  952. if (recipe.FullPath == selectedFile && recipe.Files.Count == 0)
  953. {
  954. recipe.IsSelected = true;
  955. CurrentFileNode = recipe;
  956. return true;
  957. }
  958. else
  959. {
  960. if (FindSelectedFile(recipe.Files, selectedFile)) return true;
  961. }
  962. }
  963. else
  964. {
  965. string filepath = string.Empty;
  966. if (string.IsNullOrEmpty(recipe.AllParentPath))
  967. {
  968. filepath = recipe.Name;
  969. }
  970. else
  971. {
  972. filepath = recipe.AllParentPath + "\\" + recipe.Name;
  973. }
  974. if (filepath == selectedFile.Replace($"{recipe.PrefixPath}\\", ""))
  975. {
  976. recipe.IsSelected = true;
  977. CurrentFileNode = recipe;
  978. return true;
  979. }
  980. }
  981. }
  982. return false;
  983. }
  984. public void SavePermission()
  985. {
  986. CurrentRecipe.Clear();
  987. var recipeContent = _recipeProvider.LoadRecipe(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath);
  988. if (string.IsNullOrEmpty(recipeContent))
  989. {
  990. MessageBox.Show($"{CurrentRecipe.PrefixPath}\\{CurrentRecipe.Name} is empty, please confirm the file is valid.");
  991. return;
  992. }
  993. CurrentRecipe.InitData(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath, recipeContent, _columnBuilder.Configs, SelectedChamber);
  994. CurrentRecipe.RecipeLevel = CurrentFileNode.Level;
  995. RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", CurrentFileNode.Permission, CurrentRecipe.Description);
  996. WindowManager wm = new WindowManager();
  997. bool? dialogReturn = wm.ShowDialog(dialog);
  998. if (!dialogReturn.HasValue || !dialogReturn.Value)
  999. return;
  1000. CurrentRecipe.RecipePermission = dialog.RecipePermission;
  1001. CurrentRecipe.Description = dialog.RecipeComment;
  1002. CurrentRecipe.RecipeLevel = CurrentFileNode.Level;
  1003. this.Save(CurrentRecipe, false);
  1004. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
  1005. item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
  1006. FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{CurrentFileNode.FullPath}");
  1007. var prefixPath = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
  1008. item.FileListByProcessType.ForEachDo(a =>
  1009. {
  1010. a.IsSelected = false;
  1011. if (a.FullPath == prefixPath)
  1012. {
  1013. a.IsSelected = true;
  1014. RecipeFileList = a.Files.ToList();
  1015. return;
  1016. }
  1017. });
  1018. }
  1019. private bool IsExist(string fullPath, bool isFile)
  1020. {
  1021. for (int i = 0; i < ProcessTypeFileList.Count; i++)
  1022. {
  1023. if (ProcessTypeFileList[i].ProcessType == CurrentProcessType)
  1024. {
  1025. if (ProcessTypeFileList[i].FileListByProcessType.Count == 0)
  1026. return false;
  1027. foreach (var item in ProcessTypeFileList[i].FileListByProcessType)
  1028. {
  1029. if (FindFile(fullPath, item, isFile))
  1030. {
  1031. return true;
  1032. }
  1033. }
  1034. return false;
  1035. }
  1036. }
  1037. return true;
  1038. }
  1039. private bool FindFile(string path, FileNode root, bool isFile)
  1040. {
  1041. if (root.FullPath.ToLower() == path && !isFile)
  1042. {
  1043. return true;
  1044. }
  1045. if (root.IsFile && isFile)
  1046. {
  1047. return root.FullPath.ToLower().Equals(path);
  1048. }
  1049. else if (!root.IsFile && isFile)
  1050. {
  1051. foreach (var node in root.Files)
  1052. {
  1053. if (isFile && node.IsFile && node.FullPath.ToLower() == path)
  1054. return true;
  1055. if (!node.IsFile && FindFile(path, node, isFile))
  1056. return true;
  1057. }
  1058. }
  1059. return false;
  1060. }
  1061. public void SaveAsRecipe()
  1062. {
  1063. if (CurrentFileNode == null || !CurrentFileNode.IsFile)
  1064. return;
  1065. if (IsChanged)
  1066. {
  1067. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No | DialogButton.Cancel, DialogType.CONFIRM, $"Recipe {CurrentRecipe.Name} is changed, do you want to save it?");
  1068. if (selection == DialogButton.Cancel)
  1069. return;
  1070. if (selection == DialogButton.Yes)
  1071. {
  1072. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  1073. this.CurrentRecipe.ReviseTime = DateTime.Now;
  1074. this.Save(this.CurrentRecipe, false);
  1075. }
  1076. }
  1077. this.LoadData(CurrentRecipe.PrefixPath, CurrentFileNode.FullPath);
  1078. InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel("Input New Recipe Name", ProcessTypeFileList[0].FileListByProcessType, CurrentRecipe.Description, Visibility.Hidden);
  1079. dialog.SelectIndex = ProcessTypeFileList[0].FileListByProcessType.IndexOf(ProcessTypeFileList[0].FileListByProcessType.FirstOrDefault(a => a.IsSelected));
  1080. dialog.FileName = CurrentFileNode.Name;
  1081. WindowManager wm = new WindowManager();
  1082. bool? dialogReturn = wm.ShowDialog(dialog);
  1083. if (!dialogReturn.HasValue || !dialogReturn.Value)
  1084. return;
  1085. string recipeName = dialog.FileName.Trim();
  1086. string filepath = dialog.FilePath;
  1087. FileNode selectNode = dialog.SelectNode;
  1088. if (string.IsNullOrEmpty(dialog.FileName))
  1089. {
  1090. DialogBox.ShowWarning("Recipe file name should not be empty");
  1091. return;
  1092. }
  1093. string prefix = CurrentChamberType + "\\" + CurrentProcessType;// + "\\" + filepath;
  1094. string processType = string.Empty;
  1095. // string folder = CurrentFileNode.FullPath;
  1096. // string folder = filepath.Substring(filepath.LastIndexOf("\\") + 1);
  1097. string folder = filepath.Replace($"{prefix}\\", "");
  1098. //if (!string.IsNullOrEmpty(folder))
  1099. // recipeName = folder + "\\" + recipeName;
  1100. // var newPrefix = GetPrefix(CurrentChamberType + "\\" + CurrentProcessType, selectNode);
  1101. if (!string.IsNullOrEmpty(folder))
  1102. {
  1103. recipeName = $"{folder}\\{recipeName}";
  1104. }
  1105. if (IsExist(prefix + "\\" + recipeName, true))
  1106. {
  1107. DialogBox.ShowWarning($"Can not copy to {recipeName}, Recipe with the same name already exist.");
  1108. return;
  1109. }
  1110. if (recipeName.Length > 200)
  1111. {
  1112. DialogBox.ShowWarning($"Can not create folder {recipeName}, Folder name too long, should be less 200.");
  1113. return;
  1114. }
  1115. CurrentRecipe.Creator = BaseApp.Instance.UserContext.LoginName;
  1116. CurrentRecipe.CreateTime = DateTime.Now;
  1117. CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  1118. CurrentRecipe.ReviseTime = DateTime.Now;
  1119. CurrentRecipe.Description = string.IsNullOrEmpty(dialog.Comment) ? CurrentRecipe.Description + ". Renamed from " + CurrentFileNode.Name : dialog.Comment;
  1120. _recipeProvider.SaveAsRecipe(prefix, recipeName, CurrentRecipe.GetXmlString());
  1121. prefix = "";
  1122. if (filepath.Contains("\\"))
  1123. {
  1124. prefix = filepath;
  1125. }
  1126. else
  1127. {
  1128. prefix = CurrentChamberType + "\\" + CurrentProcessType + "\\" + filepath;
  1129. if (CurrentFileNode != null)
  1130. {
  1131. //获取目录
  1132. prefix = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
  1133. }
  1134. }
  1135. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
  1136. item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
  1137. FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{recipeName}");
  1138. TreeSelectChanged(CurrentFileNode);
  1139. item.FileListByProcessType.ForEachDo(a =>
  1140. {
  1141. a.IsSelected = false;
  1142. if (a.FullPath == prefix)
  1143. {
  1144. a.IsSelected = true;
  1145. RecipeFileList = a.Files.ToList();
  1146. return;
  1147. }
  1148. });
  1149. }
  1150. public void RenameRecipe()
  1151. {
  1152. if (CurrentFileNode == null || !CurrentFileNode.IsFile)
  1153. return;
  1154. if (IsChanged)
  1155. {
  1156. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No | DialogButton.Cancel, DialogType.CONFIRM, $"Recipe {CurrentRecipe.Name} is changed, do you want to save it?");
  1157. if (selection == DialogButton.Cancel)
  1158. return;
  1159. if (selection == DialogButton.Yes)
  1160. {
  1161. this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  1162. this.CurrentRecipe.ReviseTime = DateTime.Now;
  1163. this.Save(this.CurrentRecipe, false);
  1164. }
  1165. }
  1166. InputFileNameDialogViewModel dialog = new InputFileNameDialogViewModel("Input New Recipe Name", ProcessTypeFileList[0].FileListByProcessType, CurrentRecipe.Description, Visibility.Hidden);
  1167. dialog.SelectIndex = ProcessTypeFileList[0].FileListByProcessType.IndexOf(ProcessTypeFileList[0].FileListByProcessType.FirstOrDefault(a => a.IsSelected));
  1168. dialog.FileName = CurrentFileNode.Name;
  1169. WindowManager wm = new WindowManager();
  1170. bool? dialogReturn = wm.ShowDialog(dialog);
  1171. if (!dialogReturn.HasValue || !dialogReturn.Value)
  1172. return;
  1173. string recipeName = dialog.FileName.Trim();
  1174. if (string.IsNullOrEmpty(dialog.FileName))
  1175. {
  1176. DialogBox.ShowWarning("Recipe file name should not be empty");
  1177. return;
  1178. }
  1179. string prefix = CurrentChamberType + "\\" + CurrentProcessType;
  1180. string processType = string.Empty;
  1181. string newName = CurrentFileNode.FullPath.Substring(0, CurrentFileNode.FullPath.LastIndexOf("\\") + 1);
  1182. if (!string.IsNullOrEmpty(newName))
  1183. newName = newName + recipeName;
  1184. else
  1185. newName = recipeName;
  1186. if (newName == CurrentFileNode.FullPath)
  1187. return;
  1188. if (IsExist(newName, true))
  1189. {
  1190. DialogBox.ShowWarning($"Can not rename to {newName}, Recipe with the same name already exist.");
  1191. return;
  1192. }
  1193. if (newName.Length > 200)
  1194. {
  1195. DialogBox.ShowWarning($"Can not create folder {newName}, Folder name too long, should be less 200.");
  1196. return;
  1197. }
  1198. prefix = dialog.FilePath;
  1199. if (_recipeProvider.RenameRecipe(dialog.FilePath, CurrentFileNode.Name, recipeName))
  1200. {
  1201. UIGlobalVariable.Instance.ProcessModifiedRecipe[CurrentFileNode.FullPath] = $"Rename Recipe from [{CurrentFileNode.FullPath}] to [{recipeName}] {DateTime.Now}";
  1202. }
  1203. CurrentRecipe.Name = newName;
  1204. CurrentRecipe.Description = dialog.Comment;
  1205. CurrentRecipe.ReviseTime = DateTime.Now;
  1206. CurrentRecipe.PrefixPath = CurrentChamberType + "\\" + CurrentProcessType;
  1207. //ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, newName, false);
  1208. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
  1209. item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
  1210. FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{newName}");
  1211. TreeSelectChanged(CurrentFileNode);
  1212. item.FileListByProcessType.ForEachDo(a =>
  1213. {
  1214. a.IsSelected = false;
  1215. if (a.FullPath == dialog.FilePath)
  1216. {
  1217. a.IsSelected = true;
  1218. RecipeFileList = a.Files.ToList();
  1219. return;
  1220. }
  1221. });
  1222. }
  1223. public void DeleteRecipe()
  1224. {
  1225. if (CurrentFileNode == null || !CurrentFileNode.IsFile)
  1226. return;
  1227. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM,
  1228. $"Are you sure you want to delete \r\n {CurrentFileNode.FullPath}?");
  1229. if (selection == DialogButton.No)
  1230. return;
  1231. //string nextFocus = CurrentFileNode.Parent.FullPath;
  1232. //bool isFolder = true;
  1233. //if (CurrentFileNode.Parent.Files.Count > 1)
  1234. //{
  1235. // for (int i = 0; i < CurrentFileNode.Parent.Files.Count; i++)
  1236. // {
  1237. // if (CurrentFileNode.Parent.Files[i] == CurrentFileNode)
  1238. // {
  1239. // if (i == 0)
  1240. // {
  1241. // nextFocus = CurrentFileNode.Parent.Files[i + 1].FullPath;
  1242. // isFolder = !CurrentFileNode.Parent.Files[i + 1].IsFile;
  1243. // }
  1244. // else
  1245. // {
  1246. // nextFocus = CurrentFileNode.Parent.Files[i - 1].FullPath;
  1247. // isFolder = !CurrentFileNode.Parent.Files[i - 1].IsFile;
  1248. // }
  1249. // }
  1250. // }
  1251. //}
  1252. var prefixPath = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
  1253. if (_recipeProvider.DeleteRecipe(prefixPath, CurrentFileNode.Name))
  1254. {
  1255. UIGlobalVariable.Instance.ProcessModifiedRecipe[CurrentFileNode.FullPath] = $"Delet Recipe from [{CurrentFileNode.FullPath}] {DateTime.Now}";
  1256. }
  1257. //ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, "", false);
  1258. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
  1259. item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
  1260. FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{""}");
  1261. item.FileListByProcessType.ForEachDo(a =>
  1262. {
  1263. a.IsSelected = false;
  1264. if (a.FullPath == prefixPath)
  1265. {
  1266. a.IsSelected = true;
  1267. CurrentFileNode = a;
  1268. RecipeFileList = a.Files.ToList();
  1269. return;
  1270. }
  1271. });
  1272. }
  1273. public void ReloadRecipe()
  1274. {
  1275. if (this.editMode == EditMode.Normal || this.editMode == EditMode.Edit)
  1276. {
  1277. this.LoadData(CurrentRecipe.PrefixPath, CurrentRecipe.Name);
  1278. this.UpdateView();
  1279. }
  1280. }
  1281. public void SaveToAll()
  1282. {
  1283. if (!CurrentRecipe.IsCompatibleWithCurrentFormat)
  1284. {
  1285. DialogBox.ShowWarning($"Save failed, {CurrentRecipe.Name} is not a valid recipe file");
  1286. return;
  1287. }
  1288. var selection = DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No,
  1289. DialogType.CONFIRM, $"Do you want to save to all? \r\n This will replace all the other chamber recipe content");
  1290. if (selection == DialogButton.No)
  1291. return;
  1292. CurrentRecipe.SaveTo(Chambers.ToArray());
  1293. Save(this.CurrentRecipe, false);
  1294. }
  1295. public void SaveTo()
  1296. {
  1297. if (!CurrentRecipe.IsCompatibleWithCurrentFormat)
  1298. {
  1299. DialogBox.ShowWarning($"Save failed, {CurrentRecipe.Name} is not a valid recipe file");
  1300. return;
  1301. }
  1302. SaveToDialogViewModel dialog = new SaveToDialogViewModel("Select which chamber to copy to", SelectedChamber, Chambers.ToList());
  1303. WindowManager wm = new WindowManager();
  1304. bool? dialogReturn = wm.ShowDialog(dialog);
  1305. if (!dialogReturn.HasValue || !dialogReturn.Value)
  1306. return;
  1307. List<string> chambers = new List<string>();
  1308. foreach (var dialogChamber in dialog.Chambers)
  1309. {
  1310. if (dialogChamber.IsEnabled && dialogChamber.IsChecked)
  1311. chambers.Add(dialogChamber.Name);
  1312. }
  1313. if (chambers.Count == 0)
  1314. return;
  1315. CurrentRecipe.SaveTo(chambers.ToArray());
  1316. Save(this.CurrentRecipe, false);
  1317. }
  1318. public void EditRecipe()
  1319. {
  1320. CGlobal.RecipeProcessEditViewEnable = true;
  1321. MECF.Framework.UI.Client.CenterViews.Editors.Recipe.CGlobal.RecipeProcessEditViewEnable = true;
  1322. if (PopupPage())
  1323. {
  1324. UIGlobalVariable.Instance.ProcessModifiedRecipe[CurrentFileNode.FullPath] = $"Edit {DateTime.Now}";
  1325. this.editMode = EditMode.Normal;
  1326. var prefixPath = GetPrefix(CurrentFileNode.PrefixPath, CurrentFileNode);
  1327. ProcessTypeFileItem item = ProcessTypeFileList.FirstOrDefault(x => x.ProcessType == CurrentProcessType);
  1328. item.FileListByProcessType = RecipeSequenceTreeBuilder.GetFileNodeParameterList($"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}");// RecipeSequenceTreeBuilder.BuildFileNode(prefix, selectedFile, selectionIsFolder, recipes)[0].Files;
  1329. FindSelectedFile(item.FileListByProcessType, $"{$"{ChamberType[ChamberTypeIndexSelection]}\\{item.ProcessType}"}\\{CurrentFileNode.FullPath}");
  1330. TreeSelectChanged(CurrentFileNode);
  1331. item.FileListByProcessType.ForEachDo(a =>
  1332. {
  1333. a.IsSelected = false;
  1334. if (a.FullPath == prefixPath)
  1335. {
  1336. a.IsSelected = true;
  1337. RecipeFileList = a.Files.ToList();
  1338. return;
  1339. }
  1340. });
  1341. }
  1342. }
  1343. public void ViewRecipe()
  1344. {
  1345. CGlobal.RecipeProcessEditViewEnable = false;
  1346. MECF.Framework.UI.Client.CenterViews.Editors.Recipe.CGlobal.RecipeProcessEditViewEnable = false;
  1347. if (PopupPage())
  1348. {
  1349. this.editMode = EditMode.Normal;
  1350. ReloadRecipeFileList(CurrentChamberType, CurrentProcessType, CurrentFileNode.FullPath, false);
  1351. this.UpdateView();
  1352. }
  1353. }
  1354. private string GetTimeFormat(string value)
  1355. {
  1356. try
  1357. {
  1358. if (value != null && value.Length > 1 && value.Split(':').Length > 2)
  1359. {
  1360. var timeH = value.Split(':')[0];
  1361. var timeM = value.Split(':')[1];
  1362. var timeS = value.Split(':')[2];
  1363. if (timeS.Contains('.'))
  1364. {
  1365. var timesArray = timeS.Split('.');
  1366. return $"{timeH}:{timeM.PadLeft(2, '0')}:{timesArray[0].PadLeft(2, '0')}.{timesArray[1].Substring(0, 1)}";
  1367. }
  1368. else
  1369. {
  1370. return $"{timeH}:{timeM.PadLeft(2, '0')}:{timeS.PadLeft(2, '0')}.0";
  1371. }
  1372. }
  1373. else
  1374. {
  1375. return value;
  1376. }
  1377. }
  1378. catch
  1379. {
  1380. return value;
  1381. }
  1382. }
  1383. public void SaveRecipe()
  1384. {
  1385. if (this.IsChanged)
  1386. {
  1387. this.Save(this.CurrentRecipe, false);
  1388. }
  1389. }
  1390. public bool Save(RecipeDataLayout recipe, bool createNew)
  1391. {
  1392. bool result = false;
  1393. if (string.IsNullOrEmpty(recipe.Name))
  1394. {
  1395. MessageBox.Show("Recipe name can't be empty");
  1396. return false;
  1397. }
  1398. recipe.Revisor = BaseApp.Instance.UserContext.LoginName;
  1399. recipe.ReviseTime = DateTime.Now;
  1400. result = this._recipeProvider.SaveRecipe(recipe.PrefixPath, recipe.Name, recipe.GetXmlString());
  1401. if (result)
  1402. {
  1403. //recipe.DataSaved();
  1404. this.editMode = EditMode.Normal;
  1405. this.UpdateView();
  1406. }
  1407. else
  1408. {
  1409. MessageBox.Show("Save failed!");
  1410. }
  1411. return result;
  1412. }
  1413. #endregion
  1414. private void ClearData()
  1415. {
  1416. this.editMode = EditMode.None;
  1417. this.CurrentRecipe.Clear();
  1418. this.CurrentRecipe.Name = string.Empty;
  1419. this.CurrentRecipe.Description = string.Empty;
  1420. }
  1421. private void LoadData(string prefixPath, string recipeName)
  1422. {
  1423. CurrentRecipe.Clear();
  1424. var recipeContent = _recipeProvider.LoadRecipe(prefixPath, recipeName);
  1425. if (string.IsNullOrEmpty(recipeContent))
  1426. {
  1427. MessageBox.Show($"{prefixPath}\\{recipeName} is empty, please confirm the file is valid.");
  1428. return;
  1429. }
  1430. CurrentRecipe.RecipeChamberType = "OriginChamber";
  1431. CurrentRecipe.RecipeVersion = _columnBuilder.RecipeVersion;
  1432. _columnBuilder.Build(CurrentProcessType);
  1433. CurrentRecipe.InitData(prefixPath, recipeName, recipeContent, _columnBuilder.Configs, SelectedChamber);
  1434. this.editMode = EditMode.Normal;
  1435. }
  1436. private void UpdateView()
  1437. {
  1438. bool isFileSelected = CurrentFileNode != null && CurrentFileNode.IsFile;
  1439. this.NotifyOfPropertyChange("CurrentRecipe");
  1440. }
  1441. private string oldPrefix { get; set; }
  1442. private string oldName { get; set; }
  1443. private string oldStepName { get; set; }
  1444. private bool PopupPage()
  1445. {
  1446. if (CurrentFileNode == null || !CurrentFileNode.IsFile)
  1447. return false;
  1448. var windowManager = IoC.Get<IWindowManager>();
  1449. var currentProcessType = CurrentProcessType;
  1450. if (CurrentProcessType == "Expert Layout")
  1451. {
  1452. RecipeLayoutExpertEditViewModel recipeLayoutExpertEditViewModel = new RecipeLayoutExpertEditViewModel(CurrentRecipe.PrefixPath, CurrentFileNode.FullPath, CurrentFileNode.Permission);
  1453. return (windowManager as WindowManager)?.ShowDialogWithTitle(recipeLayoutExpertEditViewModel, null, "Layout Setting") == true;
  1454. }
  1455. else
  1456. {
  1457. try
  1458. {
  1459. var permission = "PM1";
  1460. var waferNumberAll = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");
  1461. var layoutRecipe = new RecipeDataLayout();
  1462. layoutRecipe.PrefixPath = CurrentRecipe.PrefixPath;
  1463. layoutRecipe.Name = CurrentFileNode.FullPath;
  1464. layoutRecipe.RecipePermission = permission;
  1465. var recipeContent = _recipeProvider.LoadRecipe(layoutRecipe.PrefixPath, layoutRecipe.Name);
  1466. if (string.IsNullOrEmpty(recipeContent))
  1467. {
  1468. System.Windows.MessageBox.Show($"{layoutRecipe.PrefixPath}\\{layoutRecipe.Name} is empty, please confirm the file is valid.");
  1469. return false;
  1470. }
  1471. layoutRecipe.RecipeChamberType = "OriginChamber";
  1472. layoutRecipe.InitData(layoutRecipe.PrefixPath, layoutRecipe.Name, recipeContent, _columnBuilder.Configs, permission);
  1473. if (layoutRecipe.ExpertSteps != null && layoutRecipe.ExpertSteps.Count > 0 && layoutRecipe.ExpertSteps[0].Items != null && layoutRecipe.ExpertSteps[0].Items.Count != waferNumberAll)
  1474. {
  1475. DialogBox.ShowWarning($"layoutRecipe slot:{layoutRecipe.ExpertSteps[0].Items.Count} not match boatSlotConfig:{waferNumberAll}");
  1476. return false;
  1477. }
  1478. else
  1479. {
  1480. RecipeLayoutEditViewModel sdSettingViewModel = new RecipeLayoutEditViewModel(CurrentRecipe.PrefixPath, CurrentFileNode.FullPath, _columnBuilder, CurrentFileNode.Permission);
  1481. return (windowManager as WindowManager)?.ShowDialogWithTitle(sdSettingViewModel, null, "Layout Setting") == true;
  1482. }
  1483. }
  1484. catch (Exception ex)
  1485. {
  1486. RecipeLayoutEditViewModel sdSettingViewModel = new RecipeLayoutEditViewModel(CurrentRecipe.PrefixPath, CurrentFileNode.FullPath, _columnBuilder, CurrentFileNode.Permission);
  1487. return (windowManager as WindowManager)?.ShowDialogWithTitle(sdSettingViewModel, null, "Layout Setting") == true;
  1488. }
  1489. }
  1490. }
  1491. }
  1492. }