Browse Source

Merge branch 'master' of http://git.jetplasma-oa.com/JetPlasma/Venus

sangwq 1 year ago
parent
commit
09de87bdab

+ 54 - 8
Venus/RecipeEditorControl/ViewModel/RecipeEditorControlViewModel.cs

@@ -213,10 +213,12 @@ namespace Aitex.UI.RecipeEditor
                 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")
@@ -246,12 +248,19 @@ namespace Aitex.UI.RecipeEditor
                                 Mode = BindingMode.TwoWay,        // 绑定模式  
                                 UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged    //触发器
                             };
-
                             switch (propertyTypeName)
                             {
                                 case "Int32":
                                 case "String":
                                     TextBox textBox = new TextBox();
+                                    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);
@@ -296,6 +305,30 @@ namespace Aitex.UI.RecipeEditor
                                     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:
@@ -306,6 +339,15 @@ namespace Aitex.UI.RecipeEditor
                                     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;
                             }
                         }                       
@@ -388,13 +430,17 @@ namespace Aitex.UI.RecipeEditor
 
                                     case "Boolean":
                                         CheckBox checkBox = new CheckBox();
-                                        checkbinding = new Binding
+                                        if (checkbinding == null)
                                         {
-                                            Source = checkBox,                // 数据源  
-                                            Path = new PropertyPath("IsChecked"), // 需绑定的数据源属性名  
-                                            Mode = BindingMode.TwoWay,        // 绑定模式  
-                                            UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged    //触发器
-                                        };
+                                            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);

+ 7 - 12
Venus/Venus_Core/Recipe.cs

@@ -195,12 +195,6 @@ namespace Venus_Core
     [Serializable]
     public class RecipeStep:INotifyPropertyChanged
     {
-        //public string m_UnitName="StepDescriptionUnit";
-        //public string UnitName
-        //{
-        //    get { return m_UnitName;}
-        //    set { m_UnitName = value; InvokePropertyChanged("UnitName"); }
-        //}
 
         [JsonIgnore]
         public Func<RecipeStep, RState> checker;
@@ -209,12 +203,6 @@ namespace Venus_Core
         [JsonIgnore]
         public Func<RecipeStep, RState> ender;
 
-        //private int m_StepNo;
-        //public int StepNo
-        //{
-        //    get { return m_StepNo; }
-        //    set { m_StepNo = value; InvokePropertyChanged("StepNo"); }
-        //}
 
         private int m_StepNo;
         [IsOnlyRead]
@@ -238,6 +226,13 @@ namespace Venus_Core
             set { m_Time = value; InvokePropertyChanged("Time"); }
         }
 
