RecipeCommandCallRecipeViewModel.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using Aitex.Core.Util;
  2. using Caliburn.Micro;
  3. using MECF.Framework.Common.DataCenter;
  4. using MECF.Framework.Common.OperationCenter;
  5. using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
  6. using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
  7. using OpenSEMI.ClientBase;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Collections.ObjectModel;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. using System.Windows;
  15. using FurnaceUI.Models;
  16. namespace FurnaceUI.Views.Editors
  17. {
  18. public class RecipeCommandCallRecipeViewModel : FurnaceUIViewModelBase
  19. {
  20. public string SelectButtonContent { get; set; } = "Process Recipe Select";
  21. private string selectedProcessRecipe;
  22. public string SelectedProcessRecipe
  23. {
  24. set
  25. {
  26. selectedProcessRecipe = value;
  27. NotifyOfPropertyChange("SelectedProcessRecipe");
  28. }
  29. get
  30. {
  31. return selectedProcessRecipe;
  32. }
  33. }
  34. public string SelectedSupportedProcessType { get; set; } = "SupportedProcessType";
  35. public string SelectedProcessType { get; set; } = "Process";
  36. public void ClosedCmd(string cmdPar)
  37. {
  38. (GetView() as Window).Close();
  39. }
  40. public void SelectProcessRecipe()
  41. {
  42. RecipeSelectDialogViewModel dialog = new RecipeSelectDialogViewModel();
  43. dialog.DisplayName = "Select Recipe";
  44. var recipeProvider = new RecipeProvider();
  45. var processType = QueryDataClient.Instance.Service.GetConfig($"System.Recipe.{SelectedSupportedProcessType}");
  46. if (processType == null)
  47. {
  48. processType = SelectedProcessType;
  49. }
  50. var ProcessTypeFileList = new ObservableCollection<ProcessTypeFileItem>();
  51. string[] recipeProcessType = ((string)processType).Split(',');
  52. for (int i = 0; i < recipeProcessType.Length; i++)
  53. {
  54. var type = new ProcessTypeFileItem();
  55. type.ProcessType = recipeProcessType[i];
  56. var prefix = $"Furnace\\{recipeProcessType[i]}";
  57. var recipes = recipeProvider.GetXmlRecipeList(prefix);
  58. type.FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files;
  59. ProcessTypeFileList.Add(type);
  60. }
  61. dialog.ProcessTypeFileList = ProcessTypeFileList;
  62. WindowManager wm = new WindowManager();
  63. bool? bret = wm.ShowDialog(dialog);
  64. if ((bool)bret)
  65. {
  66. //var array = dialog.DialogResult.Split(new char[] { '\\' });
  67. //SelectedProcessRecipe = array[array.Length - 1];
  68. SelectedProcessRecipe = dialog.DialogResult;
  69. }
  70. }
  71. }
  72. }