| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450 | 
							- using Aitex.Core.Account;
 
- 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.CommonData;
 
- //using MECF.Framework.Common.CommonData;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.OperationCenter;
 
- using Microsoft.VisualBasic;
 
- using Newtonsoft.Json;
 
- using Prism.Commands;
 
- using Prism.Mvvm;
 
- using System;
 
- using System.Collections;
 
- using System.Collections.Generic;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Reflection;
 
- using System.Runtime.InteropServices;
 
- using System.Text;
 
- using System.Threading;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- using System.Windows.Data;
 
- using System.Windows.Input;
 
- using System.Windows.Media;
 
- using System.Windows.Threading;
 
- 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.CustomControls;
 
- using Venus_Themes.UserControls;
 
- using WPF.Themes.UserControls;
 
- using Xceed.Wpf.Toolkit.Primitives;
 
- using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;
 
- using RecipeStep = Venus_Core.RecipeStep;
 
- namespace Venus_MainPages.ViewModels
 
- {
 
-     public enum EPDType
 
-     {
 
-         Socket,
 
-         WCF,
 
-         None
 
-     }
 
-     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.Coral),
 
-         new SolidColorBrush(Colors.Cyan),
 
-         new SolidColorBrush(Colors.Honeydew)
 
-         };
 
-         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;
 
-         #endregion
 
-         #region  属性
 
-         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); }
 
-         }
 
-         #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 _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));
 
-         TreeViewFileItem selectedItem;
 
-         #endregion
 
-         #region 命令方法
 
-       
 
-       
 
-         private void OnAddStep()
 
