| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778 | 
							- using Aitex.Core.Common.DeviceData;
 
- using Aitex.Core.RT.IOCore;
 
- using Aitex.Core.RT.Log;
 
- using Aitex.Core.UI.View.Common;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.OperationCenter;
 
- using Microsoft.VisualBasic;
 
- using Newtonsoft.Json;
 
- using Newtonsoft.Json.Linq;
 
- using Prism.Commands;
 
- using Prism.Mvvm;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Collections.ObjectModel;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Reflection;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- using System.Windows.Data;
 
- using System.Windows.Input;
 
- using System.Windows.Media;
 
- using System.Xml;
 
- using Venus_Core;
 
- using Venus_Core.Attributes;
 
- using Venus_MainPages.PMs;
 
- using Venus_MainPages.Unity;
 
- using Venus_MainPages.Views;
 
- using Venus_Themes.UserControls;
 
- using WPF.Themes.UserControls;
 
- using MessageBox = System.Windows.MessageBox;
 
- using RecipeStep = Venus_Core.RecipeStep;
 
- namespace Venus_MainPages.ViewModels
 
- {
 
-     internal class RecipeViewModel : BindableBase
 
-     {
 
-         #region 私有字段     
 
-         public string ModuleName = "PMA";
 
-         private string m_CurrentRecipeName;
 
-         private UiRecipeManager m_uiRecipeManager = new UiRecipeManager();
 
-         private RecipeView recipeView;
 
-         private TreeView treeViewRcpList;
 
-         private Recipe m_currentRecipe;
 
-         private string m_recipeType;
 
-         private bool firstLoad = true;
 
-         private WrapPanel headWrapPanel;
 
-         private StackPanel bodyStackPanel;
 
-         private List<SolidColorBrush> solidColorBrushes = new List<SolidColorBrush>()
 
-         {
 
-         //new SolidColorBrush(Colors.Cyan),
 
-         //new SolidColorBrush(Colors.Lime),
 
-         //  new SolidColorBrush(Colors.Coral),
 
-         //new SolidColorBrush(Colors.Cyan),
 
-         //new SolidColorBrush(Colors.Honeydew),
 
-         new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FAFAFA")),
 
-         new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FAFAFA")),
 
-         new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FAFAFA"))
 
-         };
 
-         private Grid currentRecipeGrid;
 
-         private int copyIndex = -1;
 
-         private List<string> EPDCfgList = new List<string>();
 
-         private EPDType currentEPDType = EPDType.None;
 
-         private JetChamber currentChamber;
 
-         private bool isInstalledEPD;
 
-         private bool m_IsFrozen;
 
-         private bool m_PMAIsInstalled;
 
-         private bool m_PMBIsInstalled;
 
-         private bool m_PMCIsInstalled;
 
-         private bool m_PMDIsInstalled;
 
-         private List<string> moduleList = new List<string>();
 
-         TreeViewFileItem selectedItem;
 
-         private string typeFolder = "";
 
-         private bool m_HeadExpand = true;
 
-         #endregion
 
-         #region  属性
 
-         public bool HeadExpand
 
-         {
 
-             get { return m_HeadExpand; }
 
-             set { SetProperty(ref m_HeadExpand, value); }
 
-         }
 
-         public string CurrentRecipeName
 
-         {
 
-             get { return m_CurrentRecipeName; }
 
-             set { SetProperty(ref m_CurrentRecipeName, value); }
 
-         }
 
-         public Recipe CurrentRecipe
 
-         {
 
-             get { return m_currentRecipe; }
 
-             set
 
-             {
 
-                 m_currentRecipe = value;
 
-                 RecipeType = m_currentRecipe?.Header?.Type.ToString();
 
-             }
 
-         }
 
-         public string RecipeType
 
-         {
 
-             get { return m_recipeType; }
 
-             set { SetProperty(ref m_recipeType, value); }
 
-         }
 
-         public bool IsFrozen
 
-         {
 
-             get { return m_IsFrozen; }
 
-             set { SetProperty(ref m_IsFrozen, value); }
 
-         }
 
-         public bool PMAIsInstalled
 
-         {
 
-             get { return m_PMAIsInstalled; }
 
-             set { SetProperty(ref m_PMAIsInstalled, value); }
 
-         }
 
-         public bool PMBIsInstalled
 
-         {
 
-             get { return m_PMBIsInstalled; }
 
-             set { SetProperty(ref m_PMBIsInstalled, value); }
 
-         }
 
-         public bool PMCIsInstalled
 
-         {
 
-             get { return m_PMCIsInstalled; }
 
-             set { SetProperty(ref m_PMCIsInstalled, value); }
 
-         }
 
-         public bool PMDIsInstalled
 
-         {
 
-             get { return m_PMDIsInstalled; }
 
-             set { SetProperty(ref m_PMDIsInstalled, value); }
 
-         }
 
-         #endregion
 
-         #region 命令
 
-         private DelegateCommand<Object> _MouseRightButtonDownCommand;
 
-         public DelegateCommand<Object> MouseRightButtonDownCommand =>
 
-             _MouseRightButtonDownCommand ?? (_MouseRightButtonDownCommand = new DelegateCommand<Object>(OnMouseRightButtonDown));
 
-         private DelegateCommand<Object> _LoadedCommand;
 
-         public DelegateCommand<Object> LoadedCommand =>
 
-             _LoadedCommand ?? (_LoadedCommand = new DelegateCommand<Object>(OnLoaded));
 
-         private DelegateCommand _SaveRecipeCommand;
 
-         public DelegateCommand SaveRecipeCommand =>
 
-             _SaveRecipeCommand ?? (_SaveRecipeCommand = new DelegateCommand(OnSaveRecipe));
 
-         private DelegateCommand<object> _SaveToRecipeCommand;
 
-         public DelegateCommand<object> SaveToRecipeCommand =>
 
-             _SaveToRecipeCommand ?? (_SaveToRecipeCommand = new DelegateCommand<object>(OnSaveToRecipe));
 
-         private DelegateCommand _AddStepCommand;
 
-         public DelegateCommand AddStepCommand =>
 
-             _AddStepCommand ?? (_AddStepCommand = new DelegateCommand(OnAddStep));
 
-         private DelegateCommand _DeleteStepCommand;
 
-         public DelegateCommand DeleteStepCommand =>
 
-             _DeleteStepCommand ?? (_DeleteStepCommand = new DelegateCommand(OnDeleteStep));
 
-         private DelegateCommand _RefreshCommand;
 
-         public DelegateCommand RefreshCommand =>
 
-             _RefreshCommand ?? (_RefreshCommand = new DelegateCommand(OnRefresh));
 
-         private DelegateCommand _ToleranceCommand;
 
-         public DelegateCommand ToleranceCommand =>
 
-             _ToleranceCommand ?? (_ToleranceCommand = new DelegateCommand(OnTolerance));
 
-         private DelegateCommand _ExpandCommand;
 
-         public DelegateCommand ExpandCommand =>
 
-             _ExpandCommand ?? (_ExpandCommand = new DelegateCommand(OnExpand));
 
-         private DelegateCommand _UnloadCommand;
 
-         public DelegateCommand UnloadCommand =>
 
-             _UnloadCommand ?? (_UnloadCommand = new DelegateCommand(OnUnload));
 
-         private DelegateCommand _ClearRecipeCommand;
 
-         public DelegateCommand ClearRecipeCommand =>
 
-             _ClearRecipeCommand ?? (_ClearRecipeCommand = new DelegateCommand(OnClearRecipe));
 
-         private DelegateCommand<Object> _MouseLeftButtonDownCommand;
 
-         public DelegateCommand<Object> MouseLeftButtonDownCommand =>
 
-             _MouseLeftButtonDownCommand ?? (_MouseLeftButtonDownCommand = new DelegateCommand<Object>(OnMouseLeftButtonDown));
 
-         #endregion
 
-         #region 命令方法
 
-         private void OnAddStep()
 
-         {
 
-             if (CurrentRecipe != null)
 
-             {
 
-                 var index = currentRecipeGrid.ColumnDefinitions.Count;
 
-                 RecipeStep recipeStep;
 
-                 if (copyIndex == -1)
 
-                 {
 
-                     recipeStep = new RecipeStep();
 
-                     recipeStep.LstUnit = RecipeUnity.GetAllUnits(currentChamber, CurrentRecipe.Header.Type);
 
-                     CurrentRecipe.Steps.Insert(index - 1, recipeStep);
 
-                 }
 
-                 else
 
-                 {
 
-                     var t = JsonConvert.SerializeObject(CurrentRecipe);
 
-                     recipeStep = Recipe.Load(t).Steps[copyIndex - 1];
 
-                     CurrentRecipe.Steps.Insert(index - 1, recipeStep);
 
-                 }
 
-                 RecipeStepToGridColumn(recipeStep, currentRecipeGrid, index, true);
 
-                 for (int i = 1; i <= CurrentRecipe.Steps.Count; i++)
 
-                 {
 
-                     CurrentRecipe.Steps[i - 1].StepNo = i;
 
-                 }
 
-             }
 
-         }
 
-         private void OnDeleteStep()
 
-         {
 
-             if (CurrentRecipe != null)
 
-             {
 
-                 OnDeleteStep(CurrentRecipe.Steps.Count - 1);
 
-             }
 
-         }
 
-         private void OnSaveRecipe()
 
-         {
 
-             if (WPFMessageBox.ShowQuestion($"Save recipe file?", "") == MessageBoxResult.Yes)
 
-             {
 
-                 var inUseRecipe = QueryDataClient.Instance.Service.GetData($"Scheduler.InUsingRecipe");
 
-                 if (inUseRecipe != null)
 
-                 {
 
-                     if ((inUseRecipe as List<string>).Contains($"{ModuleName}.{CurrentRecipe.Header.Type}.{CurrentRecipeName}"))
 
-                     {
 
-                         WPFMessageBox.ShowError($"{CurrentRecipeName} Recipe is In Use,can not edit");
 
-                         return;
 
-                     }
 
-                 }
 
-             }
 
-             CurrentRecipe.Header.EditTime = DateTime.Now.ToString();
 
-             //SaveRecipe(CurrentRecipeName, RecipeUnity.RecipeToString(CurrentRecipe));
 
-             var newrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, typeFolder, CurrentRecipeName + ".rcp");
 
-             FileInfo fi = new FileInfo(newrecipePath);
 
-             var di = fi.Directory;
 
-             if (!di.Exists)
 
-             {
 
-                 di.Create();
 
-             }
 
-             //File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(CurrentRecipe),Encoding.UTF8);
 
-             string recipeContent = RecipeUnity.RecipeToString(CurrentRecipe);
 
-             SaveRecipe(CurrentRecipe.Header.Name, CurrentRecipe.Header.Type.ToString(), recipeContent);
 
-             LoadHeadWrapPanel(headWrapPanel, CurrentRecipe);
 
-             SaveEAPRecipe(recipeContent, CurrentRecipe.Steps);
 
-         }
 
-         private void SaveEAPRecipe(string recipeContent, ObservableCollection<RecipeStep> Steps)
 
-         {
 
-             if (currentChamber == JetChamber.Kepler2200A || currentChamber == JetChamber.Kepler2200B)
 
-             {
 
-                 var newrecipePath2 = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, $"{typeFolder}_EAP", CurrentRecipeName + ".rcp");
 
-                 FileInfo fi2 = new FileInfo(newrecipePath2);
 
-                 var di2 = fi2.Directory;
 
-                 if (!di2.Exists)
 
-                 {
 
-                     di2.Create();
 
-                 }
 
-                 var newContent = Recipe.ShowEAPRecipe(recipeContent, CurrentRecipe.Steps);
 
-                 File.WriteAllText(newrecipePath2, newContent, Encoding.UTF8);
 
-             }
 
-         }
 
