Sfoglia il codice sorgente

优化recipe代码

lixiang 2 anni fa
parent
commit
5e89c4da73
23 ha cambiato i file con 811 aggiunte e 1034 eliminazioni
  1. BIN
      Venus/Framework/Output/MECF.Framework/MECF.Framework.Common.dll
  2. BIN
      Venus/Framework/Output/MECF.Framework/MECF.Framework.Common.pdb
  3. BIN
      Venus/Framework/Output/MECF.Framework/MECF.Framework.RT.Core.dll
  4. BIN
      Venus/Framework/Output/MECF.Framework/MECF.Framework.RT.Core.pdb
  5. BIN
      Venus/Framework/Output/MECF.Framework/MECF.Framework.UI.Core.dll
  6. BIN
      Venus/Framework/Output/MECF.Framework/MECF.Framework.UI.Core.pdb
  7. BIN
      Venus/Framework/Output/MECF.Framework/Venus_Core.dll
  8. BIN
      Venus/Framework/Output/MECF.Framework/Venus_Core.pdb
  9. BIN
      Venus/Framework/Output/MECF.Framework/en-US/MECF.Framework.Common.resources.dll
  10. BIN
      Venus/Framework/Output/MECF.Framework/zh-CN/MECF.Framework.Common.resources.dll
  11. 12 12
      Venus/RecipeEditorControl/Converter/RecipeHeadStringConverter.cs
  12. 35 35
      Venus/RecipeEditorControl/Converter/RecipeInfoConverter.cs
  13. 10 10
      Venus/RecipeEditorControl/View/EndPointDlg.xaml.cs
  14. 19 49
      Venus/RecipeEditorControl/View/RecipeEditorControl.xaml
  15. 5 101
      Venus/RecipeEditorControl/View/RecipeEditorControl.xaml.cs
  16. 30 30
      Venus/RecipeEditorControl/View/RecipeInfoEditor.xaml.cs
  17. 8 0
      Venus/RecipeEditorControl/View/RecipeNameInputDlg.xaml.cs
  18. 551 703
      Venus/RecipeEditorControl/ViewModel/RecipeEditorControlViewModel.cs
  19. 17 17
      Venus/RecipeEditorControl/ViewModel/SmartCellData.cs
  20. 5 6
      Venus/Venus_Core/ProcessUnitDefine.cs
  21. 19 7
      Venus/Venus_Core/Recipe.cs
  22. 89 58
      Venus/Venus_MainPages/ViewModels/RecipeViewModel.cs
  23. 11 6
      Venus/Venus_MainPages/Views/RecipeView.xaml

BIN
Venus/Framework/Output/MECF.Framework/MECF.Framework.Common.dll


BIN
Venus/Framework/Output/MECF.Framework/MECF.Framework.Common.pdb


BIN
Venus/Framework/Output/MECF.Framework/MECF.Framework.RT.Core.dll


BIN
Venus/Framework/Output/MECF.Framework/MECF.Framework.RT.Core.pdb


BIN
Venus/Framework/Output/MECF.Framework/MECF.Framework.UI.Core.dll


BIN
Venus/Framework/Output/MECF.Framework/MECF.Framework.UI.Core.pdb


BIN
Venus/Framework/Output/MECF.Framework/Venus_Core.dll


BIN
Venus/Framework/Output/MECF.Framework/Venus_Core.pdb


BIN
Venus/Framework/Output/MECF.Framework/en-US/MECF.Framework.Common.resources.dll


BIN
Venus/Framework/Output/MECF.Framework/zh-CN/MECF.Framework.Common.resources.dll


+ 12 - 12
Venus/RecipeEditorControl/Converter/RecipeHeadStringConverter.cs

