12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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;
- }
- }
- }
|