-         private void OnSaveToRecipe(object obj)
 
-         {
 
-             if (CurrentRecipe == null)
 
-             {
 
-                 return;
 
-             }
 
-             string moduleName = "";
 
-             switch (obj.ToString())
 
-             {
 
-                 case "0":
 
-                     moduleName = "PMA";
 
-                     break;
 
-                 case "1":
 
-                     moduleName = "PMB";
 
-                     break;
 
-                 case "2":
 
-                     moduleName = "PMC";
 
-                     break;
 
-                 case "3":
 
-                     moduleName = "PMD";
 
-                     break;
 
-                 case "4":
 
-                     moduleName = "ALL";
 
-                     break;
 
-             }
 
-             if (moduleName == "")
 
-             {
 
-                 return;
 
-             }
 
-             if (moduleName == "ALL")
 
-             {
 
-                 var newName = Interaction.InputBox(" ", $"Save Recipe To All", CurrentRecipeName, -1, -1);
 
-                 OnSaveRecipe();
 
-                 foreach (var x in moduleList)
 
-                 {
 
-                     if (newName != "")
 
-                     {
 
-                         var targetChamber = (JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{x}.ChamberType").ToString());
 
-                         if (currentChamber != targetChamber || x == ModuleName)
 
-                         {
 
-                             continue;
 
-                         }
 
-                         var newRecipe = CurrentRecipe;
 
-                         newRecipe.Header.Name = newName;
 
-                         newRecipe.Header.CreateTime = DateTime.Now.ToString();
 
-                         var newrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", x, typeFolder, newName + ".rcp");
 
-                         FileInfo fi = new FileInfo(newrecipePath);
 
-                         var di = fi.Directory;
 
-                         if (!di.Exists)
 
-                         {
 
-                             di.Create();
 
-                         }
 
-                         //File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(newRecipe));
 
-                         if (m_uiRecipeManager.SaveAsRecipeWithType(x, CurrentRecipe.Header.Type.ToString(), newName, RecipeUnity.RecipeToString(newRecipe)))
 
-                         {
 
-                             UpdateRecipeFileList();
 
-                         }
 
-                         UpdateRecipeFileList();
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 var targetChamber = (JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{moduleName}.ChamberType").ToString());
 
-                 if (currentChamber != targetChamber)
 
-                 {
 
-                     WPFMessageBox.ShowError($"Recipe can not from {currentChamber.ToString()} copy to {targetChamber.ToString()}");
 
-                     return;
 
-                 }
 
-                 var newName = Interaction.InputBox(" ", $"Save  Recipe To {moduleName}", CurrentRecipeName, -1, -1);
 
-                 if (newName != "")
 
-                 {
 
-                     OnSaveRecipe();
 
-                     var newRecipe = CurrentRecipe;
 
-                     newRecipe.Header.Name = newName;
 
-                     newRecipe.Header.CreateTime = DateTime.Now.ToString();
 
-                     var newrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", moduleName, typeFolder, newName + ".rcp");
 
-                     FileInfo fi = new FileInfo(newrecipePath);
 
-                     var di = fi.Directory;
 
-                     if (!di.Exists)
 
-                     {
 
-                         di.Create();
 
-                     }
 
-                     //File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(newRecipe));
 
-                     if (m_uiRecipeManager.SaveAsRecipeWithType(moduleName, CurrentRecipe.Header.Type.ToString(), newName, RecipeUnity.RecipeToString(newRecipe)))
 
-                     {
 
-                         UpdateRecipeFileList();
 
-                     }
 
-                     //if (SaveAsRecipeWithType(newName, CurrentRecipe.Header.Type.ToString(), RecipeUnity.RecipeToString(newRecipe)))
 
-                     //{ 
 
-                     //}
 
-                 }
 
-             }
 
-         }
 
-         private async void OnLoaded(Object myrecipeView)
 
-         {
 
-             if (firstLoad == true)
 
-             {
 
-                 currentChamber = (JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.ChamberType").ToString());
 
-                 if (currentChamber != JetChamber.Kepler2200A && currentChamber != JetChamber.Kepler2200B)
 
-                 {
 
-                     isInstalledEPD = bool.Parse(QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.EPD.IsEnabled").ToString());
 
-                 }
 
-                 firstLoad = false;
 
-                 recipeView = myrecipeView as RecipeView;
 
-                 treeViewRcpList = recipeView.treeViewRcpList;
 
-                 headWrapPanel = recipeView.headWrapPanel;
 
-                 bodyStackPanel = recipeView.bodyStackPanel;
 
-                 UpdateRecipeFileList();
 
-                 treeViewRcpList.SelectedItemChanged += TreeViewRcpList_SelectedItemChanged;
 
-                 if (isInstalledEPD)
 
-                 {
 
-                     for (int i = 0; i < 5; i++)
 
-                     {
 
-                         InvokeClient.Instance.Service.DoOperation($"{ModuleName}.EndPoint.SearchCfg");
 
-                         await Task.Delay(200);
 
-                         currentEPDType = (EPDType)System.Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.EPD.EPDType"));
 
-                         if (currentEPDType == EPDType.Socket)
 
-                         {
 
-                             EPDCfgList = (List<string>)QueryDataClient.Instance.Service.GetData($"{ModuleName}.EPDCfgList");
 
-                         }
 
-                         if (EPDCfgList != null)
 
-                         {
 
-                             EPDCfgList.Add("");
 
-                             break;
 
-                         }
 
-                     }
 
-                 }
 
-                 string allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString();
 
-                 if (allModules.Contains("PMA"))
 
-                 {
 
-                     PMAIsInstalled = true;
 
-                     moduleList.Add("PMA");
 
-                 }
 
-                 if (allModules.Contains("PMB"))
 
-                 {
 
-                     PMBIsInstalled = true;
 
-                     moduleList.Add("PMB");
 
-                 }
 
-                 if (allModules.Contains("PMC"))
 
-                 {
 
-                     PMCIsInstalled = true;
 
-                     moduleList.Add("PMC");
 
-                 }
 
-                 if (allModules.Contains("PMD"))
 
-                 {
 
-                     PMDIsInstalled = true;
 
-                     moduleList.Add("PMD");
 
-                 }
 
-             }
 
-             UpdateRecipeFileList();
 
-         }
 
-         private void TreeViewRcpList_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
 
-         {
 
-             selectedItem = e.NewValue as TreeViewFileItem;
 
-             if (selectedItem == null)
 
-                 return;
 
-             try
 
-             {
 
-                 string[] info = selectedItem.FileName.Split('\\');
 
-                 //string path;
 
-                 string xmlRecipeData = "";
 
-                 if (info.Length == 1)
 
-                 {
 
-                     CurrentRecipeName = info[0];
 
-                     typeFolder = "";
 
-                     string path = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, $"{CurrentRecipeName}.rcp");
 
-                     xmlRecipeData = m_uiRecipeManager.LoadRecipeByPath(path);
 
-                 }
 
-                 else if (info.Length == 2)
 
-                 {
 
-                     string type = info[0];
 
-                     typeFolder = type;
 
-                     CurrentRecipeName = info[1];
 
-                     string path = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, type, $"{CurrentRecipeName}.rcp");
 
-                     xmlRecipeData = m_uiRecipeManager.LoadRecipeByPath(path);
 
-                 }
 
-                 else
 
-                 {
 
-                     return;
 
-                 }
 
-                 if (xmlRecipeData == "")
 
-                 {
 
-                     treeViewRcpList.Items.Remove(selectedItem);
 
-                     return;
 
-                 }
 
-                 CurrentRecipe = Recipe.Load(xmlRecipeData);
 
-                 LoadHeadWrapPanel(headWrapPanel, CurrentRecipe);
 
-                 LoadRecipe(CurrentRecipe);
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 MessageBox.Show(string.Format(Application.Current.Resources["GlobalLableTitleRecipeEditor"].ToString(), ex.Message), Application.Current.Resources["GlobalLableTitleRecipeEditor"].ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
 
-             }
 
-             e.Handled = true;
 
-         }
 
-         public bool SaveRecipe(string recipeName, string recipeContent)
 
-         {
 
-             return m_uiRecipeManager.SaveRecipe(ModuleName, recipeName, recipeContent);
 
-         }
 
-         public bool SaveRecipe(string recipeName, string type, string recipeContent)
 
-         {
 
-             return m_uiRecipeManager.SaveRecipeWithType(ModuleName, type, recipeName, recipeContent);
 
-         }
 
-         private void OnMouseRightButtonDown(Object treeView)
 
-         {
 
-             //treeViewRcpList = treeView as TreeView;
 
-             treeViewRcpList.ContextMenu = new ContextMenu() { Background = new SolidColorBrush(Colors.AliceBlue) };
 
-             MenuItem menuItem = new MenuItem();
 
-             menuItem = new MenuItem();
 
-             menuItem.Tag = "\\";
 
-             menuItem.Click += new RoutedEventHandler(menuItem_MouseClick_CreateRecipe);
 
-             menuItem.Header = "New Recipe";
 
-             treeViewRcpList.ContextMenu.Items.Add(menuItem);
 
-             menuItem = new MenuItem();
 
-             menuItem.Tag = "\\";
 
-             menuItem.Click += new RoutedEventHandler(menuItem_MouseClick_DeleteRecipe);
 
-             menuItem.Header = "Delete Recipe";
 
-             treeViewRcpList.ContextMenu.Items.Add(menuItem);
 
-             menuItem = new MenuItem();
 
-             menuItem.Tag = "\\";
 
-             menuItem.Click += new RoutedEventHandler(menuItem_MouseClick_SaveAsRecipe);
 
-             menuItem.Header = "Save As Recipe";
 
-             treeViewRcpList.ContextMenu.Items.Add(menuItem);
 
-             menuItem = new MenuItem();
 
-             menuItem.Tag = "\\";
 
-             menuItem.Click += new RoutedEventHandler(menuItem_MouseClick_RenameRecipe);
 
-             menuItem.Header = "Rename";
 
-             treeViewRcpList.ContextMenu.Items.Add(menuItem);
 
-             treeViewRcpList.ContextMenu.Visibility = Visibility.Visible;
 
-         }
 
-         private void OnMouseLeftButtonDown(Object treeView)
 
-         {
 
-             //treeViewRcpList = treeView as TreeView;
 
-         }
 
-         private void menuItem_MouseClick_CreateRecipe(object sender, RoutedEventArgs e)
 
-         {
 
-             MenuItem mit = sender as MenuItem;
 
-             string folderName = mit.Tag as string;
 
-             PerformCreateRecipe(folderName);
 
-         }
 
-         private void PerformCreateRecipe(string folderName)
 
-         {
 
-             try
 
-             {
 
-                 bool hasHV = false;
 
-                 if (currentChamber == JetChamber.VenusSE || currentChamber == JetChamber.VenusDE)
 
-                 {
 
-                     hasHV = true;
 
-                 }
 
-                 RecipeNameInputDlg dlg = new RecipeNameInputDlg(Application.Current.Resources["GlobalLableMsgInputRecipeName"].ToString(), hasHV)
 
-                 {
 
-                     Owner = Application.Current.MainWindow
 
-                 };
 
-                 if (dlg.ShowDialog() == true)
 
-                 {
 
-                     var recipeName = dlg.InputText;
 
-                     //var recipeName = folderName + dlg.InputText;
 
-                     //var recipeName = folderName + "\\" + dlg.InputText;
 
-                     if (!RecipeNameIsOk(recipeName))
 
-                     {
 
-                         return;
 
-                     }
 
-                     RecipeType type = (RecipeType)Enum.Parse(typeof(RecipeType), dlg.SelectedType);
 
-                     string newRecipe = RecipeUnity.CreateRecipe(currentChamber, type, dlg.InputText);
 
-                     if (SaveAsRecipeWithType(recipeName, type.ToString(), newRecipe))
 
-                     {
 
-                         UpdateRecipeFileList();
 
-                     }
 
-                 }
 
-             }
 
-             catch (Exception ex)
 
-             {
 
-                 LOG.WriteExeption(ex);
 
-                 MessageBox.Show(string.Format(Application.Current.Resources["GlobalLableMsgRecipeCreateException"].ToString(), ex.Message), Application.Current.Resources["GlobalLableTitleRecipeEditor"].ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
 
-             }
 
-         }
 
-         private void menuItem_MouseClick_DeleteRecipe(object sender, RoutedEventArgs e)
 
-         {
 
-             //if (CurrentRecipe == null)
 
-             //{
 
-             //    return;
 
-             //}
 
-             if (WPFMessageBox.ShowQuestion($"Delete {typeFolder}Recipe {CurrentRecipeName}?", "删除后无法恢复!!!") == MessageBoxResult.Yes)
 
-             {
 
-                 MenuItem mit = sender as MenuItem;
 
-                 //string recipename = mit.Header.ToString();
 
-                 string path = typeFolder == "" ? CurrentRecipeName : $"{typeFolder}\\{CurrentRecipeName}";
 
-                 m_uiRecipeManager.DeleteRecipe(ModuleName, path);
 
-                 //PerformCreateRecipe(folderName);
 
-                 //treeViewRcpList.Items.Remove(selectedItem);
 
-                 UpdateRecipeFileList();
 
-             }
 
-         }
 
-         private void menuItem_MouseClick_SaveAsRecipe(object sender, RoutedEventArgs e)
 
-         {
 
-             if (CurrentRecipe == null)
 
-             {
 
-                 return;
 
-             }
 
-             var newName = Interaction.InputBox(" ", "Save As Recipe", CurrentRecipeName, -1, -1);
 
-             if (!RecipeNameIsOk(newName))
 
-             {
 
-                 return;
 
-             }
 
-             //newName = newName.Trim();
 
-             if (newName != CurrentRecipeName && newName != "")
 
-             {
 
-                 var newRecipe = CurrentRecipe;
 
-                 if (WPFMessageBox.ShowQuestion($"Save recipe file {newName} ?", "") == MessageBoxResult.Yes)
 
-                 {
 
-                     //MessageBox.Show($"Save as recipe  {newName} ?", "Save As Recipe", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
 
-                     newRecipe.Header.Name = newName;
 
-                     newRecipe.Header.CreateTime = DateTime.Now.ToString();
 
-                     //var newrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, typeFolder, newName + ".rcp");
 
-                     //File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(newRecipe));
 
-                     if (SaveAsRecipeWithType(newName, CurrentRecipe.Header.Type.ToString(), RecipeUnity.RecipeToString(newRecipe)))
 
-                     {
 
-                         UpdateRecipeFileList();
 
-                         CurrentRecipeName = newName;
 
-                         LoadHeadWrapPanel(headWrapPanel, CurrentRecipe);
 
-                         LoadRecipe(CurrentRecipe);
 
-                     }
 
-                 }
 
-             }
 
-             else if (newName == CurrentRecipeName || newName == "")
 
-             {
 
-                 WPFMessageBox.Show("Please input right recipename", MessageBoxButton.OK);
 
-             }
 
-         }
 
-         private void menuItem_MouseClick_RenameRecipe(object sender, RoutedEventArgs e)
 
-         {
 
-             if (CurrentRecipe == null)
 
-             {
 
-                 return;
 
-             }
 
-             var newName = Interaction.InputBox(" ", "Rename Recipe", CurrentRecipeName, -1, -1);
 
-             //newName = newName.Trim();
 
-             if (!RecipeNameIsOk(newName))
 
-             {
 
-                 return;
 
-             }
 
-             if (newName != CurrentRecipeName && newName != "")
 
-             {
 
-                 var newRecipe = CurrentRecipe;
 
-                 if (WPFMessageBox.ShowQuestion($"Save recipe file {newName} ?", "") == MessageBoxResult.Yes)
 
-                 {
 
-                     newRecipe.Header.Name = newName;
 
-                     newRecipe.Header.CreateTime = DateTime.Now.ToString();
 
-                     var oldrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, typeFolder, CurrentRecipeName + ".rcp");
 
-                     var newrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, typeFolder, newName + ".rcp");
 
-                     File.Delete(oldrecipePath);
 
-                     File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(newRecipe));
 
-                     UpdateRecipeFileList();
 
-                 }
 
-             }
 
-             else if (newName == CurrentRecipeName || newName == "")
 
-             {
 
-                 WPFMessageBox.Show("Please input right recipename", MessageBoxButton.OK);
 
-             }
 
-         }
 
-         public bool SaveAsRecipe(string recipeName, string recipeContent)
 
-         {
 
-             return m_uiRecipeManager.SaveAsRecipe(ModuleName, recipeName, recipeContent);
 
-         }
 
-         public bool SaveAsRecipeWithType(string recipeName, string type, string recipeContent)
 
-         {
 
-             return m_uiRecipeManager.SaveAsRecipeWithType(ModuleName, type, recipeName, recipeContent);
 
-         }
 
-         public string GetXmlRecipeList()
 
-         {
 
-             return m_uiRecipeManager.GetXmlRecipeList(ModuleName, true) ?? "";
 
-         }
 
-         void CreateTreeViewItems(XmlElement curElementNode, ItemsControl itemsControl)
 
-         {
 
-             foreach (XmlElement ele in curElementNode.ChildNodes)
 
-             {
 
-                 if (ele.Name == "File")
 
-                 {
 
-                     string fileName = ele.Attributes["Name"].Value;
 
-                     fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1);
 
-                     TreeViewFileItem item = new TreeViewFileItem(ele.Attributes["Name"].Value);
 
-                     item.Tag = ele.Attributes["Name"].Value;
 
-                     if (!item.Tag.ToString().Contains("\\"))
 
-                     {
 
-                         continue;
 
-                     }
 
-                     itemsControl.Items.Add(item);
 
-                 }
 
-                 else if (ele.Name == "Folder")
 
-                 {
 
-                     string folderName = ele.Attributes["Name"].Value;
 
-                     folderName = folderName.Substring(folderName.LastIndexOf('\\') + 1);
 
-                     if (folderName == Venus_Core.RecipeType.Process.ToString() || folderName == Venus_Core.RecipeType.Clean.ToString() || folderName == Venus_Core.RecipeType.Chuck.ToString() || folderName == Venus_Core.RecipeType.DeChuck.ToString())
 
-                     {
 
-                         TreeViewFolderItem item = new TreeViewFolderItem(folderName);
 
-                         item.Tag = ele.Attributes["Name"].Value;
 
-                         CreateTreeViewItems(ele, item);
 
-                         item.IsExpanded = false;
 
-                         itemsControl.Items.Add(item);
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-         private IEnumerable<string> GetFilesNames(string path)
 
-         {
 
-             if (Directory.Exists(path))
 
-             {
 
-                 return Directory.GetFiles(path, "*.rcp")?
 
-           .Select(Path.GetFileNameWithoutExtension);
 
-             }
 
-             else
 
-             {
 
-                 return new List<string>();
 
-             }
 
-         }
 
-         private void LoadHeadWrapPanel(WrapPanel HeadWrapPanel, Recipe recipe)
 
-         {
 
-             HeadWrapPanel.Children.Clear();
 
-             Type type = recipe.Header.GetType();
 
-             foreach (var propertyInfo in type.GetProperties())
 
-             {
 
-                 TextBlock textBlock = new TextBlock();
 
-                 textBlock.FontSize = 16;
 
-                 textBlock.Margin = new Thickness(0, 20, 0, 0);
 
-                 textBlock.Width = 200;
 
-                 switch (propertyInfo.Name)
 
-                 {
 
-                     case "ChuckRecipe":
 
-                         if (currentChamber != JetChamber.VenusSE && currentChamber != JetChamber.VenusDE)
 
-                         {
 
-                             continue;
 
-                         }
 
-                         textBlock.Text = "Chuck:";
 
-                         break;
 
-                     case "DechuckRecipe":
 
-                         if (currentChamber != JetChamber.VenusSE && currentChamber != JetChamber.VenusDE)
 
-                         {
 
-                             continue;
 
-                         }
 
-                         textBlock.Text = "DeChuck:";
 
-                         break;
 
-                     default:
 
-                         object[] NameAttrs = propertyInfo.GetCustomAttributes(typeof(CustomName), true);
 
-                         string name;
 
-                         if (NameAttrs.Length > 0)
 
-                         {
 
-                             name = (NameAttrs[0] as CustomName).Name;
 
-                         }
 
-                         else
 
-                         {
 
-                             name = propertyInfo.Name;
 
-                         }
 
-                         textBlock.Text = name + ":";
 
-                         break;
 
-                 }
 
-                 textBlock.Margin = new Thickness(15, 0, 0, 0);
 
-                 textBlock.VerticalAlignment = VerticalAlignment.Center;
 
-                 HeadWrapPanel.Children.Add(textBlock);
 
-                 Binding binding = new Binding()
 
-                 {
 
-                     Source = recipe.Header,                // 数据源  
 
-                     Path = new PropertyPath(propertyInfo.Name), // 需绑定的数据源属性名  
 
-                     Mode = BindingMode.TwoWay,        // 绑定模式  
 
-                     UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,    //触发器
 
-                 };
 
-                 var propertyTypeName = propertyInfo.PropertyType.Name;
 
-                 var propertyInfoName = propertyInfo.Name;
 
-                 Control control = new Control();
 
-                 switch (propertyInfoName)
 
-                 {
 
-                     case "ChamberType":
 
-                         control = new ComboBox();
 
-                         control.IsEnabled = false;
 
-                         //control.Height = 23;
 
-                         control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                         ItemsControlHelper.SetEnumValuesToItemsSource(control, true);
 
-                         break;
 
-                     case "Type":
 
-                         ComboBox cb = new ComboBox();
 
-                         cb.IsEnabled = false;
 
-                         cb.SelectionChanged += ChangeUI;
 
-                         control = cb;
 
-                         //control.Height = 23;
 
-                         ItemsControlHelper.SetEnumValuesToItemsSource(control, true);
 
-                         control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                         break;
 
-                     case "ChuckRecipe":
 
-                         //if (currentChamber != JetChamber.Venus)
 
-                         //{
 
-                         //    continue;
 
-                         //}
 
-                         //string[] chucklist = new string[] { "" };
 
-                         //ArrayList arrayList = new ArrayList(chucklist.ToList());
 
-                         //IEnumerable<string> chlist= GetFilesNames(Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName)).ToList().Where(item => item.ToLower().Contains("chuck") && (item.ToLower().Contains("dechuck") == false));
 
-                         //foreach (var i in chlist)
 
-                         //{
 
-                         //    arrayList.Add(i);
 
-                         //}
 
-                         //chucklist = (string[])arrayList.ToArray(typeof(string));
 
-                         StringBuilder stringBuilder = new StringBuilder();
 
-                         //输出
 
-                         //for (int i = 0; i < chucklist.Length; i++)
 
-                         //{
 
-                         //    stringBuilder.Append(chucklist[i] + "\t");
 
-                         //}
 
-                         control = new ComboBox()
 
-                         {
 
-                             ItemsSource = GetFilesNames(Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", $"{ModuleName}\\Chuck"))
 
-                         };
 
-                         //control.Height = 23;
 
-                         control.MinWidth = 100;
 
-                         control.MaxWidth = 300;
 
-                         control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                         control.PreviewMouseLeftButtonDown += ChuckControl_PreviewMouseLeftButtonDown;
 
-                         break;
 
-                     case "DechuckRecipe":
 
-                         //if (currentChamber != JetChamber.Venus)
 
-                         //{
 
-                         //    continue;
 
-                         //}
 
-                         //string[] dechucklist = new string[] { "" };
 
-                         //ArrayList dearrayList = new ArrayList(dechucklist.ToList());
 
-                         //IEnumerable<string> delist = GetFilesNames(Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName)).ToList().Where(item => item.ToLower().Contains("dechuck"));
 
-                         //foreach (var i in delist)
 
-                         //{
 
-                         //    dearrayList.Add(i);
 
-                         //}
 
-                         //dechucklist = (string[])dearrayList.ToArray(typeof(string));
 
-                         //StringBuilder destringBuilder = new StringBuilder();
 
-                         //for (int i = 0; i < dechucklist.Length; i++)
 
-                         //{
 
-                         //    destringBuilder.Append(dechucklist[i] + "\t");
 
-                         //}
 
-                         control = new ComboBox()
 
-                         {
 
-                             ItemsSource = GetFilesNames(Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", $"{ModuleName}\\DeChuck"))
 
-                         };
 
-                         //control.Height = 23;
 
-                         control.MinWidth = 100;
 
-                         control.MaxWidth = 300;
 
-                         control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                         control.PreviewMouseLeftButtonDown += DechuckControl_PreviewMouseLeftButtonDown;
 
-                         break;
 
-                     case "IsShowTolerance":
 
-                         control = new CheckBox();
 
-                         control.SetBinding(CheckBox.IsCheckedProperty, binding);
 
-                         control.Style = null;
 
-                         control.VerticalAlignment = VerticalAlignment.Center;
 
-                         (control as CheckBox).Checked += RecipeViewModel_Checked;
 
-                         (control as CheckBox).Unchecked += RecipeViewModel_Checked;
 
-                         break;
 
-                     default:
 
-                         control = new TextBox();
 
-                         control.Margin = new Thickness(1, 0, 0, 0);
 
-                         control.BorderThickness = new Thickness(0, 0, 0, 1);
 
-                         control.BorderBrush = Brushes.White;
 
-                         control.FontSize = 15;
 
-                         control.Foreground = Brushes.Green;
 
-                         control.Background = Brushes.Transparent;
 
-                         control.VerticalAlignment = VerticalAlignment.Center;
 
-                         control.MinWidth = 15;
 
-                         control.SetBinding(TextBox.TextProperty, binding);
 
-                         object[] objAttrs = propertyInfo.GetCustomAttributes(typeof(IsOnlyReadAttribute), true);
 
-                         if (objAttrs.Length > 0)
 
-                         {
 
-                             (control as TextBox).IsReadOnly = true;
 
-                         }
 
-                         break;
 
-                 }
 
-                 //switch (propertyTypeName)
 
-                 //{
 
-                 //    case "Int32":
 
-                 //    case "String":
 
-                 //        control = new TextBox();
 
-                 //        control.Margin = new Thickness(1, 0, 0, 0);
 
-                 //        control.BorderThickness = new Thickness(0, 0, 0, 1);
 
-                 //        //control.BorderBrush = Brushes.Black;
 
-                 //        control.FontSize = 15;
 
-                 //        control.Foreground = Brushes.Green;
 
-                 //        control.Background = Brushes.Transparent;
 
-                 //        control.VerticalAlignment = VerticalAlignment.Center;
 
-                 //        control.MinWidth = 15;
 
-                 //        control.SetBinding(TextBox.TextProperty, binding);
 
-                 //        object[] objAttrs = propertyInfo.GetCustomAttributes(typeof(IsOnlyReadAttribute), true);
 
-                 //        if (objAttrs.Length > 0)
 
-                 //        {
 
-                 //            (control as TextBox).IsReadOnly = true;
 
-                 //        }
 
-                 //        break;
 
-                 //    case "Boolean":
 
-                 //        control = new CheckBox();
 
-                 //        control.SetBinding(CheckBox.IsCheckedProperty, binding);
 
-                 //        break;
 
-                 //    default:
 
-                 //        control = new ComboBox();
 
-                 //        control.Height = 23;
 
-                 //        control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                 //        ItemsControlHelper.SetEnumValuesToItemsSource(control, true);
 
-                 //        break;
 
-                 //}
 
-                 control.Margin = new Thickness(20, 3, 0, 7);
 
-                 control.Width = 250;
 
-                 HeadWrapPanel.Children.Add(control);
 
-             }
 
-         }
 
-         private void RecipeViewModel_Checked(object sender, RoutedEventArgs e)
 
-         {
 
-             bool? isTolerance = (sender as CheckBox).IsChecked;
 
-             LoadRecipe(CurrentRecipe);
 
-         }
 
-         private void Control_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 
-         {
 
-         }
 
-         private void ChuckControl_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 
-         {
 
-             var items = GetFilesNames(Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", $"{ModuleName}\\Chuck")).ToList();
 
-             items.Add("");
 
-             (sender as ComboBox).ItemsSource = items;
 
-         }
 
-         private void DechuckControl_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 
-         {
 
-             var items = GetFilesNames(Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", $"{ModuleName}\\DeChuck")).ToList();
 
-             items.Add("");
 
-             (sender as ComboBox).ItemsSource = items;
 
-         }
 
-         private void ChangeUI(object sender, SelectionChangedEventArgs e)
 
-         {
 
-             var t = sender as ComboBox;
 
-             if (t.SelectedValue.ToString() != "Process")
 
-             {
 
-                 headWrapPanel.Children[8].Visibility = Visibility.Collapsed;
 
-                 headWrapPanel.Children[9].Visibility = Visibility.Collapsed;
 
-                 headWrapPanel.Children[10].Visibility = Visibility.Collapsed;
 
-                 headWrapPanel.Children[11].Visibility = Visibility.Collapsed;
 
-             }
 
-             else
 
-             {
 
-                 headWrapPanel.Children[8].Visibility = Visibility.Visible;
 
-                 headWrapPanel.Children[9].Visibility = Visibility.Visible;
 
-                 headWrapPanel.Children[10].Visibility = Visibility.Visible;
 
-                 headWrapPanel.Children[11].Visibility = Visibility.Visible;
 
-             }
 
-         }
 
-         private void MenuItemLeftInsert_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             var t = ((sender as MenuItem).Parent as ContextMenu).PlacementTarget as TextBox;
 
-             int insertIndex = Convert.ToInt32(t.Text);
 
-             if (copyIndex == -1)
 
-             {
 
-                 var recipeStep = new RecipeStep();
 
-                 recipeStep.LstUnit = RecipeUnity.GetAllUnits(currentChamber, CurrentRecipe.Header.Type);
 
-                 CurrentRecipe.Steps.Insert(insertIndex - 1, recipeStep);
 
-             }
 
-             else
 
-             {
 
-                 var t1 = JsonConvert.SerializeObject(CurrentRecipe);
 
-                 var recipeStep = Recipe.Load(t1).Steps[copyIndex - 1];
 
-                 CurrentRecipe.Steps.Insert(insertIndex - 1, recipeStep);
 
-             }
 
-             for (int i = 0; i < CurrentRecipe.Steps.Count; i++)
 
-             {
 
-                 CurrentRecipe.Steps[i].StepNo = i + 1;
 
-             }
 
-             LoadRecipe(CurrentRecipe);
 
-         }
 
-         private void MenuItemRightInsert_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             var t = ((sender as MenuItem).Parent as ContextMenu).PlacementTarget as TextBox;
 
-             int insertIndex = Convert.ToInt32(t.Text);
 
-             if (copyIndex == -1)
 
-             {
 
-                 var recipeStep = new RecipeStep();
 
-                 recipeStep.LstUnit = RecipeUnity.GetAllUnits(currentChamber, CurrentRecipe.Header.Type);
 
-                 CurrentRecipe.Steps.Insert(insertIndex, recipeStep);
 
-             }
 
-             else
 
-             {
 
-                 var t1 = JsonConvert.SerializeObject(CurrentRecipe);
 
-                 var recipeStep = Recipe.Load(t1).Steps[copyIndex - 1];
 
-                 CurrentRecipe.Steps.Insert(insertIndex, recipeStep);
 
-             }
 
-             for (int i = 0; i < CurrentRecipe.Steps.Count; i++)
 
-             {
 
-                 CurrentRecipe.Steps[i].StepNo = i + 1;
 
-             }
 
-             LoadRecipe(CurrentRecipe);
 
-         }
 
-         private void MenuItemDelete_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             var t = ((sender as MenuItem).Parent as ContextMenu).PlacementTarget as TextBox;
 
-             int deleteIndex = Convert.ToInt32(t.Text);
 
-             //OnDeleteStep(deleteIndex - 1);
 
-             CurrentRecipe.Steps.RemoveAt(deleteIndex - 1);
 
-             for (int i = 0; i < CurrentRecipe.Steps.Count; i++)
 
-             {
 
-                 CurrentRecipe.Steps[i].StepNo = i + 1;
 
-             }
 
-             LoadRecipe(CurrentRecipe);
 
-         }
 
-         private void MenuItemCopy_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             var t = ((sender as MenuItem).Parent as ContextMenu).PlacementTarget as TextBox;
 
-             copyIndex = Convert.ToInt32(t.Text);
 
-         }
 
-         #endregion
 
-         #region 私有方法
 
-         private void RecipeStepToGridColumn(RecipeStep recipeStep, Grid grid, int index, bool isInsert)
 
-         {
 
-             int location = 1;
 
-             if (isInsert == true)
 
-             {
 
-                 location -= 1;
 
-             }
 
-             Type recipeType = recipeStep.GetType();
 
-             int cycleCount = 1;
 
-             if (index == 0)
 
-             {
 
-                 cycleCount = 2;
 
-             }
 
-             for (int j = 0; j < cycleCount; j++)
 
-             {
 
-                 int i = 0;
 
-                 ColumnDefinition col1 = new ColumnDefinition();
 
-                 //col1.MinWidth = 50;
 
-                 grid.ColumnDefinitions.Insert(index, col1);
 
-                 //Binding stepcheckbinding = null;
 
-                 //grid.MinWidth = 200;
 
-                 foreach (PropertyInfo propertyInfo in recipeType.GetProperties())
 
-                 {
 
-                     string propertyInfoName = propertyInfo.Name;
 
-                     string propertyTypeName = propertyInfo.PropertyType.Name;
 
-                     if (propertyInfoName != "LstUnit")
 
-                     {
 
-                         if ((propertyInfoName == "EPDConfig" || propertyInfoName == "MinEndPointTime" || propertyInfoName == "MaxEndPointTime" || propertyInfoName == "OverEtchPercent") && isInstalledEPD == false)
 
-                         {
 
-                             continue;
 
-                         }
 
-                         if (index == 0 && grid.ColumnDefinitions.Count == 1)
 
-                         {
 
-                             RowDefinition row1 = new RowDefinition();
 
-                             grid.RowDefinitions.Add(row1);
 
-                         }
 
-                         if (grid.ColumnDefinitions.Count == 1 && j == 0)
 
-                         {
 
-                             TextBox textBlock = new TextBox();
 
-                             textBlock.IsReadOnly = true;
 
-                             object[] NameAttrs = propertyInfo.GetCustomAttributes(typeof(CustomName), true);
 
-                             string name;
 
-                             if (NameAttrs.Length > 0)
 
-                             {
 
-                                 name = (NameAttrs[0] as CustomName).Name;
 
-                             }
 
-                             else
 
-                             {
 
-                                 name = propertyInfo.Name;
 
-                             }
 
-                             textBlock.Text = name;
 
-                             grid.Children.Add(textBlock);
 
-                             textBlock.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FAFAFA"));
 
-                             Grid.SetRow(textBlock, i);
 
-                             Grid.SetColumn(textBlock, 0);
 
-                         }
 
-                         else
 
-                         {
 
-                             Binding binding = new Binding()
 
-                             {
 
-                                 Source = recipeStep,                // 数据源  
 
-                                 Path = new PropertyPath(propertyInfoName), // 需绑定的数据源属性名  
 
-                                 Mode = BindingMode.TwoWay,        // 绑定模式  
 
-                                 UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged    //触发器
 
-                             };
 
-                             switch (propertyTypeName)
 
-                             {
 
-                                 case "Int32":
 
-                                 case "String":
 
-                                 case "Single":
 
-                                 case "Double":
 
-                                     if (propertyInfoName == "EPDConfig")
 
-                                     {
 
-                                         if (currentEPDType == EPDType.Socket)
 
-                                         {
 
-                                             ComboBox EPDcomboBox = new ComboBox();
 
-                                             EPDcomboBox.Style = (Style)recipeView.FindResource("customeComboBoxStyle");
 
-                                             EPDcomboBox.Background = new SolidColorBrush(Colors.Black);
 
-                                             EPDcomboBox.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                                             EPDcomboBox.ItemsSource = EPDCfgList;
 
-                                             grid.Children.Add(EPDcomboBox);
 
-                                             Grid.SetRow(EPDcomboBox, i);
 
-                                             Grid.SetColumn(EPDcomboBox, index + location);
 
-                                             //EPDcomboBox.DropDownOpened += EPDcomboBox_DropDownOpened;
 
-                                         }
 
-                                         else if (currentEPDType == EPDType.WCF)
 
-                                         {
 
-                                             Button EPDButton = new Button();
 
-                                             EPDButton.Content = "EndPoint";
 
-                                             EPDButton.Cursor = Cursors.Hand;
 
-                                             EPDButton.Tag = $"{CurrentRecipeName}.{(index + location).ToString()}";
 
-                                             EPDButton.Style = null;
 
-                                             EPDButton.Click += EPDButton_Click;
 
-                                             grid.Children.Add(EPDButton);
 
-                                             Grid.SetRow(EPDButton, i);
 
-                                             Grid.SetColumn(EPDButton, index + location);
 
-                                         }
 
-                                         break;
 
-                                     }
 
-                                     TextBox textBox = new TextBox();
 
-                                     textBox.HorizontalContentAlignment = HorizontalAlignment.Center;
 
-                                     textBox.VerticalContentAlignment = VerticalAlignment.Center;
 
-                                     textBox.SetBinding(TextBox.TextProperty, binding);
 
-                                     grid.Children.Add(textBox);
 
-                                     Grid.SetRow(textBox, i);
 
-                                     Grid.SetColumn(textBox, index + location);
 
-                                     object[] objAttrs = propertyInfo.GetCustomAttributes(typeof(IsOnlyReadAttribute), true);
 
-                                     if (objAttrs.Length > 0)
 
-                                     {
 
-                                         textBox.IsReadOnly = true;
 
-                                         ContextMenu contextmenu = new ContextMenu();
 
-                                         textBox.ContextMenu = contextmenu;
 
-                                         MenuItem menuItemDelete = new MenuItem();
 
-                                         menuItemDelete.Header = "Delete";
 
-                                         menuItemDelete.Click += MenuItemDelete_Click;
 
-                                         MenuItem menuItemLeftInsert = new MenuItem();
 
-                                         menuItemLeftInsert.Header = "Left Insert";
 
-                                         menuItemLeftInsert.Click += MenuItemLeftInsert_Click;
 
-                                         MenuItem menuItemRightInsert = new MenuItem();
 
-                                         menuItemRightInsert.Header = "Right Insert";
 
-                                         menuItemRightInsert.Click += MenuItemRightInsert_Click;
 
-                                         MenuItem menuItemCopy = new MenuItem();
 
-                                         menuItemCopy.Tag = textBox.Text;
 
-                                         menuItemCopy.Header = "Copy";
 
-                                         menuItemCopy.Click += MenuItemCopy_Click;
 
-                                         contextmenu.Items.Add(menuItemCopy);
 
-                                         contextmenu.Items.Add(menuItemDelete);
 
-                                         contextmenu.Items.Add(menuItemLeftInsert);
 
-                                         contextmenu.Items.Add(menuItemRightInsert);
 
-                                     }
 
-                                     break;
 
-                                 case "Boolean":
 
-                                     CheckBox checkBox = new CheckBox();
 
-                                     checkBox.SetBinding(CheckBox.IsCheckedProperty, binding);
 
-                                     grid.Children.Add(checkBox);
 
-                                     Grid.SetRow(checkBox, i);
 
-                                     Grid.SetColumn(checkBox, index + location);
 
-                                     break;
 
-                                 default:
 
-                                     ComboBox comboBox = new ComboBox();
 
-                                     comboBox.Style = (Style)recipeView.FindResource("customeComboBoxStyle");
 
-                                     //comboBox.BorderThickness = new Thickness(1, 0, 1, 0);
 
-                                     comboBox.Background = new SolidColorBrush(Colors.Black);
 
-                                     comboBox.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                                     ItemsControlHelper.SetEnumValuesToItemsSource(comboBox, true);
 
-                                     grid.Children.Add(comboBox);
 
-                                     Grid.SetRow(comboBox, i);
 
-                                     Grid.SetColumn(comboBox, index + location);
 
-                                     break;
 
-                             }
 
-                         }
 
-                         i++;
 
-                     }
 
-                 }
 
-                 int k = 0;
 
-                 foreach (var x in recipeStep.LstUnit.ToList())
 
-                 {
 
-                     Type unitType = x.GetType();
 
-                     //bool isIgnore = false;
 
-                     Binding checkbinding = null;
 
-                     foreach (PropertyInfo propertyInfo in unitType.GetProperties())
 
-                     {
 
-                         object[] IgnoreAttrs = propertyInfo.GetCustomAttributes(typeof(IsCanConfigIgnore), true);
 
-                         bool IsEnableRecipeExtension = Convert.ToBoolean(QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.IsEnableRecipeExtension"));
 
-                         if (IgnoreAttrs.Length > 0 && IsEnableRecipeExtension == false)
 
-                         {
 
-                             break;
 
-                         }
 
-                         object[] toleranceAttrs = propertyInfo.GetCustomAttributes(typeof(IsTolerance), true);
 
-                         if (toleranceAttrs.Length > 0 && CurrentRecipe.Header.IsShowTolerance == false)
 
-                         {
 
-                             continue;
 
-                         }
 
-                         if (propertyInfo.Name == "UnitName")
 
-                         {
 
-                             continue;
 
-                         }
 
-                         if (propertyInfo.Name.Contains("Gas"))
 
-                         {
 
-                             if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas1.Enable"))
 
-                             {
 
-                                 continue;
 
-                             }
 
-                         }
 
-                         //switch (propertyInfo.Name)
 
-                         //{
 
-                         //    case string name when name.Contains("Gas1"):
 
-                         //        if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas1.Enable"))
 
-                         //        {
 
-                         //            continue;
 
-                         //        }
 
-                         //        break;
 
-                         //    case string name when name.Contains("Gas2"):
 
-                         //        if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas2.Enable"))
 
-                         //        {
 
-                         //            continue;
 
-                         //        }
 
-                         //        break;
 
-                         //    case string name when name.Contains("Gas3"):
 
-                         //        if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas3.Enable"))
 
-                         //        {
 
-                         //            continue;
 
-                         //        }
 
-                         //        break;
 
-                         //    case string name when name.Contains("Gas4"):
 
-                         //        if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas4.Enable"))
 
-                         //        {
 
-                         //            continue;
 
-                         //        }
 
-                         //        break;
 
-                         //    case string name when name.Contains("Gas5"):
 
-                         //        if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas5.Enable"))
 
-                         //        {
 
-                         //            continue;
 
-                         //        }
 
-                         //        break;
 
-                         //    case string name when name.Contains("Gas6"):
 
-                         //        if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas6.Enable"))
 
-                         //        {
 
-                         //            continue;
 
-                         //        }
 
-                         //        break;
 
-                         //    case string name when name.Contains("Gas7"):
 
-                         //        if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas7.Enable"))
 
-                         //        {
 
-                         //            continue;
 
-                         //        }
 
-                         //        break;
 
-                         //    case string name when name.Contains("Gas8"):
 
-                         //        if (!(bool)QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.MfcGas8.Enable"))
 
-                         //        {
 
-                         //            continue;
 
-                         //        }
 
-                         //        break;
 
-                         //}
 
-                         if (index == 0 && grid.ColumnDefinitions.Count == 1)
 
-                         {
 
-                             RowDefinition row1 = new RowDefinition();
 
-                             grid.RowDefinitions.Add(row1);
 
-                         }
 
-                         if (grid.ColumnDefinitions.Count == 1 && j == 0)
 
-                         {
 
-                             TextBox textBlock = new TextBox();
 
-                             textBlock.IsReadOnly = true;
 
-                             switch (propertyInfo.Name)
 
-                             {
 
-                                 case "Gas1":
 
-                                     var data1 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas1");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data1.DisplayName},{data1.Scale})";
 
-                                     break;
 
-                                 case "Gas2":
 
-                                     var data2 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas2");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data2.DisplayName},{data2.Scale})";
 
-                                     break;
 
-                                 case "Gas3":
 
-                                     var data3 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas3");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data3.DisplayName},{data3.Scale})";
 
-                                     break;
 
-                                 case "Gas4":
 
-                                     var data4 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas4");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data4.DisplayName},{data4.Scale})";
 
-                                     break;
 
-                                 case "Gas5":
 
-                                     var data5 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas5");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data5.DisplayName},{data5.Scale})";
 
-                                     break;
 
-                                 case "Gas6":
 
-                                     var data6 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas6");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data6.DisplayName},{data6.Scale})";
 
-                                     break;
 
-                                 case "Gas7":
 
-                                     var data7 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas7");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data7.DisplayName},{data7.Scale})";
 
-                                     break;
 
-                                 case "Gas8":
 
-                                     var data8 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas8");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data8.DisplayName},{data8.Scale})";
 
-                                     break;
 
-                                 case "Gas9":
 
-                                     var data9 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas9");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data9.DisplayName},{data9.Scale})";
 
-                                     break;
 
-                                 case "Gas10":
 
-                                     var data10 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas10");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data10.DisplayName},{data10.Scale})";
 
-                                     break;
 
-                                 case "Gas11":
 
-                                     var data11 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas11");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data11.DisplayName},{data11.Scale})";
 
-                                     break;
 
-                                 case "Gas12":
 
-                                     var data12 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas12");
 
-                                     textBlock.Text = $"{propertyInfo.Name}({data12.DisplayName},{data12.Scale})";
 
-                                     break;
 
-                                 //case "HeaterPressure":
 
-                                 //    textBlock.Text = "Pressure(Pa)";
 
-                                 //    break;
 
-                                 //case "HeaterTemp":
 
-                                 //    textBlock.Text = "Heater Temp(℃)";
 
-                                 //    break;
 
-                                 //case "HeaterRatio":
 
-                                 //    textBlock.Text = "Heater Ratio";
 
-                                 //    break;
 
-                                 default:
 
-                                     object[] NameAttrs = propertyInfo.GetCustomAttributes(typeof(CustomName), true);
 
-                                     string name;
 
-                                     if (NameAttrs.Length > 0)
 
-                                     {
 
-                                         name = (NameAttrs[0] as CustomName).Name;
 
-                                     }
 
-                                     else
 
-                                     {
 
-                                         name = propertyInfo.Name;
 
-                                     }
 
-                                     textBlock.Text = name;
 
-                                     break;
 
-                             }
 
-                             textBlock.Background = solidColorBrushes[k % solidColorBrushes.Count];
 
-                             grid.Children.Add(textBlock);
 
-                             Grid.SetRow(textBlock, i);
 
-                             Grid.SetColumn(textBlock, 0);
 
-                         }
 
-                         else
 
-                         {
 
-                             Binding binding = new Binding()
 
-                             {
 
-                                 Source = recipeStep.LstUnit[k],                // 数据源  
 
-                                                                                //Path = new PropertyPath($"LstUnit[{k}]." + propertyInfo.Name), // 需绑定的数据源属性名  
 
-                                 Path = new PropertyPath(propertyInfo.Name), // 需绑定的数据源属性名  
 
-                                 Mode = BindingMode.TwoWay,        // 绑定模式  
 
-                                 UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged    //触发器
 
-                             };
 
-                             var item = propertyInfo.PropertyType.Name;
 
-                             if (propertyInfo.Name == "UnitName")
 
-                             {
 
-                                 TextBox textBlock1 = new TextBox();
 
-                                 textBlock1.HorizontalContentAlignment = HorizontalAlignment.Center;
 
-                                 textBlock1.VerticalContentAlignment = VerticalAlignment.Center;
 
-                                 textBlock1.Text = propertyInfo.GetValue(x).ToString();
 
-                                 textBlock1.IsReadOnly = true;
 
-                                 grid.Children.Add(textBlock1);
 
-                                 Grid.SetRow(textBlock1, i);
 
-                                 Grid.SetColumn(textBlock1, index + location);
 
-                             }
 
-                             else
 
-                             {
 
-                                 switch (item)
 
-                                 {
 
-                                     case "Int32":
 
-                                     case "String":
 
-                                     case "Single":
 
-                                     case "Double":
 
-                                         //if (checkbinding != null)
 
-                                         //{
 
-                                         //    break;
 
-                                         //}
 
-                                         TextBox textBox = new TextBox();
 
-                                         textBox.HorizontalContentAlignment = HorizontalAlignment.Center;
 
-                                         textBox.VerticalContentAlignment = VerticalAlignment.Center;
 
-                                         if (checkbinding == null)
 
-                                         {
 
-                                             textBox.IsEnabled = true;
 
-                                         }
 
-                                         else
 
-                                         {
 
-                                             textBox.SetBinding(TextBox.IsEnabledProperty, checkbinding);
 
-                                         }
 
-                                         //switch (propertyInfo.Name)
 
-                                         //{
 
-                                         //    case "Gas1":
 
-                                         //        var data1 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas1");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data1.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas2":
 
-                                         //        var data2 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas2");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data2.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas3":
 
-                                         //        var data3 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas3");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data3.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas4":
 
-                                         //        var data4 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas4");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data4.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas5":
 
-                                         //        var data5 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas5");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data5.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas6":
 
-                                         //        var data6 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas6");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data6.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas7":
 
-                                         //        var data7 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas7");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data7.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas8":
 
-                                         //        var data8 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas8");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data8.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas9":
 
-                                         //        var data9 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas9");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data9.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas10":
 
-                                         //        var data10 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas10");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data10.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas11":
 
-                                         //        var data11 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas11");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data11.Scale);
 
-                                         //        break;
 
-                                         //    case "Gas12":
 
-                                         //        var data12 = (AITMfcData)QueryDataClient.Instance.Service.GetData($"{ModuleName}.MfcGas12");
 
-                                         //        TextBoxMaxValue.SetMaxValue(textBox, (int)data12.Scale);
 
-                                         //        break;
 
-                                         //}
 
-                                         textBox.SetBinding(TextBox.TextProperty, binding);
 
-                                         grid.Children.Add(textBox);
 
-                                         Grid.SetRow(textBox, i);
 
-                                         Grid.SetColumn(textBox, index + location);
 
-                                         object[] objAttrs = propertyInfo.GetCustomAttributes(typeof(IsOnlyReadAttribute), true);
 
-                                         if (objAttrs.Length > 0)
 
-                                         {
 
-                                             textBox.IsReadOnly = true;
 
-                                         }
 
-                                         break;
 
-                                     case "Boolean":
 
-                                         CheckBox checkBox = new CheckBox();
 
-                                         if (checkbinding == null)
 
-                                         {
 
-                                             checkbinding = new Binding
 
-                                             {
 
-                                                 Source = checkBox,                // 数据源  
 
-                                                 Path = new PropertyPath("IsChecked"), // 需绑定的数据源属性名  
 
-                                                 Mode = BindingMode.TwoWay,        // 绑定模式  
 
-                                                 UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged    //触发器
 
-                                             };
 
-                                         }
 
-                                         checkBox.SetBinding(CheckBox.IsCheckedProperty, binding);
 
-                                         grid.Children.Add(checkBox);
 
-                                         Grid.SetRow(checkBox, i);
 
-                                         Grid.SetColumn(checkBox, index + location);
 
-                                         break;
 
-                                     default:
 
-                                         //if (checkbinding != null)
 
-                                         //{
 
-                                         //    break;
 
-                                         //}
 
-                                         ComboBox comboBox = new ComboBox();
 
-                                         comboBox.BorderBrush = Brushes.Gray;
 
-                                         comboBox.Style = (Style)recipeView.FindResource("customeComboBoxStyle");
 
-                                         //comboBox.BorderThickness =new Thickness(1,0,1,0);
 
-                                         if (checkbinding == null)
 
-                                         {
 
-                                             comboBox.IsEnabled = true;
 
-                                         }
 
-                                         else
 
-                                         {
 
-                                             comboBox.SetBinding(TextBox.IsEnabledProperty, checkbinding);
 
-                                         }
 
-                                         comboBox.Background = Brushes.White;
 
-                                         string path = propertyInfo.Name;
 
-                                         comboBox.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                                         ItemsControlHelper.SetEnumValuesToItemsSource(comboBox, true);
 
-                                         grid.Children.Add(comboBox);
 
-                                         Grid.SetRow(comboBox, i);
 
-                                         Grid.SetColumn(comboBox, index + location);
 
-                                         break;
 
-                                 }
 
-                             }
 
-                         }
 
-                         i++;
 
-                     }
 
-                     k++;
 
-                 }
 
-             }
 
-         }
 
-         private void EPDButton_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             Button button = sender as Button;
 
-             string para = button.Tag.ToString();
 
-             int stepno = Convert.ToInt32(para.Split('.')[1]) - 1;
 
-             var endpointconfigitem = new MECF.Framework.Common.CommonData.EndPointConfigItem();
 
-             if (CurrentRecipe.Steps[stepno].EPDConfig != null && CurrentRecipe.Steps[stepno].EPDConfig.Length > 20)
 
-             {
 
-                 endpointconfigitem.SetValue(CurrentRecipe.Steps[stepno].EPDConfig);
 
-             }
 
-            (new EndPointDlg(para, endpointconfigitem, CurrentRecipe)).ShowDialog();
 
-         }
 
-         private void UpdateRecipeFileList()
 
-         {
 
-             XmlDocument doc = new XmlDocument();
 
-             doc.LoadXml(GetXmlRecipeList());
 
-             treeViewRcpList.Items.Clear();
 
-             CreateTreeViewItems(doc.DocumentElement, this.treeViewRcpList);
 
-             ExpandAllItems(this.treeViewRcpList);
 
-         }
 
-         private void LoadRecipe(Recipe recipe)
 
-         {
 
-             copyIndex = -1;
 
-             bodyStackPanel.Children.Clear();
 
-             //CurrentRecipe = null;
 
-             GC.Collect(); // This should pick up the control removed at a previous MouseDown
 
-             GC.WaitForPendingFinalizers(); // Doesn't help either
 
-             GC.Collect();
 
-             GC.WaitForPendingFinalizers(); // Doesn't help either
 
-             CurrentRecipe = recipe;
 
-             if (CurrentRecipe.Header.Type == Venus_Core.RecipeType.Process && CurrentRecipe.Header.ChuckRecipe != "" && CurrentRecipe.Header.ChuckRecipe != null)
 
-             {
 
-                 Grid chuckGrid = new Grid();
 
-                 chuckGrid.IsEnabled = false;
 
-                 chuckGrid.Margin = new Thickness(15);
 
-                 string chuckRecipeData = m_uiRecipeManager.LoadRecipe(ModuleName, $"Chuck\\{CurrentRecipe.Header.ChuckRecipe}");
 
-                 if (chuckRecipeData == "")
 
-                 {
 
-                     return;
 
-                 }
 
-                 var chuckRecipe = Recipe.Load(chuckRecipeData);
 
-                 for (int i = 0; i < chuckRecipe.Steps.Count; i++)
 
-                 {
 
-                     RecipeStepToGridColumn(chuckRecipe.Steps[i], chuckGrid, i, false);
 
-                 }
 
-                 bodyStackPanel.Children.Add(chuckGrid);
 
-             }
 
-             Grid proressGrid = new Grid();
 
-             proressGrid.Margin = new Thickness(15);
 
-             //index = 0;
 
-             for (int i = 0; i < recipe.Steps.Count; i++)
 
-             {
 
-                 RecipeStepToGridColumn(recipe.Steps[i], proressGrid, i, false);
 
-             }
 
-             bodyStackPanel.Children.Add(proressGrid);
 
-             currentRecipeGrid = proressGrid;
 
-             if (CurrentRecipe.Header.Type == Venus_Core.RecipeType.Process && CurrentRecipe.Header.DechuckRecipe != "" && CurrentRecipe.Header.DechuckRecipe != null)
 
-             {
 
-                 Grid deChuckGrid = new Grid();
 
-                 deChuckGrid.IsEnabled = false;
 
-                 deChuckGrid.Margin = new Thickness(15);
 
-                 string path = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, "DeChuck", $"{CurrentRecipe.Header.DechuckRecipe}.rcp");
 
-                 string DechuckRecipeData = m_uiRecipeManager.LoadRecipeByPath(path);
 
-                 //index = 0;
 
-                 var dechuckRecipe = Recipe.Load(DechuckRecipeData);
 
-                 for (int i = 0; i < dechuckRecipe.Steps.Count; i++)
 
-                 {
 
-                     RecipeStepToGridColumn(dechuckRecipe.Steps[i], deChuckGrid, i, false);
 
-                 }
 
-                 bodyStackPanel.Children.Add(deChuckGrid);
 
-             }
 
-             string recipeContent = RecipeUnity.RecipeToString(CurrentRecipe);
 
-             SaveEAPRecipe(recipeContent, CurrentRecipe.Steps);
 
-         }
 
-         private void OnDeleteStep(int index)
 
-         {
 
-             if (CurrentRecipe != null && CurrentRecipe.Steps.Count > 1)
 
-             {
 
-                 currentRecipeGrid.Children.RemoveRange(currentRecipeGrid.RowDefinitions.Count * (index + 1), currentRecipeGrid.RowDefinitions.Count);
 
-                 currentRecipeGrid.ColumnDefinitions.RemoveAt(index);
 
-                 for (int i = 1; i <= CurrentRecipe.Steps.Count; i++)
 
-                 {
 
-                     CurrentRecipe.Steps[i - 1].StepNo = i;
 
-                 }
 
-                 CurrentRecipe.Steps.RemoveAt(index);
 
-             }
 
-         }
 
-         private void OnRefresh()
 
-         {
 
-             if (CurrentRecipeName != "")
 
-             {
 
-                 string path = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, typeFolder, $"{CurrentRecipeName}.rcp");
 
-                 string xmlRecipeData = m_uiRecipeManager.LoadRecipeByPath(path);
 
-                 CurrentRecipe = Recipe.Load(xmlRecipeData);
 
-                 LoadHeadWrapPanel(headWrapPanel, CurrentRecipe);
 
-                 LoadRecipe(CurrentRecipe);
 
-             }
 
-         }
 
-         private void OnTolerance()
 
-         {
 
-         }
 
-         private void OnExpand()
 
-         {
 
-             HeadExpand = !HeadExpand;
 
-             if (HeadExpand)
 
-             {
 
-                 recipeView.expandGrid.Width = 300;
 
-             }
 
-             else
 
-             {
 
-                 recipeView.expandGrid.Width = 30;
 
-             }
 
-         }
 
-         private void OnUnload()
 
-         {
 
-             //if (CurrentRecipeName == null || CurrentRecipeName == "")
 
-             //{
 
-             //    return;
 
-             //}
 
-             //if (WPFMessageBox.ShowQuestion($"Is Save Recipe {CurrentRecipeName}", "", false) == MessageBoxResult.Yes)
 
-             //{
 
-             //    OnSaveRecipe();
 
-             //}
 
-         }
 
-         private void OnClearRecipe()
 
-         {
 
-             //CurrentRecipe = null;
 
-             bodyStackPanel.Children.Clear();
 
-             headWrapPanel.Children.Clear();
 
-             GC.Collect(); // This should pick up the control removed at a previous MouseDown
 
-             GC.WaitForPendingFinalizers(); // Doesn't help either
 
-         }
 
-         private void ExpandAllItems(ItemsControl control)
 
-         {
 
-             if (control == null)
 
-             {
 
-                 return;
 
-             }
 
-             foreach (Object item in control.Items)
 
-             {
 
-                 System.Windows.Controls.TreeViewItem treeItem = control.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
 
-                 if (treeItem == null || !treeItem.HasItems)
 
-                 {
 
-                     continue;
 
-                 }
 
-                 treeItem.IsExpanded = true;
 
-                 ExpandAllItems(treeItem as ItemsControl);
 
-             }
 
-         }
 
-         private bool RecipeNameIsOk(string recipeName)
 
-         {
 
-             if (recipeName.Contains(' '))
 
-             {
 
-                 WPFMessageBox.ShowError("Recipe Name 包含空格,不符合规格");
 
-                 return false;
 
-             }
 
-             if (recipeName.Length>30)
 
-             {
 
-                 WPFMessageBox.ShowError("Recipe Name 大于30个字符,不符合规格");
 
-                 return false;
 
-             }
 
-             return true;
 
-         }
 
-         #endregion
 
-     }
 
- }
 
 
  |