using Aitex.Core.Util; using Caliburn.Micro; using MECF.Framework.Common.DataCenter; using MECF.Framework.Common.OperationCenter; using MECF.Framework.UI.Client.CenterViews.Editors.Recipe; using MECF.Framework.UI.Client.CenterViews.Editors.Sequence; using OpenSEMI.ClientBase; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using FurnaceUI.Models; namespace FurnaceUI.Views.Editors { public class RecipeCommandCallRecipeViewModel : FurnaceUIViewModelBase { public string SelectButtonContent { get; set; } = "Process Recipe Select"; private string selectedProcessRecipe; public string SelectedProcessRecipe { set { selectedProcessRecipe = value; NotifyOfPropertyChange("SelectedProcessRecipe"); } get { return selectedProcessRecipe; } } public string SelectedSupportedProcessType { get; set; } = "SupportedProcessType"; public string SelectedProcessType { get; set; } = "Process"; public void ClosedCmd(string cmdPar) { (GetView() as Window).Close(); } public void SelectProcessRecipe() { RecipeSelectDialogViewModel dialog = new RecipeSelectDialogViewModel(); dialog.DisplayName = "Select Recipe"; var recipeProvider = new RecipeProvider(); var processType = QueryDataClient.Instance.Service.GetConfig($"System.Recipe.{SelectedSupportedProcessType}"); if (processType == null) { processType = SelectedProcessType; } var ProcessTypeFileList = new ObservableCollection(); string[] recipeProcessType = ((string)processType).Split(','); for (int i = 0; i < recipeProcessType.Length; i++) { var type = new ProcessTypeFileItem(); type.ProcessType = recipeProcessType[i]; var prefix = $"Furnace\\{recipeProcessType[i]}"; var recipes = recipeProvider.GetXmlRecipeList(prefix); type.FileListByProcessType = RecipeSequenceTreeBuilder.BuildFileNode(prefix, "", false, recipes)[0].Files; ProcessTypeFileList.Add(type); } dialog.ProcessTypeFileList = ProcessTypeFileList; WindowManager wm = new WindowManager(); bool? bret = wm.ShowDialog(dialog); if ((bool)bret) { //var array = dialog.DialogResult.Split(new char[] { '\\' }); //SelectedProcessRecipe = array[array.Length - 1]; SelectedProcessRecipe = dialog.DialogResult; } } } }