-         {
 
-             if (CurrentRecipe != null)
 
-             {
 
-                 var index = currentRecipeGrid.ColumnDefinitions.Count;
 
-                 RecipeStep recipeStep;
 
-                 if (copyIndex == -1)
 
-                 {
 
-                     recipeStep = new RecipeStep();
 
-                     switch (currentChamber)
 
-                     {
 
-                         case JetChamber.Venus:
 
-                             recipeStep.LstUnit.Add(new PressureByPressureModeUnit());
 
-                             recipeStep.LstUnit.Add(new TCPUnit());
 
-                             recipeStep.LstUnit.Add(new BiasUnit());
 
-                             recipeStep.LstUnit.Add(new GasControlUnit());
 
-                             recipeStep.LstUnit.Add(new ESCHVUnit());
 
-                             recipeStep.LstUnit.Add(new ProcessKitUnit());
 
-                             break;
 
-                         case JetChamber.Kepler2300:
 
-                             recipeStep.LstUnit.Add(new PressureByPressureModeUnit());
 
-                             recipeStep.LstUnit.Add(new TCPUnit());
 
-                             recipeStep.LstUnit.Add(new BiasUnit());
 
-                             recipeStep.LstUnit.Add(new GasControlUnit());
 
-                             recipeStep.LstUnit.Add(new ProcessKitUnit());
 
-                             break;
 
-                         case JetChamber.Kepler2200A:
 
-                             recipeStep.LstUnit.Add(new Kepler2200GasControlUnit());
 
-                             recipeStep.LstUnit.Add(new HeaterUnit());
 
-                             recipeStep.LstUnit.Add(new Kepler2200RFUnit());
 
-                             
 
-                             break;
 
-                     }
 
-                     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()
 
-         {
 
-             CurrentRecipe.Header.EditTime = DateTime.Now.ToString();
 
-             SaveRecipe(CurrentRecipeName, RecipeUnity.RecipeToString(CurrentRecipe));
 
-             LoadHeadWrapPanel(headWrapPanel, CurrentRecipe);
 
-         }
 
-         private void OnLoaded(Object myrecipeView)
 
-         {
 
-             if (firstLoad == true)
 
-             {
 
-                 currentChamber = (JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{ModuleName}.ChamberType").ToString());
 
-                 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;
 
-                 //DispatcherTimer timer = new DispatcherTimer();
 
-                 //timer.Interval = TimeSpan.FromSeconds(1);
 
-                 //timer.Tick += Timer_Tick; ;
 
-                 //timer.Start();
 
-                 for (int i = 0; i < 5; i++)
 
-                 {
 
-                     InvokeClient.Instance.Service.DoOperation($"{ModuleName}.EndPoint.SearchCfg");
 
-                     Thread.Sleep(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)
 
-                     {
 
-                         break;
 
-                     }
 
-                 }
 
-                 
 
-             }
 
-         }
 
-         private void TreeViewRcpList_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
 
-         {
 
-             selectedItem = e.NewValue as TreeViewFileItem;
 
-             if (selectedItem == null)
 
-                 return;
 
-             try
 
-             {
 
-                 CurrentRecipeName = selectedItem.FileName;
 
-                 string xmlRecipeData = m_uiRecipeManager.LoadRecipe(ModuleName, selectedItem.FileName);
 
-                 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);
 
-         }
 
-         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 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
 
-             {
 
-                 RecipeNameInputDlg dlg = new RecipeNameInputDlg(Application.Current.Resources["GlobalLableMsgInputRecipeName"].ToString())
 
-                 {
 
-                     Owner = Application.Current.MainWindow
 
-                 };
 
-                 if (dlg.ShowDialog() == true)
 
-                 {
 
-                     var recipeName = folderName + "\\" + dlg.InputText;
 
-                     RecipeType type = (RecipeType)Enum.Parse(typeof(RecipeType), dlg.SelectedType);
 
-                     string newRecipe =RecipeUnity.CreateRecipe(currentChamber,type, dlg.InputText);
 
-                     //string recipeContent = m_uiRecipeManager.GetRecipeTemplate(ModuleName);
 
-                     //m_uiRecipeManager.SaveAsRecipe(ModuleName, recipeName, m_uiRecipeManager.LoadRecipe("system",folderName));
 
-                     if (SaveAsRecipe(recipeName, newRecipe))
 
-                     {
 
-                         //UpdateRecipeFileList();
 
-                         //SelectRecipe(recipeName);
 
-                         treeViewRcpList.Items.Add(new TreeViewFileItem(dlg.InputText));
 
-                     }
 
-                     else
 
-                     {
 
-                         WPFMessageBox.ShowError("Error");
 
-                     }
 
-                 }
 
-             }
 
-             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 {CurrentRecipeName}?","删除后无法恢复!!!") == MessageBoxResult.Yes)
 
-             {
 
-                 MenuItem mit = sender as MenuItem;
 
-                 //string recipename = mit.Header.ToString();
 
-                 m_uiRecipeManager.DeleteRecipe(ModuleName, CurrentRecipeName);
 
-                 //PerformCreateRecipe(folderName);
 
-                 treeViewRcpList.Items.Remove(selectedItem);
 
-             }
 
-             
 
-         }
 
-         private void menuItem_MouseClick_SaveAsRecipe(object sender, RoutedEventArgs e)
 
-         {
 
-             if (CurrentRecipe == null)
 
-             {
 
-                 return;
 
-             }
 
-             var newName = Interaction.InputBox(" ", "Save As Recipe", CurrentRecipeName, -1, -1);
 
-             if (newName != CurrentRecipeName && newName != "")
 
-             {
 
-                 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, newName + ".rcp");
 
-                 File.WriteAllText(newrecipePath, RecipeUnity.RecipeToString(newRecipe));
 
-                 UpdateRecipeFileList();
 
-             }               
 
-         }
 
-         private void menuItem_MouseClick_RenameRecipe(object sender, RoutedEventArgs e)
 
-         {
 
-             if (CurrentRecipe == null)
 
-             {
 
-                 return;
 
-             }
 
-             var newName= Interaction.InputBox(" ", "Rename Recipe", CurrentRecipeName, -1, -1);
 
-             if (newName != CurrentRecipeName && newName!="")
 
-             {
 
-                 var oldrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, CurrentRecipeName + ".rcp");
 
-                 var newrecipePath = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName, newName + ".rcp");
 
-                 CurrentRecipe.Header.Name = newName;
 
-                 SaveRecipe(CurrentRecipeName, RecipeUnity.RecipeToString(CurrentRecipe));
 
-                 File.Move(oldrecipePath, newrecipePath);
 
-                 UpdateRecipeFileList();
 
-             }
 
-             
 
-         }
 
-         public bool SaveAsRecipe(string recipeName, string recipeContent)
 
