| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 | using Caliburn.Micro.Core;using RecipeEditorLib.RecipeModel.Params;using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Linq;using System.Text;using System.Threading.Tasks;namespace MECF.Framework.UI.Client.CenterViews.Parameter{    public class TempCorrectionTable : ParameterTable    {        private DoubleParam _profileTCCalibTemp;        public DoubleParam ProfileTCCalibTemp        {            get => _profileTCCalibTemp;            set            {                _profileTCCalibTemp = value;                NotifyOfPropertyChange("ProfileTCCalibTemp");            }        }        private NumParam _profileConditionTableNo;        public NumParam ProfileConditionTableNo        {            get => _profileConditionTableNo;            set            {                _profileConditionTableNo = value;                NotifyOfPropertyChange("ProfileConditionTableNo");            }        }        private NumParam _tableNo;        public NumParam TableNo        {            get => _tableNo;            set            {                _tableNo = value;                NotifyOfPropertyChange("TableNo");            }        }        private DoubleParam _tableUseRangeMin;        public DoubleParam TableUseRangeMin        {            get => _tableUseRangeMin;            set            {                _tableUseRangeMin = value;                NotifyOfPropertyChange("TableUseRangeMin");            }        }        private DoubleParam _tableUseRangeMax ;        public DoubleParam TableUseRangeMax        {            get => _tableUseRangeMax;            set            {                _tableUseRangeMax = value;                NotifyOfPropertyChange("TableUseRangeMax");            }        }        private string _profileLastUpdate = "";        public string ProfileLastUpdate        {            get => _profileLastUpdate;            set            {                _profileLastUpdate = value;                NotifyOfPropertyChange("ProfileLastUpdate");            }        }        private ObservableCollection<CorrectionData> _correctionDataList = new ObservableCollection<CorrectionData>();        public ObservableCollection<CorrectionData> CorrectionDataList        {            get => _correctionDataList;            set            {                _correctionDataList = value;                NotifyOfPropertyChange("CorrectionDataList");            }        }        public TempCorrectionTable() : base()        {        }        public TempCorrectionTable(ParameterDataBase recipeData)        {            if (recipeData.Steps.Count <= 0) return;            SetCurrentRecipeStep(recipeData, recipeData.Steps[0]);        }        public TempCorrectionTable(ParameterDataBase recipeData, int selectedStepNo)        {            ParameterTable step = recipeData.Steps.Where(x => x.StepNo == selectedStepNo).FirstOrDefault();            SetCurrentRecipeStep(recipeData, step);        }        public void SetTempCorrectionData(string value)        {            if (string.IsNullOrEmpty(value)) return;            string[] strTempCorrection = value.Split('|');            foreach (var item in strTempCorrection)            {                if (string.IsNullOrEmpty(item)) continue;                string[] subTempCorrection = item.Split(';');                Dictionary<string, string> dictTempCorrection = new Dictionary<string, string>();                foreach (var pid in subTempCorrection)                {                    if (string.IsNullOrEmpty(item)) continue;                    var keyValue = pid.Split(':');                    if (keyValue == null || keyValue.Length != 2) continue;                    dictTempCorrection[keyValue[0]] = keyValue[1];                }                var selectCorrection = CorrectionDataList.Where(x => x.Name == dictTempCorrection["Name"]).FirstOrDefault();                if (selectCorrection != null)                {                    selectCorrection.ProfileTemp.Value = dictTempCorrection["ProfileTemp"];                    selectCorrection.ProfileCorrect.Value = dictTempCorrection["ProfileCorrect"];                    selectCorrection.CascadeTCCorrect.Value = dictTempCorrection["CascadeTCCorrect"];                    selectCorrection.ProfileTCCalib.Value = dictTempCorrection["ProfileTCCalib"];                }            }        }    }    public class CorrectionData : PropertyChangedBase    {        private int _index = 1;        public int Index        {            get => _index;            set            {                _index = value;                NotifyOfPropertyChange("Index");            }        }        private string _name = "";        public string Name        {            get => _name;            set            {                _name = value;                NotifyOfPropertyChange("Name");            }        }        private DoubleParam _profileTemp;        public DoubleParam ProfileTemp        {            get => _profileTemp;            set            {                _profileTemp = value;                NotifyOfPropertyChange("ProfileTemp");            }        }        private DoubleParam _profileCorrect;        public DoubleParam ProfileCorrect        {            get => _profileCorrect;            set            {                _profileCorrect = value;                NotifyOfPropertyChange("ProfileCorrect");            }        }        private DoubleParam _cascadeTCCorrect;        public DoubleParam CascadeTCCorrect        {            get => _cascadeTCCorrect;            set            {                _cascadeTCCorrect = value;                NotifyOfPropertyChange("CascadeTCCorrect");            }        }        private DoubleParam _profileTCCalib;        public DoubleParam ProfileTCCalib        {            get => _profileTCCalib;            set            {                _profileTCCalib = value;                NotifyOfPropertyChange("ProfileTCCalib");            }        }        public override string ToString()        {            string[] rtnStrList = new string[6];            rtnStrList[0] = $"Index:{Index}";            rtnStrList[1] = $"Name:{Name}";            rtnStrList[2] = $"ProfileTemp:{ProfileTemp.Value}";            rtnStrList[3] = $"ProfileCorrect:{ProfileCorrect.Value}";            rtnStrList[4] = $"CascadeTCCorrect:{CascadeTCCorrect.Value}";            rtnStrList[5] = $"ProfileTCCalib:{ProfileTCCalib.Value}";            return string.Join(";", rtnStrList);        }    }}
 |