+        private bool m_EnableRamp;
+        public bool EnableRamp
+        {
+            get { return m_EnableRamp; }
+            set { m_EnableRamp = value; InvokePropertyChanged("EnableRamp"); }
+        }
+
         private string m_EPDConfigName;
         public string EPDConfigName
         {

+ 18 - 7
Venus/Venus_MainPages/ViewModels/OverViewModel.cs

@@ -17,12 +17,15 @@ using Venus_Themes.CustomControls;
 using Venus_MainPages.Unity;
 using Venus_Unity;
 using MECF.Framework.Common.CommonData.DeviceData;
+using System.Windows.Shapes;
+using Path = System.IO.Path;
 
 namespace Venus_MainPages.ViewModels
 {
     internal class OverViewModel : BindableBase
     {
         #region 私有字段
+        private List<string> m_CurrentModuleRecipes=new List<string>();
         private bool m_PVN21ValveIsOpen;
         private bool m_PVN22ValveIsOpen;
         private bool m_N2ValveIsOpen;
@@ -190,6 +193,12 @@ namespace Venus_MainPages.ViewModels
         #endregion
 
         #region  属性
+        public List<string> CurrentModuleRecipes
+        {
+            get { return m_CurrentModuleRecipes; }
+            set { SetProperty(ref m_CurrentModuleRecipes, value); }
+
+        }
         public Recipe CurrentRecipe
         {
             get { return m_CurrentRecipe; }
@@ -968,6 +977,8 @@ namespace Venus_MainPages.ViewModels
             ModuleName = "PMA";
             //addConfigKeys();
             //addDataKeys();
+            
+            CurrentModuleRecipes = GetFilesNames(Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName)).ToList();
 
             DispatcherTimer timer = new DispatcherTimer();
             timer.Interval = TimeSpan.FromSeconds(0.5);
@@ -1288,13 +1299,7 @@ namespace Venus_MainPages.ViewModels
         }
         private void OnLoadRecipe()
         {
-            OpenFileDialog dialog = new OpenFileDialog();
-            dialog.ShowReadOnly = true;
-            
-            dialog.Filter = ".rcp|*.rcp";
-            dialog.InitialDirectory = Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes");
-            if (dialog.ShowDialog() == false) return;
-            SelectedRecipe = dialog.SafeFileName.Split('.')[0];
+            CurrentModuleRecipes = GetFilesNames(Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", ModuleName)).ToList();
         }
 
         private async void OnHV()
@@ -1389,6 +1394,12 @@ namespace Venus_MainPages.ViewModels
         #endregion
 
         #region 私有方法
+
+        private  IEnumerable<string> GetFilesNames(string path)
+        {
+            return Directory.GetFiles(path, "*.rcp")
+      .Select(Path.GetFileNameWithoutExtension);
+        }
         void timer_Tick(object sender, EventArgs e)
         {
             RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);

+ 1 - 1
Venus/Venus_MainPages/Views/GasLeakCheckView.xaml

@@ -531,7 +531,7 @@
                 <TextBox   Grid.Row="2"  Grid.Column="1" BorderThickness="0" VerticalContentAlignment="Center" Text="{Binding CheckTime}"/>
                 <TextBox   Grid.Row="3"  Grid.Column="1" BorderThickness="0" VerticalContentAlignment="Center"  Text="{Binding LeakRateUpperLimit}"/>
 
-                <ComboBox  Grid.Row="4"  Grid.Column="1"  BorderBrush="Transparent" Margin="0" ItemsSource="{Binding LeakCheckMode}" SelectedIndex="{Binding LeakCheckModeSelectedIndex}" Style="{StaticResource customeStyle}"  BorderThickness="0"/>
+                <ComboBox  Grid.Row="4"  Grid.Column="1"  BorderBrush="Transparent" Margin="0" ItemsSource="{Binding LeakCheckMode}" SelectedIndex="{Binding LeakCheckModeSelectedIndex}" Style="{StaticResource customeComboBoxStyle}"  BorderThickness="0"/>
 
                 <CheckBox  Grid.Row="5"  Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" IsEnabled="{Binding LeakCheckModeSelectedIndex}">
                     <CheckBox.IsChecked>

+ 16 - 5
Venus/Venus_MainPages/Views/OverView.xaml

@@ -693,8 +693,8 @@
                 </i:Interaction.Triggers>
                 <ctrls:ButterflyValve.ContextMenu>
                     <ContextMenu>
-                        <MenuItem Header="ON"  Command="{Binding OpenPendulumValveCommand}"  IsChecked="{Binding PendulumValveIsOpen,Mode=OneWay}"                                        IsEnabled="{Binding PendulumValve,Converter={StaticResource BoolToBool},Mode=OneWay}"/>
-                        <MenuItem Header="OFF" Command="{Binding ClosePendulumValveCommand}" IsChecked="{Binding PendulumValveIsOpen,Converter={StaticResource BoolToBool},Mode=OneWay}"  IsEnabled="{Binding PendulumValve,Mode=OneWay}"/>
+                        <MenuItem Header="ON"  Command="{Binding OpenPendulumValveCommand}"  IsChecked="{Binding PendulumValveData.IsOpen,Mode=OneWay}"                                        IsEnabled="{Binding PendulumValve,Converter={StaticResource BoolToBool},Mode=OneWay}"/>
+                        <MenuItem Header="OFF" Command="{Binding ClosePendulumValveCommand}" IsChecked="{Binding PendulumValveData.IsOpen,Converter={StaticResource BoolToBool},Mode=OneWay}"  IsEnabled="{Binding PendulumValve,Mode=OneWay}"/>
                     </ContextMenu>
                 </ctrls:ButterflyValve.ContextMenu>
             </ctrls:ButterflyValve>
@@ -794,8 +794,19 @@
         </Canvas>
         <Canvas Canvas.Right="1250" Canvas.Top="120">
 
-            <Button Width="120" Height="30" Content="Load Recipe"  Canvas.Left="700" Canvas.Top="100" Command="{Binding LoadRecipeCommand}" IsEnabled="{Binding IsAutoMode}" Style="{x:Null}"/>
-            <TextBlock Background="Silver"  Height="30" Width="230" Canvas.Left="820" Canvas.Top="100" Text="{Binding SelectedRecipe}" TextBlock.TextAlignment="Center"    Block.TextAlignment="Center" Padding="0,7,0,0"/>
+            <!--<Button Width="120" Height="30" Content="Flash"  Canvas.Left="700" Canvas.Top="100" Command="{Binding LoadRecipeCommand}" IsEnabled="{Binding IsAutoMode}" Style="{x:Null}"/>-->
+            <!--<TextBlock Background="Silver"  Height="30" Width="230" Canvas.Left="820" Canvas.Top="100" Text="{Binding SelectedRecipe}" TextBlock.TextAlignment="Center"    Block.TextAlignment="Center" Padding="0,7,0,0"/>-->
+            <TextBox  Width="140" Height="30" Text="Recipe:"  Canvas.Left="700" Canvas.Top="100" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="15" IsReadOnly="True" Background="Transparent"/>
+            <Border Width="210" Height="28"  Canvas.Left="840" Canvas.Top="101" BorderBrush="Black" BorderThickness=".7">
+                <ComboBox  ItemsSource="{Binding CurrentModuleRecipes}" SelectedItem="{Binding SelectedRecipe}" IsEnabled="{Binding IsAutoMode}" Style="{StaticResource customeComboBoxStyle}" BorderBrush="White" FontSize="15">
+                    <i:Interaction.Triggers>
+                        <i:EventTrigger EventName="DropDownOpened">
+                            <i:InvokeCommandAction Command="{Binding LoadRecipeCommand}"/>
+                        </i:EventTrigger>
+                    </i:Interaction.Triggers>
+                </ComboBox>
+            </Border>
+           
             <Button Width="120" Height="30" Content="Start"  Canvas.Left="1100" Canvas.Top="100" IsEnabled="{Binding IsAutoMode}" Command="{Binding RunRecipeCommand}"/>
             
             <Grid  Width="540" Height="550" Canvas.Left="700" Canvas.Top="150"  unity:GridOptions.ShowBorder="True" unity:GridOptions.LineBrush="White"  unity:GridOptions.LineThickness="2">
@@ -1145,7 +1156,7 @@
 
             <!--<Button Grid.Row="0" Grid.Column="3" Content="Set" Style="{x:Null}" Margin="2" Command="{Binding SetChillerTempCommand}" Cursor="Hand"/>-->
             <StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="3">
-                <Ellipse Width="18" Height="18" Fill="{Binding ChillerIsOn,Converter={StaticResource boolToColor2}}"  Stroke="Silver" StrokeThickness="2"/>
+                <Ellipse Width="18" Height="18" Fill="{Binding ChillerIsOn,Converter={StaticResource boolToColor}}"  Stroke="Silver" StrokeThickness="2"/>
                 <Button Margin="5,0,0,0" Height="20" Width="70"  Style="{x:Null}" Content="ON/OFF"          Command="{Binding OnOffChillerCommand}"    CommandParameter="True"  IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" Cursor="Hand"/>
                 <Button Margin="5,0,0,0" Height="20" Width="70"  Style="{x:Null}" Content="Set"             Command="{Binding SetChillerTempCommand}"  CommandParameter="True"  IsEnabled="{Binding IsAutoMode,Converter={StaticResource BoolToBool}}" Cursor="Hand"/>
 

+ 4 - 4
Venus/Venus_Themes/Styles/ComboBox.xaml

@@ -456,7 +456,7 @@
     <SolidColorBrush x:Key="ComboBoxSelectedForeground" Color="White"/>
     <!--ComBoBox项鼠标经过前景色-->
     <SolidColorBrush x:Key="ComboBoxMouseOverForegrond" Color="White"/>
-    <Style TargetType="{x:Type ComboBox}" x:Key="customeStyle">
+    <Style TargetType="{x:Type ComboBox}" x:Key="customeComboBoxStyle">
         <Setter Property="ItemContainerStyle">
             <Setter.Value>
                 <Style TargetType="ComboBoxItem">
@@ -464,8 +464,8 @@
                     <Setter Property="Template">
                         <Setter.Value>
                             <ControlTemplate  TargetType="{x:Type ComboBoxItem}">
-                                <Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Width}">
-                                    <Border x:Name="_borderbg" Background="Transparent"/>
+                                <Grid Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Background="White">
+                                    <Border x:Name="_borderbg" Background="White"/>
                                     <TextBlock Margin="3 0 3 0" VerticalAlignment="Center" x:Name="_txt" Foreground="#333" Text="{Binding Content,RelativeSource={RelativeSource TemplatedParent}}"/>
                                     <Border x:Name="_border" Background="White" Opacity="0"/>
                                 </Grid>
@@ -494,7 +494,7 @@
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type ComboBox}">
-                    <Grid>
+                    <Grid Background="White">
 
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition Width="0.7*"/>