-         {
 
-             return m_uiRecipeManager.SaveAsRecipe(ModuleName, 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;
 
-                     //item.ToolTip = fileName;
 
-                     itemsControl.Items.Add(item);
 
-                 }
 
-                 else if (ele.Name == "Folder")
 
-                 {
 
-                     string folderName = ele.Attributes["Name"].Value;
 
-                     folderName = folderName.Substring(folderName.LastIndexOf('\\') + 1);
 
-                     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)
 
-         {
 
-             return Directory.GetFiles(path, "*.rcp")?
 
-       .Select(Path.GetFileNameWithoutExtension);
 
-         }
 
-         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 = 15;
 
-                 //textBlock.Width = 100;
 
-                 switch (propertyInfo.Name)
 
-                 {
 
-                     case "ChuckRecipe":
 
-                         textBlock.Text = "Chuck:";
 
-                         break;
 
-                     case "DechuckRecipe":
 
-                         textBlock.Text = "DeChuck:";
 
-                         break;
 
-                     default:
 
-                         textBlock.Text = propertyInfo.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.Height = 23;
 
-                         control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                         ItemsControlHelper.SetEnumValuesToItemsSource(control, true);
 
-                         break;
 
-                     case "Type":
 
-                         ComboBox cb = new ComboBox();
 
-                         cb.SelectionChanged += ChangeUI;
 
-                         control = cb;
 
-                         control.Height = 23;
 
-                         control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                         ItemsControlHelper.SetEnumValuesToItemsSource(control, true);
 
-                         break;
 
-                     case "ChuckRecipe":
 
-                         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 = chucklist
 
-                         };
 
-                         control.Height = 23;
 
-                         control.MinWidth = 100;
 
-                         control.MaxWidth = 300;
 
-                         control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                         break;
 
-                     case "DechuckRecipe":
 
-                         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= dechucklist
 
-                         };
 
-                         control.Height = 23;
 
-                         control.MinWidth = 100;
 
-                         control.MaxWidth = 300;
 
-                         control.SetBinding(ComboBox.SelectedItemProperty, binding);
 
-                         break;
 
-                     default:
 
-                         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;
 
-                 }
 
-                 //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;
 
-                 //}
 
-                 HeadWrapPanel.Children.Add(control);
 
-             }
 
-         }
 
-         private void ChangeUI(object sender, SelectionChangedEventArgs e)
 
