| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263 | 
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.Windows.Controls;using FurnaceUI.Views.DataLog;using System.Linq;using RecipeEditorLib.RecipeModel.Params;using System.Collections.ObjectModel;using FurnaceUI.Client.Dialog;using SciChart.Core.Extensions;namespace FurnaceUI.Views.Recipes{    public class RecipeLayoutEditViewModel : FurnaceUIViewModelBase    {        #region properties        private string _recipeName;        public string RecipeName        {            get => _recipeName;            set            {                _recipeName = value;                NotifyOfPropertyChange(nameof(RecipeName));            }        }        public int FoupListMaxValue { get; set; }        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 waferNumberM;        public int WaferNumberM { get { return waferNumberM; } set { waferNumberM = value; NotifyOfPropertyChange(nameof(waferNumberM)); } }        private int currentItemIndex;        private string SelectedSlotType { get; set; }        private RecipeProvider _recipeProvider = new RecipeProvider();        private SolidColorBrush _DefaultdBk = new SolidColorBrush(Colors.White);        private SolidColorBrush _PBk = new SolidColorBrush(Colors.SkyBlue);        private SolidColorBrush _SDBk = new SolidColorBrush(Colors.White);        private SolidColorBrush _EDBk = new SolidColorBrush(Colors.Yellow);        private SolidColorBrush _MBk = new SolidColorBrush(Colors.Pink);        private SolidColorBrush _XDBk = new SolidColorBrush(Colors.White);        private SolidColorBrush _TBk = new SolidColorBrush(Colors.DarkGreen);        #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)); } }        public List<BoatWaferItem> BoatWafers { get { return CurrentRecipe.ExpertSteps[0].Items; } set { CurrentRecipe.ExpertSteps[0].Items = value; } }        private bool _IsStandardPitchEnabled = true;        public bool IsStandardPitchEnabled        {            get => _IsStandardPitchEnabled;            set            {                _IsStandardPitchEnabled = value;                NotifyOfPropertyChange(nameof(IsStandardPitchEnabled));            }        }        private bool _IsDoublePitchEnabled;        public bool IsDoublePitchEnabled        {            get => _IsDoublePitchEnabled;            set            {                _IsDoublePitchEnabled = value;                NotifyOfPropertyChange(nameof(IsDoublePitchEnabled));            }        }        private bool _IsTriplePitchEnabled;        public bool IsTriplePitchEnabled        {            get => _IsTriplePitchEnabled;            set            {                _IsTriplePitchEnabled = value;                NotifyOfPropertyChange(nameof(IsTriplePitchEnabled));            }        }        public bool IsEnable => CGlobal.RecipeLayoutEditViewEnable;//是否是View模式        private int _cassetteSlotCount;        private TotalWaferNumberMode _totalWaferNumber = TotalWaferNumberMode.Total;        public TotalWaferNumberMode TotalWaferNumber        {            get => _totalWaferNumber;            set            {                _totalWaferNumber = value;                NotifyOfPropertyChange(nameof(TotalWaferNumber));            }        }        private string _totalWaferNumberValue = "";        public string TotalWaferNumberValue        {            get => _totalWaferNumberValue;            set            {                _totalWaferNumberValue = value;                NotifyOfPropertyChange(nameof(TotalWaferNumberValue));            }        }        private LayoutReplacement _setLayoutReplacement = LayoutReplacement.Upper;        public LayoutReplacement SetLayoutReplacement        {            get => _setLayoutReplacement;            set            {                _setLayoutReplacement = value;                NotifyOfPropertyChange(nameof(SetLayoutReplacement));            }        }        private string _setLayoutReplacementValue = "";        public string SetLayoutReplacementValue        {            get => _setLayoutReplacementValue;            set            {                _setLayoutReplacementValue = value;                NotifyOfPropertyChange(nameof(SetLayoutReplacementValue));            }        }        private MonitorTransferType _waferChargeMonitor1 = MonitorTransferType.AutoLayout;        public MonitorTransferType WaferChargeMonitor1        {            get => _waferChargeMonitor1;            set            {                _waferChargeMonitor1 = value;                NotifyOfPropertyChange(nameof(WaferChargeMonitor1));            }        }        private string _waferChargeMonitorValue1 = "";        public string WaferChargeMonitorValue1        {            get => _waferChargeMonitorValue1;            set            {                _waferChargeMonitorValue1 = value;                NotifyOfPropertyChange(nameof(WaferChargeMonitorValue1));            }        }        private MonitorTransferType _waferChargeMonitor2 = MonitorTransferType.AutoLayout;        public MonitorTransferType WaferChargeMonitor2        {            get => _waferChargeMonitor2;            set            {                _waferChargeMonitor2 = value;                NotifyOfPropertyChange(nameof(WaferChargeMonitor2));            }        }        private string _waferChargeMonitorValue2 = "";        public string WaferChargeMonitorValue2        {            get => _waferChargeMonitorValue2;            set            {                _waferChargeMonitorValue2 = value;                NotifyOfPropertyChange(nameof(WaferChargeMonitorValue2));            }        }        private string _fillDummyTransferStr = "None";        public string FillDummyTransferStr        {            get => _fillDummyTransferStr;            set            {                _fillDummyTransferStr = value;                NotifyOfPropertyChange(nameof(FillDummyTransferStr));            }        }        private string _productZeroStr;        public string ProductZeroStr        {            get => _productZeroStr;            set            {                _productZeroStr = value;                NotifyOfPropertyChange(nameof(ProductZeroStr));            }        }        private string _ProductTransferStr;        public string ProductTransferStr        {            get => _ProductTransferStr;            set            {                _ProductTransferStr = value;                NotifyOfPropertyChange(nameof(ProductTransferStr));            }        }        private MonitorReturnType _dialogResultmonitor1 = MonitorReturnType.ChargeSlot;        public MonitorReturnType DialogResultmonitor1        {            get => _dialogResultmonitor1;            set            {                _dialogResultmonitor1 = value;                NotifyOfPropertyChange(nameof(DialogResultmonitor1));            }        }        private MonitorReturnType _dialogResultmonitor2 = MonitorReturnType.ChargeSlot;        public MonitorReturnType DialogResultmonitor2        {            get => _dialogResultmonitor2;            set            {                _dialogResultmonitor2 = value;                NotifyOfPropertyChange(nameof(DialogResultmonitor2));            }        }        private string _yAxisModeStr = "Normal";        public string YAxisModeStr        {            get => _yAxisModeStr;            set            {                _yAxisModeStr = value;                NotifyOfPropertyChange(nameof(YAxisModeStr));            }        }        private int _topSlotNo = 149;        public int TopSlotNo        {            get => _topSlotNo;            set            {                _topSlotNo = value;                NotifyOfPropertyChange(nameof(TopSlotNo));            }        }        private int _upperSideDummyNum = 3;        public int UpperSideDummyNum        {            get => _upperSideDummyNum;            set            {                _upperSideDummyNum = value;                NotifyOfPropertyChange(nameof(UpperSideDummyNum));            }        }        private int _boatTotalSlot = 143;        public int BoatTotalSlot        {            get => _boatTotalSlot;            set            {                _boatTotalSlot = value;                NotifyOfPropertyChange(nameof(BoatTotalSlot));            }        }        private int _upperSDNum = 0;        public int UpperSDNum        {            get => _upperSDNum;            set            {                _upperSDNum = value;                NotifyOfPropertyChange(nameof(UpperSDNum));            }        }        private int _productNum = 0;        public int ProductNum        {            get => _productNum;            set            {                _productNum = value;                NotifyOfPropertyChange(nameof(ProductNum));            }        }        private int _monitorNum1 = 0;        public int MonitorNum1        {            get => _monitorNum1;            set            {                _monitorNum1 = value;                NotifyOfPropertyChange(nameof(MonitorNum1));            }        }        private int _monitorNum2 = 0;        public int MonitorNum2        {            get => _monitorNum2;            set            {                _monitorNum2 = value;                NotifyOfPropertyChange(nameof(MonitorNum2));            }        }        private int _lowerSDNum = 0;        public int LowerSDNum        {            get => _lowerSDNum;            set            {                _lowerSDNum = value;                NotifyOfPropertyChange(nameof(LowerSDNum));            }        }        private int _lowerSideDummyNum = 9;        public int LowerSideDummyNum        {            get => _lowerSideDummyNum;            set            {                _lowerSideDummyNum = value;                NotifyOfPropertyChange(nameof(LowerSideDummyNum));            }        }        private List<string> _boatMapWafers = new List<string>();        public List<string> BoatMapWafers        {            get => _boatMapWafers;            set            {                _boatMapWafers = value;                NotifyOfPropertyChange(nameof(BoatMapWafers));            }        }        public RecipeFormatBuilder ColumnBuilder { get; set; }        public RecipeLayoutEditViewModel(string strPrefixPath, string strName, RecipeFormatBuilder columnBuilder, string permission = "")        {            FoupListMaxValue = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");            _cassetteSlotCount = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount");            RecipeName = strName;            ColumnBuilder = columnBuilder;            LoadData(strPrefixPath, strName, permission);        }        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");            var waferNumberAll = (int)QueryDataClient.Instance.Service.GetConfig("Boat.SlotCount");            var cassetteSlotCount = (int)QueryDataClient.Instance.Service.GetConfig("System.CassetteSlotCount");            List<string> listWafers = QueryDataClient.Instance.Service.GetLayoutRecipeContent(CurrentRecipe.GetXmlString(), waferNumberAll.ToString(), cassetteSlotCount.ToString());            BoatMapWafers = listWafers;            if (CurrentRecipe.ExpertSteps.Count == 0 || CurrentRecipe.ExpertSteps[0].Items.Count <= 0)            {                RecipeLayoutEntityExpert expert = new RecipeLayoutEntityExpert();                CurrentRecipe.ExpertSteps.Add(expert);                for (int i = 0; i < FoupListMaxValue; 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);            }            if (CurrentRecipe.ConfigItems != null && CurrentRecipe.ConfigItems.Count > 0)            {                var asd = CurrentRecipe.ConfigItems.Select(a => a.Name).ToList();                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").Count() > 0)                {                    BoatTotalSlot = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").Count() > 0)                {                    UpperSDNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").Count() > 0)                {                    ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").Count() > 0)                {                    ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").Count() > 0)                {                    ProductNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").Count() > 0)                {                    LowerSDNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").Count() > 0)                {                    TopSlotNo = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").Count() > 0)                {                    UpperSideDummyNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").Count() > 0)                {                    IsDispTypeEnabled = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").FirstOrDefault()).Value == 0 ? true : false;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").Count() > 0)                {                    LowerSideDummyNum = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").FirstOrDefault()).Value;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value))                    {                        TotalWaferNumber = TotalWaferNumberMode.Total;                    }                    else                    {                        TotalWaferNumber = (TotalWaferNumberMode)Enum.Parse(typeof(TotalWaferNumberMode), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value);                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").Count() > 0)                {                    if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value))                    {                        TotalWaferNumberValue = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value;                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value))                    {                        SetLayoutReplacement = LayoutReplacement.Upper;                    }                    else                    {                        SetLayoutReplacement = (LayoutReplacement)Enum.Parse(typeof(LayoutReplacement), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value);                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").Count() > 0)                {                    if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value))                    {                        SetLayoutReplacementValue = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value;                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value))                    {                        WaferChargeMonitor1 = MonitorTransferType.AutoLayout;                    }                    else                    {                        WaferChargeMonitor1 = (MonitorTransferType)Enum.Parse(typeof(MonitorTransferType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value);                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").Count() > 0)                {                    if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value))                    {                        WaferChargeMonitorValue1 = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value;                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value))                    {                        WaferChargeMonitor2 = MonitorTransferType.AutoLayout;                    }                    else                    {                        WaferChargeMonitor2 = (MonitorTransferType)Enum.Parse(typeof(MonitorTransferType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value);                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").Count() > 0)                {                    if (!string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value))                    {                        WaferChargeMonitorValue2 = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value;                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value))                    {                        FillDummyTransferStr = "None";                    }                    else                    {                        FillDummyTransferStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value;                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value))                    {                        ProductZeroStr = "None";                    }                    else                    {                        ProductZeroStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value;                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value))                    {                        ProductTransferStr = "None";                    }                    else                    {                        ProductTransferStr = ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value;                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value))                    {                        DialogResultmonitor1 = MonitorReturnType.ChargeSlot;                    }                    else                    {                        DialogResultmonitor1 = (MonitorReturnType)Enum.Parse(typeof(MonitorReturnType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value);                    }                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").Count() > 0)                {                    if (string.IsNullOrEmpty(((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value))                    {                        DialogResultmonitor2 = MonitorReturnType.ChargeSlot;                    }                    else                    {                        DialogResultmonitor2 = (MonitorReturnType)Enum.Parse(typeof(MonitorReturnType), ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value);                    }                }            }            if (null != BoatMapWafers && BoatMapWafers.Count > 0)            {                var data = ComputSD(BoatMapWafers);                 UpperSDNum = listWafers.Where(x => x == "SD").Count();                LowerSDNum = listWafers.Where(x => x == "FD").Count();                ProductNum = listWafers.Where(x => x.StartsWith("P")).Count();                MonitorNum1 = listWafers.Where(x => x == "M1").Count();                MonitorNum2 = listWafers.Where(x => x == "M2").Count();            }        }        protected override void OnActivate()        {            base.OnActivate();        }        public void SetCommand(object obj)        {            WindowManager wm = new WindowManager();            switch (obj.ToString())            {                case "Product Pos":                    RecipeProductPosViewModel viewProduct = new RecipeProductPosViewModel();                    viewProduct.NormalEntity = NormalEntity;                    wm.ShowDialogWithTitle(viewProduct, null, obj.ToString());                    SelectedSlotType = "";                    break;                case "Monitor Pos":                    RecipeMonitorPosViewModel viewMonitor = new RecipeMonitorPosViewModel();                    viewMonitor.NormalEntity = NormalEntity;                    wm.ShowDialogWithTitle(viewMonitor, null, obj.ToString());                    SelectedSlotType = obj.ToString();                    break;                case "All Clear":                    NormalEntity = new RecipeLayoutEntityNormal()                    {                        WhenPWaferShort = NormalEntity.WhenPWaferShort,                        SDRule = NormalEntity.SDRule,                        WhenCassetteInBatchAreShort = NormalEntity.WhenCassetteInBatchAreShort,                        WhenWaferInCassetteAreShort = NormalEntity.WhenWaferInCassetteAreShort,                        WhenEDAreShort = NormalEntity.WhenEDAreShort,                        RuleOfSpaceInBoat = NormalEntity.RuleOfSpaceInBoat,                    };                    foreach (var item in BoatWafers)                    {                        item.Description = "";                    }                    SelectedSlotType = obj.ToString();                    break;                case "Wafer Charge Rule":                    RecipeWaferChargeRuleViewModel viewWaferChargeRule = new RecipeWaferChargeRuleViewModel();                    viewWaferChargeRule.NormalEntity = NormalEntity;                    wm.ShowDialogWithTitle(viewWaferChargeRule, null, obj.ToString());                    SelectedSlotType = obj.ToString();                    break;                case "Product":                    //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Add",NormalEntity.ProductSlotNo,currentItemIndex);                    //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.MonitorSlotNo,currentItemIndex);                    SelectedSlotType = obj.ToString();                    break;                case "Monitor":                    //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Add",NormalEntity.MonitorSlotNo, currentItemIndex);                    //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                    SelectedSlotType = obj.ToString();                    break;                case "Space":                    //NormalEntity.ProductSlotNo = ProccessSlotNoPositionString("Delete", NormalEntity.ProductSlotNo, currentItemIndex);                    //NormalEntity.MonitorSlotNo = ProccessSlotNoPositionString("Delete",NormalEntity.MonitorSlotNo, currentItemIndex);                    SelectedSlotType = obj.ToString();                    break;            }        }        private string ProccessSlotNoPositionString(string strType, string str, int iCurrentItemIndex)        {            string strRet = "";            if (iCurrentItemIndex <= 0) return strRet;            string strOrgTemp = "," + str;            string strDesTemp = "," + iCurrentItemIndex;            string strComTemp = "," + iCurrentItemIndex + ",";            if (strType == "Add")            {                if (!strOrgTemp.Contains(strComTemp))                    strOrgTemp = strOrgTemp + strDesTemp;            }            else            {                if (strOrgTemp.Contains(strDesTemp))                    strOrgTemp = strOrgTemp.Replace(strDesTemp, "");            }            strRet = strOrgTemp;            for (int i = 0; i < 2; i++)            {                if (strRet.StartsWith(","))                    strRet = strRet.Substring(1);            }            return strRet;        }        public void TextSelectCmdMouseDown(string cmd, object sender)        {            var colsender = (TextBox)sender;            WindowManager wm = new WindowManager();            switch (cmd)            {                case "TotalWaferNumber":                    RecipeLayoutSetTotalWaferNumberViewModel recipeLayoutSetTotalWaferNumberViewModel = new RecipeLayoutSetTotalWaferNumberViewModel();                    recipeLayoutSetTotalWaferNumberViewModel.TotalWaferNumber = TotalWaferNumber;                    recipeLayoutSetTotalWaferNumberViewModel.ReturnValue = TotalWaferNumberValue;                    bool? dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetTotalWaferNumberViewModel, null, "WAP Logic Design");                    if ((bool)dialogReturn)                    {                        TotalWaferNumber = recipeLayoutSetTotalWaferNumberViewModel.DialogResultTotalWaferNumberMode;                        TotalWaferNumberValue = recipeLayoutSetTotalWaferNumberViewModel.ReturnValue;                    }                    break;                case "Replacement":                    RecipeLayoutSetReplacementViewModel recipeLayoutSetReplacementViewModel = new RecipeLayoutSetReplacementViewModel();                    recipeLayoutSetReplacementViewModel.SetLayoutReplacement = SetLayoutReplacement;                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetReplacementViewModel, null, "File Wafer Replacement");                    if ((bool)dialogReturn)                    {                        SetLayoutReplacement = recipeLayoutSetReplacementViewModel.DialogResultLayoutReplacement;                    }                    break;                case "WaferChargeMonitor1":                    RecipeLayoutSetMonitorTransferViewModel recipeLayoutSetMonitorTransferViewModel1 = new RecipeLayoutSetMonitorTransferViewModel();                    recipeLayoutSetMonitorTransferViewModel1.WaferChargeMonitor = WaferChargeMonitor1;                    recipeLayoutSetMonitorTransferViewModel1.WaferChargeMonitorValue = WaferChargeMonitorValue1;                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorTransferViewModel1, null, "Monitor Transfer1");                    if ((bool)dialogReturn)                    {                        WaferChargeMonitor1 = recipeLayoutSetMonitorTransferViewModel1.DialogResultMonitorTransferType;                        WaferChargeMonitorValue1 = recipeLayoutSetMonitorTransferViewModel1.ReturnString;                    }                    break;                case "WaferChargeMonitor2":                    RecipeLayoutSetMonitorTransferViewModel recipeLayoutSetMonitorTransferViewModel2 = new RecipeLayoutSetMonitorTransferViewModel();                    recipeLayoutSetMonitorTransferViewModel2.WaferChargeMonitor = WaferChargeMonitor2;                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorTransferViewModel2, null, "Monitor Transfer2");                    if ((bool)dialogReturn)                    {                        WaferChargeMonitor2 = recipeLayoutSetMonitorTransferViewModel2.DialogResultMonitorTransferType;                        WaferChargeMonitorValue2 = recipeLayoutSetMonitorTransferViewModel2.ReturnString;                    }                    break;                case "MonitorReturn1":                    RecipeLayoutSetMonitorReturnViewModel recipeLayoutSetMonitorReturnViewModel = new RecipeLayoutSetMonitorReturnViewModel();                    recipeLayoutSetMonitorReturnViewModel.DialogResultmonitor = DialogResultmonitor1;                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorReturnViewModel, null, "Monitor Return1");                    if ((bool)dialogReturn)                    {                        DialogResultmonitor1 = recipeLayoutSetMonitorReturnViewModel.DialogResultmonitor;                    }                    break;                case "MonitorReturn2":                    RecipeLayoutSetMonitorReturnViewModel recipeLayoutSetMonitorReturnViewModel2 = new RecipeLayoutSetMonitorReturnViewModel();                    recipeLayoutSetMonitorReturnViewModel2.DialogResultmonitor = DialogResultmonitor2;                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetMonitorReturnViewModel2, null, "Monitor Return2");                    if ((bool)dialogReturn)                    {                        DialogResultmonitor2 = recipeLayoutSetMonitorReturnViewModel2.DialogResultmonitor;                    }                    break;                case "FillDummyTransfer":                    RecipeLayoutSetFillDummyTransferViewModel recipeLayoutSetFillDummyTransferViewModel = new RecipeLayoutSetFillDummyTransferViewModel();                    recipeLayoutSetFillDummyTransferViewModel.FillDummyTransferStr = FillDummyTransferStr;                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetFillDummyTransferViewModel, null, "Fill Dummy Transfer");                    if ((bool)dialogReturn)                    {                        FillDummyTransferStr = recipeLayoutSetFillDummyTransferViewModel.DialogResultString;                    }                    break;                case "ProductZero":                    SelectExistViewModel selectExistViewModel = new SelectExistViewModel();                    selectExistViewModel.ProductZeroStr = ProductZeroStr;                    dialogReturn = wm.ShowDialogWithTitle(selectExistViewModel, null, "Select");                    if ((bool)dialogReturn)                    {                        ProductZeroStr = selectExistViewModel.DialogResultString;                    }                    break;                case "ProductTransfer":                    RecipeLayoutSetProductTransferViewModel recipeLayoutSetProductTransferViewModel = new RecipeLayoutSetProductTransferViewModel();                    recipeLayoutSetProductTransferViewModel.ProductTransferStr = ProductTransferStr;                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutSetProductTransferViewModel, null, "Product Transfer Position");                    if ((bool)dialogReturn)                    {                        ProductTransferStr = recipeLayoutSetProductTransferViewModel.DialogResultString;                    }                    break;                case "Replacement1":                    RecipeLayoutMonitorWaferReplaceViewModel recipeLayoutMonitorWaferReplaceViewModel = new RecipeLayoutMonitorWaferReplaceViewModel();                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutMonitorWaferReplaceViewModel, null, "Monitor Wafer Replace");                    colsender.Text = recipeLayoutMonitorWaferReplaceViewModel.MonitorWaferFillReplace;                    break;                case "Replacement2":                    RecipeLayoutMonitorWaferReplaceViewModel recipeLayoutMonitorWaferReplaceViewModel2 = new RecipeLayoutMonitorWaferReplaceViewModel();                    dialogReturn = wm.ShowDialogWithTitle(recipeLayoutMonitorWaferReplaceViewModel2, null, "Monitor Wafer Replace");                    colsender.Text = recipeLayoutMonitorWaferReplaceViewModel2.MonitorWaferFillReplace;                    break;                case "YAxisMode":                    SelectExpandViewModel selectExpandViewModel = new SelectExpandViewModel();                    dialogReturn = wm.ShowDialogWithTitle(selectExpandViewModel, null, "Select");                    if ((bool)dialogReturn)                    {                        YAxisModeStr = selectExpandViewModel.DialogResultString;                    }                    break;                default:                    break;            }        }        public void BoatMapMouseDown()        {            WindowManager wm = new WindowManager();            if (CurrentRecipe != null)            {                RecipeLayoutBoatMapViewModel recipeLayoutBoatMapViewModel = new RecipeLayoutBoatMapViewModel(CurrentRecipe.PrefixPath, CurrentRecipe.Name, ColumnBuilder);                var dialogReturn = wm.ShowDialogWithTitle(recipeLayoutBoatMapViewModel, null, "Boat Map Direct Edit");                if ((bool)dialogReturn)                {                    BoatMapWafers = recipeLayoutBoatMapViewModel.listBoatWafers.ToList();                    CurrentRecipe = recipeLayoutBoatMapViewModel.CurrentRecipe;                    ProductNum = recipeLayoutBoatMapViewModel.ProductSlotCount;                    MonitorNum1 = recipeLayoutBoatMapViewModel.Monitor1SlotCount;                    MonitorNum2 = recipeLayoutBoatMapViewModel.Monitor2SlotCount;                    var data = ComputSD(BoatMapWafers);                    LowerSDNum = data.Item1;                    UpperSDNum = data.Item2;                }            }        }        private Tuple<int, int> ComputSD(List<string> dataSource)        {            List<string> otherSlot = dataSource.Where(a => a != "SD" && !string.IsNullOrEmpty(a)).ToList().Distinct().ToList();            if (dataSource == null || dataSource.Count == 0)            {                return new Tuple<int, int>(0, 0);            }            List<int> minList = new List<int>();            for (int i = 0; i < dataSource.Count; i++)            {                var item = dataSource[i];                if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))                {                    break;                }                if (string.IsNullOrEmpty(item))                {                    continue;                }                minList.Add(i);            }            dataSource.Reverse();            List<int> maxList = new List<int>();            for (int i = 0; i < dataSource.Count; i++)            {                var item = dataSource[i];                if (otherSlot.Contains(item) && !string.IsNullOrEmpty(item))                {                    break;                }                if (string.IsNullOrEmpty(item))                {                    continue;                }                maxList.Add(i);            }            return new Tuple<int, int>(minList.Count(), maxList.Count());        }        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()        {            SetConfig();            EndEdit();        }        private void SetConfig()        {            if (CurrentRecipe.ConfigItems != null && CurrentRecipe.ConfigItems.Count > 0)            {                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").Count() > 0)                {                    ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatTotalSlot").FirstOrDefault()).Value = BoatTotalSlot;                }                if (CurrentRecipe.ConfigItems.Where(x => x.DisplayName == "UpperSDNum").Count() > 0)                {                    ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSDNum").FirstOrDefault()).Value = UpperSDNum;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").Count() > 0)                {                    ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductNum").FirstOrDefault()).Value = ProductNum;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").Count() > 0)                {                    ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum1").FirstOrDefault()).Value = ProductNum;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").Count() > 0)                {                    ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "MonitorNum2").FirstOrDefault()).Value = ProductNum;                }                if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").Count() > 0)                {                    ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSDNum").FirstOrDefault()).Value = LowerSDNum;                }            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").Count() > 0)            {                ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "TopSlotNo").FirstOrDefault()).Value = TopSlotNo;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").Count() > 0)            {                ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "UpperSideDummyNum").FirstOrDefault()).Value = UpperSideDummyNum;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").Count() > 0)            {                //  IsDispTypeEnabled = ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "BoatMapDecisionMethod").FirstOrDefault()).Value == 0 ? true : false;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").Count() > 0)            {                ((NumParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "LowerSideDummyNum").FirstOrDefault()).Value = LowerSideDummyNum;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFill").FirstOrDefault()).Value = TotalWaferNumber.ToString();            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductAndFillValue").FirstOrDefault()).Value = TotalWaferNumberValue;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplement").FirstOrDefault()).Value = SetLayoutReplacement.ToString();            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferSupplementValue").FirstOrDefault()).Value = SetLayoutReplacementValue;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor1").FirstOrDefault()).Value = WaferChargeMonitor1.ToString();            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue1").FirstOrDefault()).Value = WaferChargeMonitorValue1;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitor2").FirstOrDefault()).Value = WaferChargeMonitor2.ToString();            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferChargeMonitorValue2").FirstOrDefault()).Value = WaferChargeMonitorValue2;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "FillDummyTransfer").FirstOrDefault()).Value = FillDummyTransferStr;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductZeroNotFill").FirstOrDefault()).Value = ProductZeroStr;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "ProductTransferPosition").FirstOrDefault()).Value = ProductTransferStr;            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor1").FirstOrDefault()).Value = DialogResultmonitor1.ToString();            }            if (CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").Count() > 0)            {                ((StringParam)CurrentRecipe.ConfigItems.Where(x => x.Name == "WaferDischargeMonitor2").FirstOrDefault()).Value = DialogResultmonitor2.ToString();            }        }        public void EndEdit()        {            RecipePermissionSelectViewModel dialog = new RecipePermissionSelectViewModel("Save recipe and permission", "",CurrentRecipe.Description);            WindowManager wm = new WindowManager();            bool? dialogReturn = wm.ShowDialog(dialog);            if (!dialogReturn.HasValue || !dialogReturn.Value)                return;            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].Pitch))            //{            //    DialogBox.ShowWarning("Pitch 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;            }            CurrentRecipe.IsSavedDesc = false;            this.CurrentRecipe.Revisor = BaseApp.Instance.UserContext.LoginName;            this.CurrentRecipe.ReviseTime = DateTime.Now;            this.CurrentRecipe.RecipeLevel = this.LevelDisplay;            this.CurrentRecipe.Description = dialog.RecipeComment;            this._recipeProvider.SaveRecipe(CurrentRecipe.PrefixPath, CurrentRecipe.Name, CurrentRecipe.GetXmlString());            ((Window)GetView()).DialogResult = true;        }        public void Cancel()        {            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 EditModeSelectClick(string cmd)        {            switch (cmd)            {                case "Before":                    SetBeforeEdit();                    break;                case "After":                    SetAfterEdit();                    break;                default:                    break;            }        }        private void SetBeforeEdit()        { }        private void SetAfterEdit()        { }        private Visibility _istBoatMapLogicalVisibility;        public Visibility IstBoatMapLogicalVisibility        {            get => _istBoatMapLogicalVisibility;            set            {                _istBoatMapLogicalVisibility = value;                NotifyOfPropertyChange(nameof(IstBoatMapLogicalVisibility));            }        }        private Visibility _istBoatMapDirectVisibility = Visibility.Hidden;        public Visibility IstBoatMapDirectVisibility        {            get => _istBoatMapDirectVisibility;            set            {                _istBoatMapDirectVisibility = value;                NotifyOfPropertyChange(nameof(IstBoatMapDirectVisibility));            }        }        private bool _isDispTypeEnabled = true;        public bool IsDispTypeEnabled        {            get => _isDispTypeEnabled;            set            {                _isDispTypeEnabled = value;                NotifyOfPropertyChange(nameof(IsDispTypeEnabled));            }        }        private void SetBoatMapLogical()        {            IstBoatMapLogicalVisibility = Visibility.Visible;            IstBoatMapDirectVisibility = Visibility.Hidden;            IsDispTypeEnabled = true;        }        private void SetBoatMapDirect()        {            IstBoatMapLogicalVisibility = Visibility.Hidden;            IstBoatMapDirectVisibility = Visibility.Visible;            IsDispTypeEnabled = false;        }        public void BoatMapSelectClick(string cmd)        {            switch (cmd)            {                case "Logical":                    SetBoatMapLogical();                    break;                case "Direct":                    SetBoatMapDirect();                    break;                default:                    break;            }        }        private Visibility _istDispTypeToNumber;        public Visibility IstDispTypeToNumber        {            get => _istDispTypeToNumber;            set            {                _istDispTypeToNumber = value;                NotifyOfPropertyChange(nameof(IstDispTypeToNumber));            }        }        private Visibility _istDispTypeToMap;        public Visibility IstDispTypeToMap        {            get => _istDispTypeToMap;            set            {                _istDispTypeToMap = value;                NotifyOfPropertyChange(nameof(IstDispTypeToMap));            }        }        private Visibility _istDispTypeToCarrier;        public Visibility IstDispTypeToCarrier        {            get => _istDispTypeToCarrier;            set            {                _istDispTypeToCarrier = value;                NotifyOfPropertyChange(nameof(IstDispTypeToCarrier));            }        }        private void SetDispTypeToNumber()        {            IstDispTypeToNumber = Visibility.Visible;            IstDispTypeToMap = Visibility.Hidden;            IstDispTypeToCarrier = Visibility.Hidden;        }        private void SetDispTypeToMap()        {            IstDispTypeToNumber = Visibility.Hidden;            IstDispTypeToMap = Visibility.Visible;            IstDispTypeToCarrier = Visibility.Hidden;        }        private void SetDispTypeToCarrier()        {            IstDispTypeToNumber = Visibility.Hidden;            IstDispTypeToMap = Visibility.Hidden;            IstDispTypeToCarrier = Visibility.Visible;        }        public void DispTypeSelectClick(string cmd)        {            switch (cmd)            {                case "Number":                    SetDispTypeToNumber();                    break;                case "Map":                    SetDispTypeToMap();                    break;                case "Carrier":                    SetDispTypeToCarrier();                    break;                default:                    break;            }        }    }}
 |