using DocumentFormat.OpenXml.Wordprocessing; using MECF.Framework.Common.OperationCenter; using MECF.Framework.UI.Client.CenterViews.Configs.SystemConfig; using OpenSEMI.ClientBase; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FurnaceUI.Views.Maintenances { public class WaferRobotPositionAxisEditViewModel : DialogViewModel { #region 页面构造函数及其重载方法 protected override void OnInitialize() { base.OnInitialize(); foreach (var item in TableNodeItems) { var key = $"{item.Path}.{item.Name}"; ValueList.Add(new PageValue() { Path = key, CurrentValue = item.CurrentValue, Max = item.Max, Min = item.Min, Type = item.Type }); OldValueList.Add(new PageValue() { Path = key, CurrentValue = item.CurrentValue, Max = item.Max, Min = item.Min, Type = item.Type }); } _pName = TableNodeItems.FirstOrDefault().Path.Split('.').LastOrDefault(); } #endregion #region 模型字段 /// public string _pName; public string setValue; public string PName { get { return _pName; } set { _pName = value; this.NotifyOfPropertyChange(nameof(PName)); } } private bool _isModifyAll = false; public bool IsModifyAll { get { return _isModifyAll; } set { _isModifyAll = value; this.NotifyOfPropertyChange(nameof(IsModifyAll)); } } public List TableNodeItems { get; set; } = new List(); public ObservableCollection ValueList { get; set; } = new ObservableCollection(); public List OldValueList { get; set; } = new List(); #endregion private void GetModifyValue() { IsModifyAll = true; } public void SaveBtnClick() { List value = new List(); foreach (var item in ValueList) { if (item.Path.EndsWith("Type") ) { continue; } value.Add((double.Parse(item.CurrentValue) * 1000).ToString().PadLeft(11, '0')); if (OldValueList.Where(a => a.Path.Equals(item.Path)).FirstOrDefault().CurrentValue.Equals(item.CurrentValue)) { continue; } InvokeClient.Instance.Service.DoOperation("System.SetConfig", item.Path, item.CurrentValue); } setValue = string.Join(",", value.ToList()); IsCancel = true; TryClose(true); } private bool IsInRange(double num, double min, double max) { return (num >= min && num <= max); } public void CancelBtnClick() { IsCancel = true; TryClose(false); } } }