-         {
 
-             var t = sender as ComboBox;
 
-             if (t.SelectedValue.ToString() == "Chuck" || t.SelectedValue.ToString() == "DeChuck")
 
-             {
 
-                 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();
 
-                 switch (currentChamber)
 
-                 {
 
-                     case JetChamber.Venus:
 
-                     case JetChamber.Kepler2300:
 
-                         recipeStep.LstUnit.Add(new PressureByPressureModeUnit());
 
-                         recipeStep.LstUnit.Add(new TCPUnit());
 
-                         recipeStep.LstUnit.Add(new BiasUnit());
 
-                         recipeStep.LstUnit.Add(new GasControlUnit());
 
-                         recipeStep.LstUnit.Add(new ESCHVUnit());
 
-                         recipeStep.LstUnit.Add(new ProcessKitUnit());
 
-                         break;
 
-                     case JetChamber.Kepler2200A:
 
-                         recipeStep.LstUnit.Add(new Kepler2200GasControlUnit());
 
-                         recipeStep.LstUnit.Add(new HeaterUnit());
 
-                         recipeStep.LstUnit.Add(new Kepler2200RFUnit());
 
-                         break;
 
-                 }
 
-                 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);
 
-             ////OnAddStep(insertIndex + 1);
 
-             //var recipeStep = new RecipeStep();
 
-             //switch (currentChamber)
 
-             //{
 
-             //    case JetChamber.Venus:
 
-             //    case JetChamber.Kepler2300:
 
-             //        recipeStep.LstUnit.Add(new PressureByPressureModeUnit());
 
-             //        recipeStep.LstUnit.Add(new TCPUnit());
 
-             //        recipeStep.LstUnit.Add(new BiasUnit());
 
-             //        recipeStep.LstUnit.Add(new GasControlUnit());
 
-             //        recipeStep.LstUnit.Add(new ESCHVUnit());
 
-             //        recipeStep.LstUnit.Add(new ProcessKitUnit());
 
-             //        break;
 
-             //    case JetChamber.Kepler2200A:
 
-             //        recipeStep.LstUnit.Add(new Kepler2200GasControlUnit());
 
-             //        recipeStep.LstUnit.Add(new HeaterUnit());
 
-             //        recipeStep.LstUnit.Add(new Kepler2200RFUnit());
 
-             //        break;
 
-             //}
 
-             //CurrentRecipe.Steps.Insert(insertIndex, recipeStep);
 
-             //for (int i=0;i< CurrentRecipe.Steps.Count;i++)
 
-             //{
 
-             //    CurrentRecipe.Steps[i].StepNo = i + 1;
 
-             //}
 
-             //LoadRecipe(CurrentRecipe);
 
-             var t = ((sender as MenuItem).Parent as ContextMenu).PlacementTarget as TextBox;
 
-             int insertIndex = Convert.ToInt32(t.Text);
 
-             if (copyIndex == -1)
 
-             {
 
-                 var recipeStep = new RecipeStep();
 
-                 switch (currentChamber)
 
-                 {
 
-                     case JetChamber.Venus:
 
-                         recipeStep.LstUnit.Add(new PressureByPressureModeUnit());
 
-                         recipeStep.LstUnit.Add(new TCPUnit());
 
-                         recipeStep.LstUnit.Add(new BiasUnit());
 
-                         recipeStep.LstUnit.Add(new GasControlUnit());
 
-                         recipeStep.LstUnit.Add(new ESCHVUnit());
 
-                         recipeStep.LstUnit.Add(new ProcessKitUnit());
 
-                         break;
 
-                     case JetChamber.Kepler2300:
 
-                         recipeStep.LstUnit.Add(new PressureByPressureModeUnit());
 
-                         recipeStep.LstUnit.Add(new TCPUnit());
 
-                         recipeStep.LstUnit.Add(new BiasUnit());
 
-                         recipeStep.LstUnit.Add(new GasControlUnit());
 
-                         recipeStep.LstUnit.Add(new ProcessKitUnit());
 
-                         break;
 
-                     case JetChamber.Kepler2200A:
 
-                         recipeStep.LstUnit.Add(new Kepler2200GasControlUnit());
 
-                         recipeStep.LstUnit.Add(new HeaterUnit());
 
-                         recipeStep.LstUnit.Add(new Kepler2200RFUnit());
 
-                         break;
 
-                 }
 
-                 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") && 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;
 
-                             textBlock.Text = propertyInfoName;
 
-                             grid.Children.Add(textBlock);
 
-                             textBlock.Background = new SolidColorBrush(Colors.BurlyWood);
 
-                             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":
 
-                                     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;
 
-                                     //if (stepcheckbinding == null)
 
-                                     //{
 
-                                     //    textBox.IsEnabled = true;
 
-                                     //}
 
-                                     //else
 
-                                     //{
 
-                                     //    textBox.SetBinding(TextBox.IsEnabledProperty, stepcheckbinding);
 
-                                     //}
 
-                                    
 
-                                     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);
 
-                                     //if (stepcheckbinding == null)
 
-                                     //{
 
-                                     //    stepcheckbinding = new Binding
 
-                                     //    {
 
-                                     //        Source = checkBox,                // 数据源  
 
-                                     //        Path = new PropertyPath("IsChecked"), // 需绑定的数据源属性名  
 
-                                     //        Mode = BindingMode.TwoWay,        // 绑定模式  
 
-                                     //        UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged    //触发器
 
-                                     //    };
 
-                                     //}
 
-                                     //else
 
-                                     //{
 
-                                     //}
 
-                                     //if (stepcheckbinding == null)
 
-                                     //{
 
-                                     //    checkBox.IsEnabled = true;
 
-                                     //}
 
-                                     //else
 
-                                     //{
 
-                                     //    checkBox.SetBinding(TextBox.IsEnabledProperty, stepcheckbinding);
 
-                                     //}
 
-                                     break;
 
-                                 default:
 
-                                     ComboBox comboBox = new ComboBox();
 
-                                     comboBox.Style = (Style)recipeView.FindResource("customeComboBoxStyle");
 
-                                     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);
 
-                                     //if (stepcheckbinding == null)
 
-                                     //{
 
-                                     //    comboBox.IsEnabled = true;
 
-                                     //}
 
-                                     //else
 
-                                     //{
 
-                                     //    comboBox.SetBinding(TextBox.IsEnabledProperty, stepcheckbinding);
 
-                                     //}
 
-                                     break;
 
-                             }
 
-                         }
 
-                         i++;
 
-                     }
 
-                 }
 
-                 int k = 0;
 
-                 foreach (var x in recipeStep.LstUnit.ToList())
 