@@ -12,18 +12,18 @@ namespace Aitex.UI.RecipeEditor
     {
         public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
         {
-            try
-            {
-                if (value == null) return " (Empty)";
-                var recipeHead = value as RecipeHead;
-                if (recipeHead == null) return " (Empty)";
-                return string.Format("Recipe Version:{0}\r\n\r\nLast Modified By:{2}\r\nLast Modified Time:{3}\r\nDescription:{1}",
-                    recipeHead.RecipeVariation, recipeHead.Description, /*recipeHead.CreationTime, recipeHead.CreatedBy, */recipeHead.LastModifiedBy, recipeHead.LastRevisionTime);
-            }
-            catch (Exception ex)
-            {
-                System.Diagnostics.Debug.WriteLine(ex.Message);
-            }
+            //try
+            //{
+            //    if (value == null) return " (Empty)";
+            //    var recipeHead = value as RecipeHead;
+            //    if (recipeHead == null) return " (Empty)";
+            //    return string.Format("Recipe Version:{0}\r\n\r\nLast Modified By:{2}\r\nLast Modified Time:{3}\r\nDescription:{1}",
+            //        recipeHead.RecipeVariation, recipeHead.Description, /*recipeHead.CreationTime, recipeHead.CreatedBy, */recipeHead.LastModifiedBy, recipeHead.LastRevisionTime);
+            //}
+            //catch (Exception ex)
+            //{
+            //    System.Diagnostics.Debug.WriteLine(ex.Message);
+            //}
             return " (Empty)";
         }
 

+ 35 - 35
Venus/RecipeEditorControl/Converter/RecipeInfoConverter.cs

@@ -11,41 +11,41 @@ namespace Aitex.UI.RecipeEditor
     {
         public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
         {
-            try
-            {
-                if (value == null) return "";
-                var recipeRows = value as ObservableCollection<RecipeRow>;
-                if (recipeRows == null) return "";
-                int timeStepRowId = -1;
-                for (int i = 0; i < recipeRows.Count; i++)
-                {
-                    if (recipeRows[i].TechnicalName == "Time")
-                    {
-                        timeStepRowId = i;
-                        break;
-                    }
-                }
-                TimeSpan tspan = new TimeSpan();
-                for (int stepNo = 0; stepNo < recipeRows[timeStepRowId].RecipeItems.Count; stepNo++)
-                {
-                    var timeDuration = recipeRows[timeStepRowId].RecipeItems[stepNo].Value;
-                    var timeArr = timeDuration.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
-                    if (timeArr.Length == 3)
-                    {
-                        int h, mi, s;
-                        if (int.TryParse(timeArr[0], out h) && int.TryParse(timeArr[1], out mi) && int.TryParse(timeArr[2], out s))
-                        {
-                            var ts = new TimeSpan(h, mi, s);
-                            tspan += ts;
-                        }
-                    }
-                }
-                return string.Format("共{0}步,总时间{1}:{2}:{3}", recipeRows.Count, (int)tspan.TotalHours, tspan.Minutes, tspan.Seconds);
-            }
-            catch (Exception ex)
-            {
-                System.Diagnostics.Debug.WriteLine(ex.Message);
-            }
+            //try
+            //{
+            //    if (value == null) return "";
+            //    var recipeRows = value as ObservableCollection<RecipeRow>;
+            //    if (recipeRows == null) return "";
+            //    int timeStepRowId = -1;
+            //    for (int i = 0; i < recipeRows.Count; i++)
+            //    {
+            //        if (recipeRows[i].TechnicalName == "Time")
+            //        {
+            //            timeStepRowId = i;
+            //            break;
+            //        }
+            //    }
+            //    TimeSpan tspan = new TimeSpan();
+            //    for (int stepNo = 0; stepNo < recipeRows[timeStepRowId].RecipeItems.Count; stepNo++)
+            //    {
+            //        var timeDuration = recipeRows[timeStepRowId].RecipeItems[stepNo].Value;
+            //        var timeArr = timeDuration.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
+            //        if (timeArr.Length == 3)
+            //        {
+            //            int h, mi, s;
+            //            if (int.TryParse(timeArr[0], out h) && int.TryParse(timeArr[1], out mi) && int.TryParse(timeArr[2], out s))
+            //            {
+            //                var ts = new TimeSpan(h, mi, s);
+            //                tspan += ts;
+            //            }
+            //        }
+            //    }
+            //    return string.Format("共{0}步,总时间{1}:{2}:{3}", recipeRows.Count, (int)tspan.TotalHours, tspan.Minutes, tspan.Seconds);
+            //}
+            //catch (Exception ex)
+            //{
+            //    System.Diagnostics.Debug.WriteLine(ex.Message);
+            //}
             return "";
         }
 

+ 10 - 10
Venus/RecipeEditorControl/View/EndPointDlg.xaml.cs

@@ -20,11 +20,11 @@ namespace Aitex.UI.RecipeEditor.View
     /// </summary>
     public partial class EndPointDlg : Window
     {
-        public EndPointConfigItem ConfigItem
-        {
-            get;
-            set;
-        }
+        //public EndPointConfigItem ConfigItem
+        //{
+        //    get;
+        //    set;
+        //}
 
         public class AlogarithmTypeItem
         {
@@ -58,15 +58,15 @@ namespace Aitex.UI.RecipeEditor.View
                 new AlogarithmTypeItem() { AlogarithmName = "Fall_Rise"},
             };
 
-            Loaded += new RoutedEventHandler(EndPointDlg_Loaded);
+            //Loaded += new RoutedEventHandler(EndPointDlg_Loaded);
 
             SelectedConfig = "BelowValue3";
         }
 
-        void EndPointDlg_Loaded(object sender, RoutedEventArgs e)
-        {
-            DataContext = ConfigItem;
-        }
+        //void EndPointDlg_Loaded(object sender, RoutedEventArgs e)
+        //{
+        //    DataContext = ConfigItem;
+        //}
 
         private void buttonCancel_Click(object sender, RoutedEventArgs e)
         {

+ 19 - 49
Venus/RecipeEditorControl/View/RecipeEditorControl.xaml

@@ -14,7 +14,7 @@
              d:DesignHeight="452" d:DesignWidth="1201" FontFamily="Arial,SimSun">
     <Grid x:Name="grid1">
         <Grid.RowDefinitions>
-            <RowDefinition Height="30" />
+            <RowDefinition Height="40" />
             <RowDefinition Height="426*" />
         </Grid.RowDefinitions>
         <Grid.Resources>
@@ -55,12 +55,26 @@
             </xctk:DataGridCollectionViewSource>
         </Grid.Resources>
         <Grid Grid.Row="0">
-            <StackPanel Orientation="Horizontal" >
-                <TextBlock Text="Version:" VerticalAlignment="Center" FontSize="15" Margin="15,0,0,0"/>
+            <ScrollViewer Grid.Row="1"  HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
+                <StackPanel Orientation="Horizontal" x:Name="headStackpanel">
+                </StackPanel>
+            </ScrollViewer>
+          
+            <!--<TextBlock Text="{Binding RecipeInfo}" Margin="0,5,17,5" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Width="142" Visibility="{Binding RecipeInfoTextVisibility}" />-->
+        </Grid>
+        <ScrollViewer Grid.Row="1"  HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
+            <StackPanel   x:Name="stackPanel1" Orientation="Horizontal" Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Visible">
+    
+            </StackPanel>
+        </ScrollViewer>
+       
+
+    </Grid>
+</UserControl>
+<!--<TextBlock Text="Version:" VerticalAlignment="Center" FontSize="15" Margin="15,0,0,0"/>
                 <TextBox  MinWidth="50" Text="{Binding CurrentRecipe.Header.Version}" VerticalAlignment="Center" FontSize="15" BorderThickness="0"  Background="Transparent" Foreground="Green"/>
                 <TextBlock Text="Type:" VerticalAlignment="Center" FontSize="15" Margin="15,0,0,0"/>
                 <ComboBox local:ItemsControlHelper.EnumValuesToItemsSource="True" SelectedItem="{Binding CurrentRecipe.Header.Type}" Height="25">
-
                 </ComboBox>
                 <TextBlock Text="ChuckRecipe:" VerticalAlignment="Center" FontSize="15" Margin="15,0,0,0"/>
                 <TextBox   MinWidth="50"  Text="{Binding CurrentRecipe.Header.ChuckRecipe}" VerticalAlignment="Center" FontSize="15" BorderThickness="0"  Background="Transparent" Foreground="Green"/>
@@ -71,48 +85,4 @@
                 <TextBlock Text="LastModifiedBy:" VerticalAlignment="Center" FontSize="15" Margin="15,0,0,0"/>
                 <TextBox   MinWidth="50"  Text="{Binding CurrentRecipe.Header.LastModifiedBy}" VerticalAlignment="Center" FontSize="15" BorderThickness="0"  Background="Transparent" Foreground="Green"/>
                 <TextBlock Text="Barcode:" VerticalAlignment="Center" FontSize="15" Margin="15,0,0,0"/>
-                <TextBox   MinWidth="50" Text="{Binding CurrentRecipe.Header.Barcode}" VerticalAlignment="Center" FontSize="15" BorderThickness="0"  Background="Transparent" Foreground="Green"/>
-                <Button Content="Add Step"     Command="{Binding AddStepCommand}" Margin="15,0,0,0" Width="100" Style="{StaticResource Login_Button}" FontSize="15" Height="25"/>
-                <Button Content="Delete Step"  Command="{Binding DeleteStepCommand}" Margin="5,0,0,0" Width="100"  Style="{StaticResource Login_Button}" FontSize="15" Height="25"/>
-                <!--<Button Width="60" Focusable="False" BorderThickness="0" Command="{Binding SaveRecipeCommand}"  Visibility="{Binding SingleAppElementVisibility}">
-                    <Button.Content>
-                        <WrapPanel>
-                            <Image Height="16" Source="/RecipeEditorControl;component/Images/save.png" />
-                            <TextBlock Text=" 保存" FontFamily="Arial,SimSun" />
-                        </WrapPanel>
-                    </Button.Content>
-                </Button>
-               
-                <Button Width="100" Focusable="False" BorderThickness="0" Command="{Binding EditRecipeInfoCommand}"
-                        ToolTip="{Binding RecipeHead,Converter={StaticResource RecipeHeadStringConverter}}">
-                    <Button.Content>
-                        <WrapPanel>
-                            <Image Height="14" Source="/RecipeEditorControl;component/Images/property.png" />
-                            <TextBlock Text="{DynamicResource GlobalLableButtonSetting}" FontFamily="Arial,SimSun" />
-                        </WrapPanel>
-                    </Button.Content>
-                </Button>
-                <Button Width="80" Focusable="False" BorderThickness="0" Command="{Binding ShowDetailedErrInfoCommand}"
-                        Background="{Binding Path=Errors, Converter={StaticResource ErrColorConverter}}"
-                        ToolTip="{Binding Path=Errors, Converter={StaticResource ErrTooltipConverter}}">
-                    <Button.Content>
-                        <WrapPanel>
-                            <Image Height="14" Source="/RecipeEditorControl;component/Images/warning.png" />
-                            <TextBlock Text="{Binding Errors, Converter={StaticResource ErrContentConverter}}" TextAlignment="Right" FontFamily="Arial,SimSun"/>
-                        </WrapPanel>
-                    </Button.Content>
-                </Button>-->
-              
-             
-            </StackPanel>
-            <!--<TextBlock Text="{Binding RecipeInfo}" Margin="0,5,17,5" HorizontalAlignment="Right" VerticalAlignment="Center" TextAlignment="Right" Width="142" Visibility="{Binding RecipeInfoTextVisibility}" />-->
-        </Grid>
-        <ScrollViewer Grid.Row="1"  HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
-            <StackPanel   x:Name="stackPanel1" Orientation="Horizontal" Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Visible">
-    
-            </StackPanel>
-        </ScrollViewer>
-       
-
-    </Grid>
-</UserControl>
+                <TextBox   MinWidth="50" Text="{Binding CurrentRecipe.Header.Barcode}" VerticalAlignment="Center" FontSize="15" BorderThickness="0"  Background="Transparent" Foreground="Green"/>-->

+ 5 - 101
Venus/RecipeEditorControl/View/RecipeEditorControl.xaml.cs

@@ -1,24 +1,9 @@
 using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
 using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using System.Collections.ObjectModel;
-using Xceed.Wpf.DataGrid;
 using System.Xml;
-using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
 using System.Diagnostics;
 using System.Windows.Controls.Primitives;
 
@@ -29,23 +14,11 @@ namespace Aitex.UI.RecipeEditor
     /// </summary>
     public partial class RecipeEditorControl : UserControl
     {
-
-
         public RecipeEditorControl()
         {
             InitializeComponent();
-            ControlViewModel = new RecipeEditorControlViewModel() { DataGridStackPanel = stackPanel1};
+            ControlViewModel = new RecipeEditorControlViewModel() { GridStackPanel = stackPanel1,HeadStackPanel=headStackpanel};
             Loaded += new RoutedEventHandler(RecipeEditorView_Loaded);
-            //dataGrid1.ItemsSource = students;
-        }
-
-
-        /// <summary>
-        /// indicate whether recipe modified
-        /// </summary>
-        public bool IsRecipeModified
-        {
-            get { return ControlViewModel.IsRecipeModified; }
         }
 
         /// <summary>
@@ -53,64 +26,11 @@ namespace Aitex.UI.RecipeEditor
         /// </summary>
         public RecipeEditorControlViewModel ControlViewModel { get; set; }
 
-        /// <summary>
-        /// mask recipe item display
-        /// </summary>
-        /// <param name="maskedTechNames"></param>
-        //public void SetDisplayMask(HashSet<string> maskedTechNames = null, HashSet<string> maskedCatalogNames = null)
-        //{
-        //    if (ControlViewModel != null)
-        //    {
-        //        ControlViewModel.MaskedTechNames = maskedTechNames;
-        //        ControlViewModel.MaskedCatalogNames = maskedCatalogNames;
-        //        ControlViewModel.RefreshCellsDisplay(false);
-        //    }
-        //}
-
-        //public void SetEnableBarcode(bool enabled)
-        //{
-        //    if (ControlViewModel != null)
-        //    {
-        //        ControlViewModel.EnableBarcode(enabled);
-        //    }
-        //}
-
-
-        //public void SetEndPointDefaultValue(string defaultValue)
-        //{
-        //    if (ControlViewModel != null)
-        //    {
-        //        ControlViewModel.SetEndPointDefaultValue(defaultValue);
-        //    }
-        //}
-
-        /// <summary>
-        /// loaded handling
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        void RecipeEditorView_Loaded(object sender, RoutedEventArgs e)
+       
+        private void RecipeEditorView_Loaded(object sender, RoutedEventArgs e)
         {
             grid1.DataContext = ControlViewModel;
-        }
-
-        /// <summary>
-        /// open recipe file
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OpenButtonPanelLoaded(object sender, RoutedEventArgs e)
-        {
-            try
-            {
-                string variation = (string)((Button)sender).Tag;
-                ControlViewModel.OpenLocalRecipe(variation);
-            }
-            catch (Exception ex)
-            {
-                System.Diagnostics.Debug.WriteLine(ex.Message);
-            }
-        }
+        }      
 
         /// <summary>
         /// update recipe variations
@@ -133,23 +53,7 @@ namespace Aitex.UI.RecipeEditor
             {
                 System.Diagnostics.Debug.WriteLine(ex.Message);
             }
-        }
-
-
-
-        private void UIElement_OnPreviewTextInput(object sender, TextCompositionEventArgs e)
-        {
-            e.Handled = !IsTextAllowed(e.Text);
-        }
-
-        private static bool IsTextAllowed(string text)
-        {
-            return true;
-            //Regex regex = new Regex("[^0-9.-]+"); //regex that matches disallowed text
-            //return !regex.IsMatch(text);
-        }
-
-       
+        }     
     }
     public class GridOptions
     {

+ 30 - 30
Venus/RecipeEditorControl/View/RecipeInfoEditor.xaml.cs

@@ -19,11 +19,11 @@ namespace Aitex.UI.RecipeEditor.View
     /// </summary>
     public partial class RecipeInfoEditor : Window
     {
-        public RecipeHead RecipeHead
-        {
-            get;
-            set;
-        }
+        //public RecipeHead RecipeHead
+        //{
+        //    get;
+        //    set;
+        //}
 
         public RecipeInfoEditor()
         {
@@ -37,35 +37,35 @@ namespace Aitex.UI.RecipeEditor.View
 
         void RecipeInfoEditor_Loaded(object sender, RoutedEventArgs e)
         {
-            DataContext = RecipeHead;
-            if (RecipeHead == null)
-            {
-                pumpingPinState.SelectedIndex = -1;
-                ventingPinState.SelectedIndex = -1;
-            }
-            else
-            {
-                pumpingPinState.SelectedIndex = RecipeHead.PumpingPinState == "Up" ? 0 : RecipeHead.PumpingPinState == "Down" ? 1 : -1;
-                ventingPinState.SelectedIndex = RecipeHead.VentingPinState == "Up" ? 0 : RecipeHead.VentingPinState == "Down" ? 1 : -1;
-                pinDownPressure.Text = RecipeHead.PinDownPressure;
-            }
+            //DataContext = RecipeHead;
+            //if (RecipeHead == null)
+            //{
+            //    pumpingPinState.SelectedIndex = -1;
+            //    ventingPinState.SelectedIndex = -1;
+            //}
+            //else
+            //{
+            //    pumpingPinState.SelectedIndex = RecipeHead.PumpingPinState == "Up" ? 0 : RecipeHead.PumpingPinState == "Down" ? 1 : -1;
+            //    ventingPinState.SelectedIndex = RecipeHead.VentingPinState == "Up" ? 0 : RecipeHead.VentingPinState == "Down" ? 1 : -1;
+            //    pinDownPressure.Text = RecipeHead.PinDownPressure;
+            //}
         }
 
         private void Button_OK_Click(object sender, RoutedEventArgs e)
         {
-            if (RecipeHead != null)
-            {
-                RecipeHead.Description = desc.Text;
-                RecipeHead.BasePressure = basePressure.Text;
-                RecipeHead.PumpDownLimit = pumpDownLimit.Text;
-                RecipeHead.PurgeActive = (purgeActive.IsChecked.HasValue && purgeActive.IsChecked.Value) ? "true" : "false";
-                RecipeHead.NotToPurgeOrVent = (notToPurgeOrVent.IsChecked.HasValue && notToPurgeOrVent.IsChecked.Value) ? "true" : "false";
-                RecipeHead.SubstrateTemp = substrateTemp.Text;
-                RecipeHead.PumpingPinState = ((ComboBoxItem)pumpingPinState.SelectedItem).Content.ToString();
-                RecipeHead.VentingPinState = ((ComboBoxItem)ventingPinState.SelectedItem).Content.ToString();
-                RecipeHead.PinDownPressure = pinDownPressure.Text;
-            }
-            Close();
+            //if (RecipeHead != null)
+            //{
+            //    RecipeHead.Description = desc.Text;
+            //    RecipeHead.BasePressure = basePressure.Text;
+            //    RecipeHead.PumpDownLimit = pumpDownLimit.Text;
+            //    RecipeHead.PurgeActive = (purgeActive.IsChecked.HasValue && purgeActive.IsChecked.Value) ? "true" : "false";
+            //    RecipeHead.NotToPurgeOrVent = (notToPurgeOrVent.IsChecked.HasValue && notToPurgeOrVent.IsChecked.Value) ? "true" : "false";
+            //    RecipeHead.SubstrateTemp = substrateTemp.Text;
+            //    RecipeHead.PumpingPinState = ((ComboBoxItem)pumpingPinState.SelectedItem).Content.ToString();
+            //    RecipeHead.VentingPinState = ((ComboBoxItem)ventingPinState.SelectedItem).Content.ToString();
+            //    RecipeHead.PinDownPressure = pinDownPressure.Text;
+            //}
+            //Close();
         }
 
         private void Button_Cancel_Click(object sender, RoutedEventArgs e)

+ 8 - 0
Venus/RecipeEditorControl/View/RecipeNameInputDlg.xaml.cs

@@ -46,7 +46,15 @@ namespace Aitex.UI.RecipeEditor.View
 
         private void textBoxInput_TextChanged(object sender, TextChangedEventArgs e)
         {
+            if (textBoxInput.Text == "")
+            {
+                this.buttonOK.IsEnabled=false;
+            }
+            else
+            { 
             this.buttonOK.IsEnabled = IsValidFileName(textBoxInput.Text);
+
+            }
         }
 
         /// <summary>

File diff suppressed because it is too large
+ 551 - 703
Venus/RecipeEditorControl/ViewModel/RecipeEditorControlViewModel.cs


+ 17 - 17
Venus/RecipeEditorControl/ViewModel/SmartCellData.cs

@@ -65,30 +65,30 @@ namespace Aitex.UI.RecipeEditor
         //public bool ShowsJumpControl { get; set; }
         public ICommand EndPointCommand { get; set; }
 
-        public EndPointConfigItem EndPointConfig { get; set; }
+        //public EndPointConfigItem EndPointConfig { get; set; }
 
-        public SmartCellData()
-        {
-            EndPointCommand = new DelegatedCommand((o) => true, (o) => EndPointAction(o));
-            EndPointConfig = new EndPointConfigItem();
-        }
+        //public SmartCellData()
+        //{
+        //    EndPointCommand = new DelegatedCommand((o) => true, (o) => EndPointAction(o));
+        //    EndPointConfig = new EndPointConfigItem();
+        //}
 
-        private void EndPointAction(object obj)
-        {
-            EndPointDlg dlg = new EndPointDlg(){ Owner = Application.Current.MainWindow };
+        //private void EndPointAction(object obj)
+        //{
+        //    EndPointDlg dlg = new EndPointDlg(){ Owner = Application.Current.MainWindow };
 
-            EndPointConfig.SetValue(Value);
+        //    EndPointConfig.SetValue(Value);
 
-            dlg.ConfigItem = EndPointConfig;
+        //    dlg.ConfigItem = EndPointConfig;
              
 
-            var result = dlg.ShowDialog();
-            if (result.HasValue && result.Value)
-            {
-                Value = dlg.ConfigItem.ToValue();
-            }
+        //    var result = dlg.ShowDialog();
+        //    if (result.HasValue && result.Value)
+        //    {
+        //        Value = dlg.ConfigItem.ToValue();
+        //    }
  
-        }
+        //}
 
 
         public override string ToString()

+ 5 - 6
Venus/Venus_Core/ProcessUnitDefine.cs

@@ -25,9 +25,9 @@ namespace Venus_Core
     /// </summary>
  
 
-    public partial class PressureUnitByPressureMode : ProcessUnitBase
+    public partial class PressureByPressureModeUnit : ProcessUnitBase
     {
-        public string UnitName { get; set; } = "PressureUnitByPressureMode";
+        public string UnitName { get; set; } = "PressureByPressureModeUnit";
         public bool EnableRamp { get; set; }
         public int StartPressure { get; set; } = 10;
         public int TargetPressure { get; set; } = 20;
@@ -45,13 +45,13 @@ namespace Venus_Core
         }
     }
 
-    public class PressureUnitByValveMode : ProcessUnitBase
+    public class PressureByValveModeUnit : ProcessUnitBase
     {
-        public string UnitName { get; set; } = "PressureUnitByValveMode";
+        public string UnitName { get; set; } = "PressureByValveModeUnit";
         public bool EnableRamp { get; set; }
         public int StartPosition { get; set; } = 10;
         public int TargetPosition { get; set; } = 100;
-        public int HoldTime { get; set; }= 1000;
+        public int HoldTime { get; set; }= 10000;
 
     }
 
@@ -77,7 +77,6 @@ namespace Venus_Core
         public int TuneCapPreset { get; set; } = 10;
         public int LoadCapPreset { get; set; } = 10;
         public int MaxReflectedPower { get; set; } = 100;
-        public event PropertyChangedEventHandler PropertyChanged;
 
     }
 

+ 19 - 7
Venus/Venus_Core/Recipe.cs

@@ -60,7 +60,7 @@ namespace Venus_Core
             set { m_name = value; InvokePropertyChanged("Name"); }
         }
 
