SelectedSubRecipeViewModel.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using MECF.Framework.Common.DataCenter;
  2. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  3. using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
  4. using MECF.Framework.UI.Client.ClientBase;
  5. using OpenSEMI.ClientBase;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Collections.ObjectModel;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows;
  13. using FurnaceUI.Models;
  14. namespace FurnaceUI.Views.Editors
  15. {
  16. public class SelectedSubRecipeViewModel : FurnaceUIViewModelBase
  17. {
  18. public bool IsSave { get; set; } = false;
  19. public FileNode SelectedNode { get; set; }
  20. private ObservableCollection<ProcessTypeFileItem> _processTypeFileList;
  21. public ObservableCollection<ProcessTypeFileItem> ProcessTypeFileList { get=> _processTypeFileList;
  22. set
  23. {
  24. _processTypeFileList = value;
  25. NotifyOfPropertyChange("ProcessTypeFileList");
  26. }
  27. }
  28. public ObservableCollection<string> ChamberType { get; set; }
  29. public ObservableCollection<FileNode> FileListByProcessType { get; set; }
  30. public int ChamberTypeIndexSelection { get; set; }
  31. private RecipeProvider _recipeProvider = new RecipeProvider();
  32. protected override void OnInitialize()
  33. {
  34. base.OnInitialize();
  35. var chamberType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.SupportedChamberType");
  36. if (chamberType == null)
  37. {
  38. ChamberType = new ObservableCollection<string>() { "Default" };
  39. }
  40. else
  41. {
  42. ChamberType = new ObservableCollection<string>(((string)(chamberType)).Split(','));
  43. }
  44. ChamberTypeIndexSelection = 0;
  45. //Etch:Process,Clean,Chuck,Dechuck;CVD:Process,Clean;
  46. var processType = QueryDataClient.Instance.Service.GetConfig("System.Recipe.Layout");
  47. if (processType == null)
  48. {
  49. processType = "Recipe";
  50. }
  51. ObservableCollection<ProcessTypeFileItem> typeFileList = new ObservableCollection<ProcessTypeFileItem>();
  52. string[] recipeProcessType = ((string)processType).Split(',');
  53. for (int i = 0; i < recipeProcessType.Length; i++)
  54. {
  55. var prefix = $"{ChamberType[ChamberTypeIndexSelection]}\\{recipeProcessType[i]}";
  56. var recipes = _recipeProvider.GetXmlRecipeList(prefix);
  57. FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
  58. }
  59. }
  60. public void SelectedSubRecipeSave()
  61. {
  62. IsSave = true;
  63. (GetView() as Window).Close();
  64. }
  65. public void SelectedSubRecipeCancel()
  66. {
  67. IsSave = false;
  68. (GetView() as Window).Close();
  69. }
  70. public void TreeSelectChanged(FileNode node)
  71. {
  72. SelectedNode = node;
  73. //CurrentFileNode = node;
  74. //NotifyOfPropertyChange(nameof(IsCurrentNodeFile));
  75. //NotifyOfPropertyChange(nameof(IsCurrentNodePath));
  76. //if (node != null && node.IsFile)
  77. //{
  78. // this.LoadData(node.PrefixPath, node.FullPath);
  79. //}
  80. //else
  81. //{
  82. // this.ClearData();
  83. // this.editMode = EditMode.None;
  84. //}
  85. //this.UpdateView();
  86. }
  87. }
  88. }