-                 {
 
-                     Type unitType = x.GetType();
 
-                     bool isIgnore = false;
 
-                     switch (currentChamber)
 
-                     {
 
-                         case JetChamber.Venus:
 
-                             var VenusUnitsValues = Enum.GetValues(typeof(VenusUnits));
 
-                             foreach (var item in VenusUnitsValues)
 
-                             {
 
-                                 if (item.ToString() == unitType.Name)
 
-                                 {
 
-                                     isIgnore = true;
 
-                                     break;
 
-                                 }
 
-                             }
 
-                             break;
 
-                         case JetChamber.Kepler2300:
 
-                             var Kepler2300UintsValues = Enum.GetValues(typeof(Kepler2300Uints));
 
-                             foreach (var item in Kepler2300UintsValues)
 
-                             {
 
-                                 if (item.ToString() == unitType.Name)
 
-                                 {
 
-                                     isIgnore = true;
 
-                                     break;
 
-                                 }
 
-                             }
 
-                             break;
 
-                         case JetChamber.Kepler2200A:
 
-                             var Kepler2200AUintsValues = Enum.GetValues(typeof(Kepler2200AUnits));
 
-                             foreach (var item in Kepler2200AUintsValues)
 
-                             {
 
-                                 if (item.ToString() == unitType.Name)
 
-                                 {
 
-                                     isIgnore = true;
 
-                                     break;
 
-                                 }
 
-                             }
 
-                             break;
 
-                         case JetChamber.Kepler2200B:
 
-                             break;
 
-                     }
 
-                     if (!isIgnore)
 
-                     {
 
-                         continue;
 
-                     }
 
-                     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;
 
-                         }
 
-                         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 "HeaterPressure":
 
-                                     textBlock.Text = "Pressure(Pa)";
 
-                                     break;
 
-                                 case "HeaterTemp":
 
-                                     textBlock.Text = "Heater Temp(℃)";
 
-                                     break;
 
-                                 case "HeaterRatio":
 
-                                     textBlock.Text = "Heater Ratio";
 
-                                     break;
 
-                                 default:
 
-                                     textBlock.Text = propertyInfo.Name;
 
-                                     break;
 
-                             }
 
-                             textBlock.Background = solidColorBrushes[k % 3];
 
-                             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":
 
-                                         //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;
 
-                                         }
 
-                                         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");
 
-                                         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++;
 
-                 }
 
-                 //recipeStep.LstUnit.ToList().ForEach(x =>
 
-                 //{
 
-                    
 
-                 //});
 
-                 //index++;
 
-             }
 
-         }
 
-         //private void EPDcomboBox_DropDownOpened(object sender, EventArgs e)
 
-         //{
 
-            
 
-         //}
 
-         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);
 
-         }
 
-         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, CurrentRecipe.Header.ChuckRecipe);
 
-                 //index = 0;
 
-                 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 DechuckRecipeData = m_uiRecipeManager.LoadRecipe(ModuleName, CurrentRecipe.Header.DechuckRecipe);
 
-                 //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);
 
-             }
 
-         }
 
-         private void OnAddStep(int index)
 
-         {
 
-             if (CurrentRecipe != null)
 
-             {
 
-                 RecipeStep recipeStep;
 
-                 if (copyIndex == -1)
 
-                 {
 
-                     recipeStep = new RecipeStep();
 
-                     switch (currentChamber)
 
-                     {
 
-                         case JetChamber.Venus:
 
-                             recipeStep.LstUnit.Add(new PressureByPressureModeUnit());
 
-                             recipeStep.LstUnit.Add(new TCPUnit());
 
-                             recipeStep.LstUnit.Add(new BiasUnit());
 
-                             recipeStep.LstUnit.Add(new GasControlUnit());
 
-                             recipeStep.LstUnit.Add(new ESCHVUnit());
 
-                             recipeStep.LstUnit.Add(new ProcessKitUnit());
 
-                             break;
 
-                         case JetChamber.Kepler2300:
 
-                             recipeStep.LstUnit.Add(new PressureByPressureModeUnit());
 
-                             recipeStep.LstUnit.Add(new TCPUnit());
 
-                             recipeStep.LstUnit.Add(new BiasUnit());
 
-                             recipeStep.LstUnit.Add(new GasControlUnit());
 
-                             recipeStep.LstUnit.Add(new ProcessKitUnit());
 
-                             break;
 
-                         case JetChamber.Kepler2200A:
 
-                             recipeStep.LstUnit.Add(new Kepler2200GasControlUnit());
 
-                             recipeStep.LstUnit.Add(new HeaterUnit());
 
-                             recipeStep.LstUnit.Add(new Kepler2200RFUnit());
 
-                             break;
 
-                     }
 
-                     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(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 xmlRecipeData = m_uiRecipeManager.LoadRecipe(ModuleName, CurrentRecipeName);
 
-                 CurrentRecipe = Recipe.Load(xmlRecipeData);
 
-                 LoadRecipe(CurrentRecipe);
 
-             }
 
-            
 
-         }
 
-         #endregion
 
-     }
 
- }
 
 
  |