| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908 | 
using Caliburn.Micro;using MECF.Framework.Common.CommonData;using MECF.Framework.Common.DataCenter;using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;using MECF.Framework.UI.Client.ClientBase;using OpenSEMI.ClientBase;using System;using System.Collections.Generic;using System.Windows;using System.Windows.Media;using FurnaceUI.Models;using FurnaceUI.Views.Editors;using System.Linq;using System.Windows.Controls;using System.Collections.ObjectModel;namespace FurnaceUI.Views.Recipes{    public class RecipeLayoutBoatMapViewModel : FurnaceUIViewModelBase    {        #region properties        private int waferNumberP;        public int WaferNumberP { get { return waferNumberP; } set { waferNumberP = value; NotifyOfPropertyChange(nameof(WaferNumberP)); } }        private int waferNumberSD;        public int WaferNumberSD { get { return waferNumberSD; } set { waferNumberSD = value; NotifyOfPropertyChange(nameof(WaferNumberSD)); } }        private int waferNumberED;        public int WaferNumberED { get { return waferNumberED; } set { waferNumberED = value; NotifyOfPropertyChange(nameof(WaferNumberED)); } }        private int waferNumberM;        public int WaferNumberM { get { return waferNumberM; } set { waferNumberM = value; NotifyOfPropertyChange(nameof(WaferNumberM)); } }        private int waferNumberAll;        public int WaferNumberAll { get { return waferNumberAll; } set { waferNumberAll = value; NotifyOfPropertyChange(nameof(WaferNumberAll)); } }        private int currentItemIndex;        private bool productPositionAuto;        public bool ProductPositionAuto { get { return productPositionAuto; } set { productPositionAuto = value; NotifyOfPropertyChange(nameof(ProductPositionAuto)); } }        private bool productPositionSlot;        public bool ProductPositionSlot { get { return productPositionSlot; } set { productPositionSlot = value; NotifyOfPropertyChange(nameof(ProductPositionSlot)); } }        private bool monitorPositionAuto;        public bool MonitorPositionAuto { get { return monitorPositionAuto; } set { monitorPositionAuto = value; NotifyOfPropertyChange(nameof(MonitorPositionAuto)); } }        private bool monitorPositionSlot;        public bool MonitorPositionSlot { get { return monitorPositionSlot; } set { monitorPositionSlot = value; NotifyOfPropertyChange(nameof(MonitorPositionSlot)); } }        private bool spaceSlotEnabled;        public bool SpaceSlotEnabled { get { return spaceSlotEnabled; } set { spaceSlotEnabled = value; NotifyOfPropertyChange(nameof(SpaceSlotEnabled)); } }        public int CurrentItemIndex        {            get { return currentItemIndex; }            set { currentItemIndex = value; SelecteSlot(); this.NotifyOfPropertyChange(nameof(CurrentItemIndex)); }        }        private RecipeProvider _recipeProvider = new RecipeProvider();        private SolidColorBrush _SDBk = new SolidColorBrush(Color.FromArgb(255, 251, 147, 85));        private SolidColorBrush _FDBk = new SolidColorBrush(Color.FromArgb(255, 170, 147, 255));        private SolidColorBrush _PBk = new SolidColorBrush(Color.FromArgb(255, 2, 255, 255));        private SolidColorBrush _M1Bk = new SolidColorBrush(Color.FromArgb(255, 3, 149, 255));        private SolidColorBrush _M2Bk = new SolidColorBrush(Color.FromArgb(255, 255, 111, 171));        private SolidColorBrush _DefaultdBk = new SolidColorBrush(Colors.White);        #endregion        public RecipeDataLayout CurrentRecipe { get; set; } = new RecipeDataLayout();        public RecipeLayoutEntityNormal NormalEntity { get { return CurrentRecipe.NormalSteps[0]; } set { CurrentRecipe.NormalSteps[0] = value; this.NotifyOfPropertyChange(nameof(NormalEntity)); } }        private List<BoatWaferItem> _boatWafers = new List<BoatWaferItem>();        public List<BoatWaferItem> BoatWafers        {            get            {                _boatWafers.Clear();                foreach (var item in CurrentRecipe.ExpertSteps[0].Items)                {                    _boatWafers.Add(item);                }                _boatWafers.Reverse();                return _boatWafers;            }            set            {                CurrentRecipe.ExpertSteps[0].Items = value;            }        }        public bool IsEnable => CGlobal.RecipeLayoutEditViewEnable;//是否是View模式        public SlotType SelectSlotType { get; set; } = SlotType.Space;        private int _cassetteSlotCount;        private int _productSlotCount = 0;        public int ProductSlotCount        {            get => _productSlotCount;            set            {                _productSlotCount = value;                NotifyOfPropertyChange(nameof(ProductSlotCount));            }        }        private int _monitor1SlotCount = 0;        public int Monitor1SlotCount        {            get => _monitor1SlotCount;            set            {                _monitor1SlotCount = value;                NotifyOfPropertyChange(nameof(Monitor1SlotCount));            }        }        private int _monitor2SlotCount = 0;        public int Monitor2SlotCount        {            get => _monitor2SlotCount;            set            {                _monitor2SlotCount = value;                NotifyOfPropertyChange(nameof(Monitor2SlotCount));            }        }        private int _sDDummySlotCount = 0;        public int SDDummySlotCount        {            get => _sDDummySlotCount;            set            {                _sDDummySlotCount = value;                NotifyOfPropertyChange(nameof(SDDummySlotCount));            }        }        private int _fDDummySlotCount = 0;        public int FDDummySlotCount        {            get => _fDDummySlotCount;            set            {                _fDDummySlotCount = value;                NotifyOfPropertyChange(nameof(FDDummySlotCount));            }        }        private int _noneSlotCount = 0;        public int NoneSlotCount        {            get => _noneSlotCount;            set            {                _noneSlotCount = value;                NotifyOfPropertyChange(nameof(NoneSlotCount));            }        }        private bool _isSelectOnePiece=true;        public bool IsSelectOnePiece        {            get => _isSelectOnePiece;            set            {                _isSelectOnePiece = value;                NotifyOfPropertyChange(nameof(IsSelectOnePiece));            }        }        public void SlotSelectTypeChecked(string cmd)        {            switch (cmd)            {                case "Zone":                    IsSelectOnePiece = false;                    break;                case "1Piece":                    IsSelectOnePiece = true;                    break;                default:                    break;            }        }        public ObservableCollection<string> listBoatWafers { get; set; } = new ObservableCollection<string>();        public RecipeFormatBuilder ColumnBuilder { get; set; }        public RecipeLayoutBoatMapViewModel(string strPrefixPath, string strName, RecipeFormatBuilder columnBuilder, string permission = "")        {            WaferNumberAll = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");            _cassetteSlotCount = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount");            ColumnBuilder = columnBuilder;            LoadData(strPrefixPath, strName, permission);            ProductPositionAuto = NormalEntity.ProductPosition == "Auto";            ProductPositionSlot = NormalEntity.ProductPosition == "Slot";            MonitorPositionAuto = NormalEntity.MonitorPosition == "Auto";            MonitorPositionSlot = NormalEntity.MonitorPosition == "Slot";            NormalEntity.ProductPosition = "Slot";            NormalEntity.MonitorPosition = "Slot";            NormalEntity.DummyLowerSlot = "0";            NormalEntity.DummyUpperSlot = "0";            NormalEntity.CenteringSlotPosition = "0";            SpaceSlotEnabled = ProductPositionSlot || MonitorPositionSlot;        }        private void LoadData(string strPrefixPath, string strName, string permission)        {            CurrentRecipe.Clear();            CurrentRecipe.PrefixPath = strPrefixPath;            CurrentRecipe.Name = strName;            CurrentRecipe.RecipePermission = permission;            var recipeContent = _recipeProvider.LoadRecipe(strPrefixPath, strName);            if (string.IsNullOrEmpty(recipeContent))            {                System.Windows.MessageBox.Show($"{CurrentRecipe.PrefixPath}\\{CurrentRecipe.Name} is empty, please confirm the file is valid.");                return;            }            CurrentRecipe.RecipeChamberType = "OriginChamber";            CurrentRecipe.InitData(CurrentRecipe.PrefixPath, CurrentRecipe.Name, recipeContent, ColumnBuilder.Configs, "PM1");            if (CurrentRecipe.ExpertSteps.Count == 0 || CurrentRecipe.ExpertSteps[0].Items.Count != WaferNumberAll)            {                CurrentRecipe.ExpertSteps.Clear();                RecipeLayoutEntityExpert expert = new RecipeLayoutEntityExpert();                CurrentRecipe.ExpertSteps.Add(expert);                for (int i = 0; i < WaferNumberAll; i++)                {                    BoatWaferItem item = new BoatWaferItem() { Slot = i + 1, Description = $"" };                    CurrentRecipe.ExpertSteps[0].Items.Add(item);                }            }            if (CurrentRecipe.NormalSteps.Count == 0 || CurrentRecipe.ExpertSteps[0].Items.Count <= 0)            {                RecipeLayoutEntityNormal normal = new RecipeLayoutEntityNormal();                CurrentRecipe.NormalSteps.Add(normal);            }        }        protected override void OnActivate()        {            base.OnActivate();            RefreshBoatWafers();        }        private int oldCurrentItemIndex;        private bool firstSelectCurrentItem = false;        private SlotType oldSlotType = SlotType.Space;        public void SelecteSlot()        {            if (IsSelectOnePiece)            {                SelecteOneSlot();            }            else            {                SelecteMoreSlot();            }        }        private void SelecteOneSlot()        {            switch (SelectSlotType)            {                case SlotType.P:                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, currentItemIndex);                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex-1].BkColor = _PBk;                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "PD";                    break;                case SlotType.M1:                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, currentItemIndex);                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M1Bk;                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M1";                    break;                case SlotType.M2:                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, currentItemIndex);                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M2Bk;                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M2";                    break;                case SlotType.SD:                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, currentItemIndex);                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _SDBk;                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "SD";                    break;                case SlotType.FD:                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, currentItemIndex);                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _FDBk;                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "FD";                    break;                case SlotType.Space:                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _DefaultdBk;                    CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "----";                    break;            }            oldSlotType = SelectSlotType;            oldCurrentItemIndex = currentItemIndex;            this.RefreshBoatWafers();        }        private void SelecteMoreSlot()        {            List<string> listWafers = QueryDataClient.Instance.Service.GetLayoutRecipeContent(CurrentRecipe.GetXmlString(), WaferNumberAll.ToString(), _cassetteSlotCount.ToString());            int fristValue = currentItemIndex < oldCurrentItemIndex ? currentItemIndex : oldCurrentItemIndex;            int endValue = currentItemIndex < oldCurrentItemIndex ? oldCurrentItemIndex : currentItemIndex;            List<string> tempWafers = new List<string>();            if (currentItemIndex > oldCurrentItemIndex)            {                tempWafers = listWafers.TakeWhile((n, index) => index < endValue).SkipWhile((n, index) => index < fristValue).ToList();            }            else            {                tempWafers = listWafers.TakeWhile((n, index) => index < endValue - 1).SkipWhile((n, index) => index < fristValue - 1).ToList();            }            if (firstSelectCurrentItem == true && tempWafers.Count>1)//tempWafers.Where(x => !string.IsNullOrEmpty(x)).Count() == 0 && firstSelectCurrentItem == true            {                for (int i = fristValue; i < endValue; i++)                {                    switch (SelectSlotType)                    {                        case SlotType.P:                            NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, i);                            NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                            NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                            NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                            NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _PBk;                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "PD";                            break;                        case SlotType.M1:                            NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, i);                            NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                            NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                            NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                            NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M1Bk;                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M1";                            break;                        case SlotType.M2:                            NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, i);                            NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                            NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                            NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                            NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M2Bk;                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M2";                            break;                        case SlotType.SD:                            NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, i);                            NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                            NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                            NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                            NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _SDBk;                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "SD";                            break;                        case SlotType.FD:                            NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, i);                            NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                            NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                            NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                            NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _FDBk;                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "FD";                            break;                        case SlotType.Space:                            NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                            NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                            NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                            NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                            NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _DefaultdBk;                            CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "----";                            break;                    }                }                firstSelectCurrentItem = false;            }            else            {                switch (SelectSlotType)                {                    case SlotType.P:                        NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, currentItemIndex);                        NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                        NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                        NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                        NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _PBk;                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "PD";                        break;                    case SlotType.M1:                        NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, currentItemIndex);                        NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                        NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                        NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                        NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M1Bk;                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M1";                        break;                    case SlotType.M2:                        NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                        NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, currentItemIndex);                        NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                        NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                        NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _M2Bk;                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "M2";                        break;                    case SlotType.SD:                        NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, currentItemIndex);                        NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                        NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                        NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                        NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _SDBk;                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "SD";                        break;                    case SlotType.FD:                        NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, currentItemIndex);                        NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                        NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                        NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                        NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _FDBk;                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "FD";                        break;                    case SlotType.Space:                        NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                        NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, currentItemIndex);                        NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, currentItemIndex);                        NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, currentItemIndex);                        NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, currentItemIndex);                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].BkColor = _DefaultdBk;                        CurrentRecipe.ExpertSteps[0].Items[currentItemIndex - 1].Description = "----";                        break;                }                firstSelectCurrentItem = true;            }            oldCurrentItemIndex = currentItemIndex;            this.RefreshBoatWafers();        }        public void SetCommand(object obj)        {            WindowManager wm = new WindowManager();            switch (obj.ToString())            {                case "AllClear":                    int index = 0;                    foreach (var item in BoatWafers)                    {                        CurrentRecipe.ExpertSteps[0].Items[index].BkColor = _DefaultdBk;                        CurrentRecipe.ExpertSteps[0].Items[index].Description = "----";                        NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, index + 1);                        NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, index + 1);                        NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, index + 1);                        NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, index + 1);                        NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, index + 1);                        index++;                    }                    oldSlotType = SlotType.Space;                    break;                case "Wafer Charge Rule":                    RecipeWaferChargeRuleViewModel viewWaferChargeRule = new RecipeWaferChargeRuleViewModel();                    viewWaferChargeRule.NormalEntity = NormalEntity;                    wm.ShowDialogWithTitle(viewWaferChargeRule, null, obj.ToString());                    break;                case "SetAll":                    for (int i = 0; i < BoatWafers.Count; i++)                    {                        switch (SelectSlotType)                        {                            case SlotType.P:                                NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, i + 1);                                NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1);                                NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1);                                NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1);                                NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1);                                CurrentRecipe.ExpertSteps[0].Items[i].Description = "PD";                                CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _PBk;                                break;                            case SlotType.M1:                                NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, i + 1);                                NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1);                                NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1);                                NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1);                                NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1);                                CurrentRecipe.ExpertSteps[0].Items[i].Description = "M1";                                CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M1Bk;                                break;                            case SlotType.M2:                                NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1);                                NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, i + 1);                                NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1);                                NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1);                                NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1);                                CurrentRecipe.ExpertSteps[0].Items[i].Description = "M2";                                CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M2Bk;                                break;                            case SlotType.SD:                                NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, i + 1);                                NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1);                                NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1);                                NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1);                                NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1);                                CurrentRecipe.ExpertSteps[0].Items[i].Description = "SD";                                CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _SDBk;                                break;                            case SlotType.FD:                                NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, i + 1);                                NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1);                                NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1);                                NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1);                                NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1);                                CurrentRecipe.ExpertSteps[0].Items[i].Description = "FD";                                CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _FDBk;                                break;                            case SlotType.Space:                                NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i + 1);                                NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i + 1);                                NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i + 1);                                NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i + 1);                                NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i + 1);                                CurrentRecipe.ExpertSteps[0].Items[i].Description = "----";                                CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _DefaultdBk;                                break;                            default:                                break;                        }                    }                    break;                case "Set":                    if (fromIndex != 0 && toIndex != 0 && fromIndex <= toIndex)                    {                        for (int i = fromIndex - 1; i < toIndex; i++)                        {                            //  BoatWafers[i].Description = SelectSlotType.ToString();                            switch (SelectSlotType)                            {                                case SlotType.P:                                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add", NormalEntity.ProductSlotNo, i);                                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                                    CurrentRecipe.ExpertSteps[0].Items[i].Description = "PD";                                    CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _PBk;                                    break;                                case SlotType.M1:                                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor1SlotNo, i);                                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                                    CurrentRecipe.ExpertSteps[0].Items[i].Description = "M1";                                    CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M1Bk;                                    break;                                case SlotType.M2:                                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Add", NormalEntity.Monitor2SlotNo, i);                                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                                    CurrentRecipe.ExpertSteps[0].Items[i].Description = "M2";                                    CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M2Bk;                                    break;                                case SlotType.SD:                                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.SDDummySlotNo, i);                                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                                    CurrentRecipe.ExpertSteps[0].Items[i].Description = "SD";                                    CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _SDBk;                                    break;                                case SlotType.FD:                                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Add", NormalEntity.FDDummySlotNo, i);                                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                                    CurrentRecipe.ExpertSteps[0].Items[i].Description = "FD";                                    CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _FDBk;                                    break;                                case SlotType.Space:                                    NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, i);                                    NormalEntity.Monitor1SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor1SlotNo, i);                                    NormalEntity.Monitor2SlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.Monitor2SlotNo, i);                                    NormalEntity.SDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.SDDummySlotNo, i);                                    NormalEntity.FDDummySlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.FDDummySlotNo, i);                                    CurrentRecipe.ExpertSteps[0].Items[i].Description = "----";                                    CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _DefaultdBk;                                    break;                                default:                                    break;                            }                        }                    }                    break;            }            this.RefreshBoatWafers();        }        private int fromIndex = 0;        private int toIndex = 0;        public void BoatWafersTextChanged(object sender)        {            //if (sender is TextBox)            //{            //    var boatWaferTxt = sender as TextBox;            //    switch (boatWaferTxt.Name)            //    {            //        case "TxtFrom":            //            fromIndex = int.Parse(boatWaferTxt.Text);            //            break;            //        case "TxtTo":            //            toIndex = int.Parse(boatWaferTxt.Text);            //            break;            //        default:            //            break;            //    }            //}        }        private string ProccessSlotNoPositionString(string strType, string str, int iCurrentItemIndex)        {            if (iCurrentItemIndex <= 0) return str;            if (string.IsNullOrEmpty(str))            {                if (strType == "Add")                { return iCurrentItemIndex.ToString(); }                else if (strType == "Delete")                {                    return str;                }            }            List<string> selectIndexNoStr = new List<string>(str.Split(','));            List<int> selectIndex = new List<int>();            selectIndexNoStr.ForEach(x =>            {                if (selectIndex.Where(value => value == int.Parse(x)).Count() == 0)                {                    selectIndex.Add(int.Parse(x));                }            }            );            if (strType == "Add")            {                if (selectIndex.Where(value => value == iCurrentItemIndex).Count() == 0)                {                    selectIndex.Add(iCurrentItemIndex);                }            }            else            {                if (selectIndex.Where(value => value == iCurrentItemIndex).Count() != 0)                {                    selectIndex.Remove(iCurrentItemIndex);                }            }            selectIndex.Sort();            return string.Join(",", selectIndex);        }        public void RefreshBoatWafers()        {            List<string> listWafers = QueryDataClient.Instance.Service.GetLayoutRecipeContent(CurrentRecipe.GetXmlString(), WaferNumberAll.ToString(), _cassetteSlotCount.ToString());            WaferNumberP = WaferNumberM = WaferNumberSD = WaferNumberED = 0;            if (listWafers.Count <= 0 || (CurrentRecipe.ExpertSteps.Count <= 0 && CurrentRecipe.NormalSteps.Count <= 0)) return;            CurrentRecipe.NormalSteps[0].ProductSlotNo = string.Empty;            CurrentRecipe.NormalSteps[0].Monitor1SlotNo = string.Empty;            for (int i = 0; i < listWafers.Count; i++)            {                CurrentRecipe.ExpertSteps[0].Items[i].Slot = i + 1;                CurrentRecipe.ExpertSteps[0].Items[i].Description = listWafers[i].ToString() == "" ? "----" : listWafers[i].ToString();                switch (listWafers[i].ToString())                {                    case "PD":                        CurrentRecipe.NormalSteps[0].ProductSlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].ProductSlotNo, i + 1);                        CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _PBk;                        WaferNumberP++;                        break;                    case "M1":                        CurrentRecipe.NormalSteps[0].Monitor1SlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].Monitor1SlotNo, i + 1);                        CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M1Bk;                        WaferNumberM++;                        break;                    case "M2":                        CurrentRecipe.NormalSteps[0].Monitor2SlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].Monitor2SlotNo, i + 1);                        CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _M2Bk;                        WaferNumberM++;                        break;                    case "SD":                        CurrentRecipe.NormalSteps[0].SDDummySlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].SDDummySlotNo, i + 1);                        CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _SDBk;                        WaferNumberSD++;                        break;                    case "FD":                        CurrentRecipe.NormalSteps[0].FDDummySlotNo = ProccessSlotNoPositionString("Add", CurrentRecipe.NormalSteps[0].FDDummySlotNo, i + 1);                        CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _FDBk;                        WaferNumberED++;                        break;                    default:                        CurrentRecipe.ExpertSteps[0].Items[i].BkColor = _DefaultdBk;                        break;                }            }            SDDummySlotCount = listWafers.Where(x => x == "SD").Count();            FDDummySlotCount = listWafers.Where(x => x == "FD").Count();            ProductSlotCount = listWafers.Where(x => x == "PD").Count();            Monitor1SlotCount = listWafers.Where(x => x == "M1").Count();            Monitor2SlotCount = listWafers.Where(x => x == "M2").Count();            NoneSlotCount = listWafers.Where(x => x == "----" || string.IsNullOrEmpty(x)).Count();            listBoatWafers.Clear();            listWafers.ForEach(x => listBoatWafers.Add(x)); ;        }        public void EndEdit()        {            //if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].DummyLowerSlot))            //{            //    DialogBox.ShowWarning("DummyLowerSlot is empty,can not save!");            //    return;            //}            //if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].DummyUpperSlot))            //{            //    DialogBox.ShowWarning("DummyUpperSlot is empty,can not save!");            //    return;            //}            //if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].CenteringSlotPosition))            //{            //    DialogBox.ShowWarning("CenteringSlotPosition is empty,can not save!");            //    return;            //}            //if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].ProductPosition))            //{            //    DialogBox.ShowWarning("ProductPosition is empty,can not save!");            //    return;            //}            //if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].MonitorPosition))            //{            //    DialogBox.ShowWarning("MonitorPosition is empty,can not save!");            //    return;            //}            if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenCassetteInBatchAreShort))            {                DialogBox.ShowWarning("WhenCassetteInBatchAreShort is empty,can not save!");                return;            }            if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenPWaferShort))            {                DialogBox.ShowWarning("WhenPWaferShort is empty,can not save!");                return;            }            if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenWaferInCassetteAreShort))            {                DialogBox.ShowWarning("WhenWaferInCassetteAreShort is empty,can not save!");                return;            }            if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].WhenEDAreShort))            {                DialogBox.ShowWarning("WhenEDAreShort is empty,can not save!");                return;            }            if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].SDRule))            {                DialogBox.ShowWarning("SDRule is empty,can not save!");                return;            }            if (string.IsNullOrEmpty(CurrentRecipe.NormalSteps[0].RuleOfSpaceInBoat))            {                DialogBox.ShowWarning("RuleOfSpaceInBoat is empty,can not save!");                return;            }            RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", CurrentRecipe.RecipePermission);            WindowManager wm = new WindowManager();            bool? dialogReturn = wm.ShowDialog(dialog);            if (!dialogReturn.HasValue || !dialogReturn.Value)                return;            CurrentRecipe.IsSavedDesc = false;            this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;            this.CurrentRecipe.ReviseTime = DateTime.Now;            //this.CurrentRecipe.RecipeLevel = this.LevelDisplay;            this.CurrentRecipe.RecipePermission = dialog.RecipePermission;            this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString());            ((Window)GetView()).DialogResult = true;        }        public void CancelClick()        {            if (DialogBox.ShowDialog(DialogButton.Yes | DialogButton.No, DialogType.CONFIRM, " You confirm that you want to unsave the recipe and exit the interface?") == DialogButton.No)                return;            ((Window)GetView()).Close();        }        public void SaveClick()        {            EndEdit();        }        public void RdoChecked(string cmd)        {            SlotType slotType = SlotType.Space;            Enum.TryParse(cmd, out slotType);            SelectSlotType = slotType;        }    }    public enum SlotType    {        SD,        FD,        P,        M1,        M2,        Space    }    public class BoatWaferItem : NotifiableItem    {        private int _slot;        public int Slot        {            get => _slot;            set            {                _slot = value;                InvokePropertyChanged("Slot");            }        }        private string _description;        public string Description        {            get => _description;            set            {                _description = value;                InvokePropertyChanged("Description");            }        }        private bool _hasWafer;        public bool HasWafer        {            get => _hasWafer;            set            {                _hasWafer = value;                InvokePropertyChanged("HasWafer");            }        }        private bool _noWafer;        public bool NoWafer        {            get => _noWafer;            set            {                _noWafer = value;                InvokePropertyChanged("NoWafer");            }        }        private SolidColorBrush _bkColor;        public SolidColorBrush BkColor        {            get => _bkColor;            set            {                _bkColor = value;                InvokePropertyChanged("BkColor");            }        }    }}
 |