using FurnaceUI.Models; using MECF.Framework.Common.DataCenter; using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig; using MECF.Framework.UI.Client.CenterViews.Editors; using MECF.Framework.UI.Client.ClientBase; using OpenSEMI.ClientBase; using RecipeEditorLib.RecipeModel.Params; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; namespace FurnaceUI.Views.Scheduled { public class StepGroupSelectViewModel : FurnaceUIViewModelBase { public string SelectedGroupName = string.Empty; private ConfigNode _currentNode; public ConfigNode CurrentNode { get { return _currentNode; } set { _currentNode = value; this.NotifyOfPropertyChange(nameof(CurrentNode)); } } private ConfigNode _rootNode; protected override void OnInitialize() { base.OnInitialize(); this.SystemName = "System"; _rootNode = SystemConfigProvider.Instance.GetConfig(true); CurrentNode = FindNodeByName(_rootNode, $"PM1.RecipeEditParameter.StepGroup"); if (CurrentNode != null && CurrentNode.Items != null) { foreach (var item in CurrentNode.Items) { item.IsExpanded = false; if (item.Name == SelectedGroupName) { item.IsExpanded = true; } } } } private ConfigNode FindNodeByName(ConfigNode parentNode, string strName) { string strCates = strName.Split('.')[0]; ConfigNode node = parentNode.SubNodes.Find((x) => x.Name == strCates); if (node == null) return parentNode; else return FindNodeByName(node, strName.Replace(strCates + ".", "")); } public void StepGroupEdit(string groupName) { SelectedGroupName = groupName; ((Window)GetView()).DialogResult = true; } } }