-        private string _Version = "Test";
+        private string _Version = "TestVersion";
         public string Version
         {
             get { return _Version; }
@@ -157,6 +157,12 @@ namespace Venus_Core
 
     public class RecipeStep:INotifyPropertyChanged
     {
+        //public string m_UnitName="StepDescriptionUnit";
+        //public string UnitName
+        //{
+        //    get { return m_UnitName;}
+        //    set { m_UnitName = value; InvokePropertyChanged("UnitName"); }
+        //}
 
         private StepType m_StepType;
         [JsonConverter(typeof(StringEnumConverter))]
@@ -286,9 +292,12 @@ namespace Venus_Core
                 //    unit.Add(JsonConvert.DeserializeObject<ProcessUnitBase>(step.LstUnit[i + count].ToString()));
 
                 //}
+                //var item = step.LstUnit[0];
+
                 for (int i=0;i< step.LstUnit.Count; i++)
                 {
                     //object item=step.LstUnit[i];
+                    //step.LstUnit[i].
                     string value = step.LstUnit[i].ToString();
                     string[] striparr = value.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                     string item1= striparr[1].Remove(0, 15);
@@ -300,12 +309,12 @@ namespace Venus_Core
 
                     switch (item2)
                     {
-                        case "PressureUnitByPressureMode":
-                            unit.Add(JsonConvert.DeserializeObject<PressureUnitByPressureMode>(step.LstUnit[i].ToString()));
+                        case "PressureByPressureModeUnit":
+                            unit.Add(JsonConvert.DeserializeObject<PressureByPressureModeUnit>(step.LstUnit[i].ToString()));
                             break;
 
-                        case "PressureUnitByValveMode":
-                            unit.Add(JsonConvert.DeserializeObject<PressureUnitByValveMode>(step.LstUnit[i].ToString()));
+                        case "PressureByValveModeUnit":
+                            unit.Add(JsonConvert.DeserializeObject<PressureByValveModeUnit>(step.LstUnit[i].ToString()));
                             break;
                         case "TCPUnit":
                             unit.Add(JsonConvert.DeserializeObject<TCPUnit>(step.LstUnit[i].ToString()));
@@ -388,18 +397,21 @@ namespace Venus_Core
         {
             return JsonConvert.SerializeObject(recipe);
         }
-        public static String CreateRecipe(RecipeType recipeType)
+        public static String CreateRecipe(RecipeType recipeType,string recipeName)
         {
             Recipe recipe = new Recipe();
             recipe.Header = new RecipeHead();
             recipe.Header.CreateTime = DateTime.Now.ToString();
             recipe.Header.Type = recipeType;
+            recipe.Header.Name = recipeName;
+            recipe.Header.LastModifiedBy = "Admin";
             recipe.Steps = new ObservableCollection<RecipeStep>();
             recipe.Steps.Add(new RecipeStep()
             {
                 LstUnit = new ObservableCollection<Object>()
                 {
-                 new TCPUnit(){},
+                 new PressureByPressureModeUnit(),
+                 new TCPUnit(),
                  new BiasUnit(),
                  new GasControlUnit(),
                  new ESCHVUnit(),

+ 89 - 58
Venus/Venus_MainPages/ViewModels/RecipeViewModel.cs

@@ -4,6 +4,7 @@ using Aitex.UI.RecipeEditor;
 using Aitex.UI.RecipeEditor.View;
 using Prism.Commands;
 using Prism.Mvvm;
+using Prism.Regions;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -36,6 +37,8 @@ namespace Venus_MainPages.ViewModels
 
         private Recipe m_currentRecipe;
         private string m_recipeType;
+        private bool firstLoad=true;
+
 
         #endregion
 
@@ -96,12 +99,21 @@ namespace Venus_MainPages.ViewModels
         private DelegateCommand _AddStepCommand;
         public DelegateCommand AddStepCommand =>
             _AddStepCommand ?? (_AddStepCommand = new DelegateCommand(OnAddStep));
+
+        private DelegateCommand _DeleteStepCommand;
+        public DelegateCommand DeleteStepCommand =>
+            _DeleteStepCommand ?? (_DeleteStepCommand = new DelegateCommand(OnDeleteStep));
+
+        //private DelegateCommand _ReLoadCommand;
+        //public DelegateCommand ReLoadCommand =>
+        //    _ReLoadCommand ?? (_ReLoadCommand = new DelegateCommand(OnReLoad));
         #endregion
 
         #region 构造函数
         public RecipeViewModel()
         {
             Title = "配方管理";
+
         }
         #endregion
 
@@ -120,8 +132,16 @@ namespace Venus_MainPages.ViewModels
         }
 
         private void OnAddStep()
-        { 
-        
+        {
+            this.tableRecipeGrid.ControlViewModel.OnAddStep();
+        }
+        private void OnDeleteStep()
+        {
+            this.tableRecipeGrid.ControlViewModel.OnDeleteStep();
+        }
+        private void OnReLoad()
+        {
+            this.tableRecipeGrid.ControlViewModel.LoadRecipe(CurrentRecipe);
         }
         private void OnSaveRecipe()
         {
@@ -129,11 +149,16 @@ namespace Venus_MainPages.ViewModels
         }
         private void OnLoaded(Object myrecipeView)
         {
-            recipeView = myrecipeView as RecipeView;
-            treeViewRcpList = recipeView.treeViewRcpList;
-            tableRecipeGrid = recipeView.tableRecipeGrid;
-            UpdateRecipeFileList();
-            treeViewRcpList.SelectedItemChanged += TreeViewRcpList_SelectedItemChanged;
+            if (firstLoad == true)
+            {
+                firstLoad = false;
+                recipeView = myrecipeView as RecipeView;
+                treeViewRcpList = recipeView.treeViewRcpList;
+                tableRecipeGrid = recipeView.tableRecipeGrid;
+                UpdateRecipeFileList();
+                
+                treeViewRcpList.SelectedItemChanged += TreeViewRcpList_SelectedItemChanged;
+            }
         }
 
         private void TreeViewRcpList_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
@@ -144,8 +169,13 @@ namespace Venus_MainPages.ViewModels
             try
             {
                 CurrentRecipeName = selectedItem.FileName;
-                string xmlRecipeData = m_uiRecipeManager.LoadRecipe(m_chamId,selectedItem.FileName);
-                CurrentRecipe= Recipe.Load(xmlRecipeData);
+                string xmlRecipeData = m_uiRecipeManager.LoadRecipe(m_chamId, selectedItem.FileName);
+                if (xmlRecipeData == "")
+                {
+                    treeViewRcpList.Items.Remove(selectedItem);
+                    return;
+                }
+                CurrentRecipe = Recipe.Load(xmlRecipeData);
                 this.tableRecipeGrid.ControlViewModel.LoadRecipe(CurrentRecipe);
             }
             catch (Exception ex)
@@ -204,7 +234,7 @@ namespace Venus_MainPages.ViewModels
             menuItem.Header = Application.Current.Resources["GlobalLableMenuImportRecipe"];
             treeViewRcpList.ContextMenu.Items.Add(menuItem);
 
-           treeViewRcpList.ContextMenu.Items.Add(new Separator());
+            treeViewRcpList.ContextMenu.Items.Add(new Separator());
 
             menuItem = new MenuItem();
             menuItem.Tag = "\\";
@@ -239,15 +269,16 @@ namespace Venus_MainPages.ViewModels
                 {
                     var recipeName = folderName + "\\" + dlg.InputText;
                     RecipeType type = (RecipeType)Enum.Parse(typeof(RecipeType), dlg.SelectedType);
-                    string newRecipe =RecipeUnity.CreateRecipe(type);
+                    string newRecipe =RecipeUnity.CreateRecipe(type, dlg.InputText);
 
                     //string recipeContent = m_uiRecipeManager.GetRecipeTemplate(m_chamId);
 
                     //m_uiRecipeManager.SaveAsRecipe(m_chamId, recipeName, m_uiRecipeManager.LoadRecipe("system",folderName));
                     if (SaveAsRecipe(recipeName, newRecipe))
                     {
-                        UpdateRecipeFileList();
+                        //UpdateRecipeFileList();
                         //SelectRecipe(recipeName);
+                        treeViewRcpList.Items.Add(new TreeViewFileItem(dlg.InputText));
                     }
                     else
                     {
@@ -312,7 +343,7 @@ namespace Venus_MainPages.ViewModels
                     fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1);
                     TreeViewFileItem item = new TreeViewFileItem(ele.Attributes["Name"].Value);
                     item.Tag = ele.Attributes["Name"].Value;
-                    item.ToolTip = fileName;
+                    //item.ToolTip = fileName;
                     itemsControl.Items.Add(item);
                 }
                 else if (ele.Name == "Folder")
@@ -328,51 +359,51 @@ namespace Venus_MainPages.ViewModels
             }
         }
 
-        void SelectRecipe(string recipeName)
-        {
-            try
-            {
-                string[] paths = recipeName.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
-                string fileName = "";
-                for (int i = 0; i < paths.Length - 1; i++)
-                    fileName += paths[i] + "\\";
-                fileName += paths[paths.Length - 1];
-                selectRecipe(treeViewRcpList, paths, 0, fileName);
-            }
-            catch (Exception ex)
-            {
-                //LOG.Write(ex);
-            }
-        }
-
-        ItemsControl selectRecipe(ItemsControl currentNode, string[] paths, int index, string fileName)
-        {
-            if (currentNode == null)
-                return null;
-            if (index == paths.Length - 1)
-            {
-                foreach (var item in currentNode.Items)
-                {
-                    TreeViewFileItem tvf = item as TreeViewFileItem;
-                    if (tvf != null && tvf.FileName == fileName)
-                    {
-                        tvf.IsSelected = true;
-                        return null;
-                    }
-                }
-            }
-            foreach (var item in currentNode.Items)
-            {
-                TreeViewFolderItem tvf = item as TreeViewFolderItem;
-                if (tvf != null && tvf.FolderName == paths[index])
-                {
-                    tvf.IsExpanded = true;
-                    selectRecipe(tvf, paths, index + 1, fileName);
-                    break;
-                }
-            }
-            return null;
-        }
+        //void SelectRecipe(string recipeName)
+        //{
+        //    try
+        //    {
+        //        string[] paths = recipeName.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
+        //        string fileName = "";
+        //        for (int i = 0; i < paths.Length - 1; i++)
+        //            fileName += paths[i] + "\\";
+        //        fileName += paths[paths.Length - 1];
+        //        selectRecipe(treeViewRcpList, paths, 0, fileName);
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        //LOG.Write(ex);
+        //    }
+        //}
+
+        //ItemsControl selectRecipe(ItemsControl currentNode, string[] paths, int index, string fileName)
+        //{
+        //    if (currentNode == null)
+        //        return null;
+        //    if (index == paths.Length - 1)
+        //    {
+        //        foreach (var item in currentNode.Items)
+        //        {
+        //            TreeViewFileItem tvf = item as TreeViewFileItem;
+        //            if (tvf != null && tvf.FileName == fileName)
+        //            {
+        //                tvf.IsSelected = true;
+        //                return null;
+        //            }
+        //        }
+        //    }
+        //    foreach (var item in currentNode.Items)
+        //    {
+        //        TreeViewFolderItem tvf = item as TreeViewFolderItem;
+        //        if (tvf != null && tvf.FolderName == paths[index])
+        //        {
+        //            tvf.IsExpanded = true;
+        //            selectRecipe(tvf, paths, index + 1, fileName);
+        //            break;
+        //        }
+        //    }
+        //    return null;
+        //}
         #endregion
     }
 }

+ 11 - 6
Venus/Venus_MainPages/Views/RecipeView.xaml

@@ -41,7 +41,7 @@
                 </StackPanel>
             </Border>
             <Border Grid.Row="1" BorderBrush="{DynamicResource Table_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
-                <TreeView Name="treeViewRcpList" Margin="0,6"
+                <TreeView Name="treeViewRcpList" Margin="0,6"  
                       FontSize="14" BorderThickness="1" BorderBrush="Black" Canvas.Top="140" Canvas.Left="4" Opacity="1" Background="LightSteelBlue"  AllowDrop="True" 
                       >
                     <i:Interaction.Triggers>
@@ -51,7 +51,12 @@
                     </i:Interaction.Triggers>
                     <TreeView.ItemContainerStyle>
                         <Style TargetType="{x:Type TreeViewItem}">
-
+                            <Style.Resources>
+                                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="DodgerBlue"/>
+                                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="White"/>
+                                <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="DodgerBlue"/>
+                                <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="White"/>
+                            </Style.Resources>
                         </Style>
                     </TreeView.ItemContainerStyle>
                 </TreeView>
@@ -70,15 +75,15 @@
                 <TextBlock Text="{Binding CurrentRecipeName}"   Margin="0,10,0,0" FontSize="15"/>-->
                 <!--<Label Height="31" Margin="22,3,0,0" Name="labelSelectedRecipe" VerticalAlignment="Top"  Content="{Binding RecipeType}" FontSize="15" HorizontalContentAlignment="Left" HorizontalAlignment="Left"   FontWeight="Normal" />
                 <Label Height="31" Margin="22,3,0,0"  VerticalAlignment="Top"  Content="{Binding CurrentRecipeName}" FontSize="15" HorizontalContentAlignment="Left" HorizontalAlignment="Left"   FontWeight="Normal" />-->
-                <Button  Style="{StaticResource MiddleButton}" Height="25"  Name="buttonReloadTableRecipe" VerticalAlignment="Top" FontSize="16"  Width="80" VerticalContentAlignment="Center" Command="{Binding ReL}"
-                         Margin="50,4,0,0" HorizontalAlignment="Right" Content="{DynamicResource GlobalLableButtonReload}" FontWeight="Normal"></Button>
+                <!--<Button  Style="{StaticResource MiddleButton}" Height="25"  Name="buttonReloadTableRecipe" VerticalAlignment="Top" FontSize="16"  Width="80" VerticalContentAlignment="Center" Command="{Binding ReLoadCommand}"
+                         Margin="50,4,0,0" HorizontalAlignment="Right" Content="{DynamicResource GlobalLableButtonReload}" FontWeight="Normal"></Button>-->
                 <!--<Button  Style="{StaticResource MiddleButton}" Height="25"  FontSize="16" Width="80"
                          VerticalContentAlignment="Center" Margin="30,4,22,0" HorizontalAlignment="Right" VerticalAlignment="Top" Content="{DynamicResource GlobalLableButtonSave}" FontWeight="Normal" Command="{Binding SaveRecipeCommand}"/>-->
                 <Button  Style="{StaticResource MiddleButton}" Height="25" Name="buttonSaveTableRecipe" FontSize="16" Width="80"
                          VerticalContentAlignment="Center" Margin="30,4,22,0" HorizontalAlignment="Right" VerticalAlignment="Top" Content="{DynamicResource GlobalLableButtonSave}" FontWeight="Normal" Command="{Binding SaveRecipeCommand}"/>
 
-                <Button Content="Add Step"     Command="{Binding AddStepCommand}" Margin="30,4,22,0" Width="80" Style="{StaticResource MiddleButton}"  FontSize="16" Height="25" VerticalContentAlignment="Center" HorizontalAlignment="Right" VerticalAlignment="Top"/>
-                <Button Content="Delete Step"  Command="{Binding DeleteStepCommand}" Margin="30,4,22,0" Width="80"  Style="{StaticResource MiddleButton}"  FontSize="16" Height="25" VerticalContentAlignment="Center" HorizontalAlignment="Right" VerticalAlignment="Top"/>
+                <Button Content="Add Step"     Command="{Binding AddStepCommand}"    Margin="30,4,22,0"      Style="{StaticResource MiddleButton}"  FontSize="16" Height="25" VerticalContentAlignment="Center" HorizontalAlignment="Right" VerticalAlignment="Top"/>
+                <Button Content="Delete Step"  Command="{Binding DeleteStepCommand}" Margin="30,4,22,0"      Style="{StaticResource MiddleButton}"  FontSize="16" Height="25" VerticalContentAlignment="Center" HorizontalAlignment="Right" VerticalAlignment="Top"/>
             </StackPanel>
             <Grid Grid.Row="1">
                 <core:RecipeEditorControl x:Name="tableRecipeGrid" FontSize="12" BorderThickness="1" BorderBrush="Black" Margin="0,0,0,6" />