| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 | 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<string>    {        #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 模型字段        /// </summary>        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<ConfigItem> TableNodeItems { get; set; } = new List<ConfigItem>();        public ObservableCollection<PageValue> ValueList { get; set; } = new ObservableCollection<PageValue>();        public List<PageValue> OldValueList { get; set; } = new List<PageValue>();        #endregion        private void GetModifyValue()        {            IsModifyAll = true;        }        public void SaveBtnClick()        {            List<string> value = new List<string>();            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);        }    }}
 |