|
- <UserControl
- x:Class="BPASmart.VariableManager.Views.VariableConfig"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:con="clr-namespace:BPASmart.VariableManager.Converter"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:BPASmart.VariableManager.Views"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
- xmlns:vm="clr-namespace:BPASmart.VariableManager.ViewModels"
- d:DesignHeight="600"
- d:DesignWidth="1200"
- mc:Ignorable="d">
-
- <!--<UserControl.DataContext>
- <vm:VariableConfig />
- </UserControl.DataContext>-->
-
- <UserControl.Resources>
-
- <Style x:Key="TextBoxStyle" TargetType="TextBox">
- <Setter Property="FontFamily" Value="楷体" />
- <Setter Property="FontSize" Value="22" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Width" Value="188" />
- <Setter Property="Padding" Value="6,0,0,0" />
- <Setter Property="Height" Value="37" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="Foreground" Value="{StaticResource PoupTextblockColor}" />
- <Setter Property="BorderBrush" Value="{StaticResource PoupTextblockColor}" />
- <Setter Property="CaretBrush" Value="{StaticResource PoupTextblockColor}" />
- <Setter Property="VerticalAlignment" Value="Center" />
- <Setter Property="Background">
- <Setter.Value>
- <ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/textBox.png" Stretch="Fill" />
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style x:Key="TextBlockStyle" TargetType="TextBlock">
- <Setter Property="FontFamily" Value="楷体" />
- <Setter Property="FontSize" Value="18" />
- <Setter Property="Foreground" Value="{StaticResource PoupTextblockColor}" />
- <Setter Property="VerticalAlignment" Value="Center" />
- <Setter Property="HorizontalAlignment" Value="Center" />
- </Style>
-
- <Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type RadioButton}">
- <Border
- x:Name="NvaBor"
- Background="Transparent"
- BorderBrush="#FF2AB2E7"
- BorderThickness="0">
- <ContentControl
- Margin="10,4"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- HorizontalContentAlignment="Center"
- VerticalContentAlignment="Center"
- Content="{TemplateBinding Content}"
- FontSize="16" />
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="True">
- <Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
- <Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
- </Trigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsChecked" Value="false" />
- <Condition Property="IsMouseOver" Value="True" />
- </MultiTrigger.Conditions>
- <MultiTrigger.Setters>
- <Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
- </MultiTrigger.Setters>
- </MultiTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style x:Key="InputTextboxStyle" TargetType="TextBox">
- <Setter Property="Margin" Value="0,0,0,0" />
- <Setter Property="Padding" Value="5,0,5,0" />
- <Setter Property="BorderThickness" Value="0" />
- <Setter Property="HorizontalAlignment" Value="Left" />
- <Setter Property="Height" Value="40" />
- <Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
- <Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="FontSize" Value="14" />
- <Setter Property="Background" Value="Transparent" />
- <Setter Property="VerticalAlignment" Value="Center" />
- </Style>
-
- <Style x:Key="ControlButtonStyle" TargetType="Button">
- <Setter Property="Margin" Value="0" />
- <Setter Property="FontSize" Value="18" />
- <Setter Property="Foreground" Value="#FFF53F62" />
- <Setter Property="FontWeight" Value="SemiBold" />
- <Setter Property="FontFamily" Value="楷体" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="Button">
- <Border
- Name="TitleBarBr"
- BorderBrush="#00c2f4"
- BorderThickness="0"
- CornerRadius="0"
- Opacity="0.8">
-
- <ContentPresenter
- Margin="{TemplateBinding Margin}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
- <Border.Background>
- <ImageBrush
- ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
- Opacity="0.8"
- Stretch="Fill" />
- </Border.Background>
-
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
- <Setter Property="FontSize" Value="16" />
- <Setter Property="HorizontalAlignment" Value="Center" />
- <Setter Property="VerticalAlignment" Value="Center" />
- <Setter Property="Foreground" Value="{StaticResource tabColor}" />
- <Setter Property="FontFamily" Value="楷体" />
- <Setter Property="FontWeight" Value="SemiBold" />
- </Style>
-
- </UserControl.Resources>
-
- <Grid Margin="10" SizeChanged="TabGrid_SizeChanged">
- <Grid.RowDefinitions>
- <RowDefinition Height="40" />
- <RowDefinition Height="40" />
- <RowDefinition />
- </Grid.RowDefinitions>
-
- <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
- <Button
- Width="150"
- Height="40"
- Margin="10,0,10,0"
- Command="{Binding GenerateEntityClassCommand}"
- Content="生成实体类"
- FontSize="20"
- Style="{StaticResource ImageButtonStyle}" />
- <Button
- Width="150"
- Height="40"
- Margin="10,0,10,0"
- Command="{Binding StartMotionCommand}"
- Content="{Binding ButtonContext}"
- FontSize="20"
- Style="{StaticResource ImageButtonStyle}" />
- <Button
- Width="150"
- Height="40"
- Margin="10,0,10,0"
- Command="{Binding SaveCommand}"
- Content="保存参数"
- FontSize="20"
- Style="{StaticResource ImageButtonStyle}" />
- </StackPanel>
-
- <!--#region 表格标题栏设置-->
- <Grid
- Name="TabGrid"
- Grid.Row="1"
- Margin="0,10,0,0"
- Background="#ff0C255F">
-
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="0.2*" />
- <ColumnDefinition />
- <ColumnDefinition Width="0.4*" />
- <ColumnDefinition Width="0.3*" />
- <ColumnDefinition Width="0.2*" />
- <ColumnDefinition Width="0.2*" />
- <ColumnDefinition Width="0.2*" />
- </Grid.ColumnDefinitions>
-
- <TextBlock
- Grid.Column="0"
- Style="{StaticResource TitleTextblockStyle}"
- Text="ID" />
-
- <Grid Grid.Column="1">
- <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="名称" />
- <Border
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,0"
- Cursor="SizeWE" />
- </Grid>
-
- <TextBlock
- Grid.Column="2"
- Style="{StaticResource TitleTextblockStyle}"
- Text="地址" />
-
- <Grid Grid.Column="3">
- <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="数据类型" />
- <Border
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,0"
- Cursor="SizeWE" />
- </Grid>
-
- <Grid Grid.Column="4">
- <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="报警" />
- <Border
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,0"
- Cursor="SizeWE" />
- </Grid>
-
- <TextBlock
- Grid.Column="5"
- Style="{StaticResource TitleTextblockStyle}"
- Text="报警配置" />
-
- <Grid Grid.Column="6">
- <TextBlock Style="{StaticResource TitleTextblockStyle}" Text="{Binding TabName}" />
- <Border
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,0"
- Cursor="SizeWE" />
- </Grid>
-
-
-
- <Border
- Grid.ColumnSpan="8"
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,0" />
-
- </Grid>
- <!--#endregion-->
-
- <Grid Grid.Row="2">
- <ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
- <ItemsControl ItemsSource="{Binding varialeInfos}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Grid Name="gr" Height="30">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="0.2*" />
- <ColumnDefinition />
- <ColumnDefinition Width="0.4*" />
- <ColumnDefinition Width="0.3*" />
- <ColumnDefinition Width="0.2*" />
- <ColumnDefinition Width="0.2*" />
- <ColumnDefinition Width="0.2*" />
- </Grid.ColumnDefinitions>
-
- <TextBlock
- Grid.Column="0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Background="Transparent"
- FontSize="14"
- Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
- Text="{Binding ID}" />
-
- <Grid Grid.Column="1" KeyDown="TextBox_KeyDown">
- <TextBox
- Width="{Binding DataContext.NameWidth, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
- IsEnabled="{Binding DataContext.IsEnable, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- Style="{StaticResource InputTextboxStyle}"
- TabIndex="{Binding ID}"
- Text="{Binding VarName}" />
- <Border
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,0"
- Cursor="SizeWE" />
- </Grid>
-
- <TextBox
- Grid.Column="2"
- Width="{Binding DataContext.AddressWidth, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
- IsEnabled="{Binding DataContext.IsEnable, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- KeyDown="TextBox_KeyDown"
- Style="{StaticResource InputTextboxStyle}"
- TabIndex="{Binding ID}"
- Text="{Binding Address}" />
-
- <Grid Grid.Column="3">
- <ComboBox
- Name="cb"
- VerticalAlignment="Center"
- BorderBrush="Transparent"
- BorderThickness="1"
- FontFamily="楷体"
- FontSize="20"
- Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
- IsEditable="False"
- IsEnabled="{Binding DataContext.IsEnable, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- ItemsSource="{Binding DataContext.dataType, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- SelectedValue="{Binding DataType}"
- Style="{StaticResource ComboBoxStyle}"
- Text="{Binding DataType}" />
-
- <Border
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,0"
- Cursor="SizeWE" />
- </Grid>
-
- <CheckBox
- Grid.Column="4"
- Margin="0,6"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Background="#009dff"
- FontSize="16"
- Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
- IsChecked="{Binding IsEnableAlarm}"
- IsEnabled="{Binding ElementName=cb, Path=Text, Converter={StaticResource IsEnableConvert}}"
- Template="{StaticResource CbTemplate}" />
- <!-- Content="{Binding IsEnableAlarm, Converter={StaticResource textDisplayConvert}}" -->
- <!--<TextBox
- Grid.Column="4"
- Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
- Style="{StaticResource InputTextboxStyle}"
- Text="{Binding SlowAcceleration}" />-->
-
-
-
- <Grid Grid.Column="5">
- <Grid>
- <ToggleButton
- Name="tb"
- Width="{Binding RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=1}, Path=ActualWidth}"
- Height="{Binding RelativeSource={RelativeSource AncestorType=Grid, AncestorLevel=1}, Path=ActualHeight}"
- Background="Transparent"
- BorderThickness="0"
- Content="编辑"
- FontSize="14"
- IsChecked="{Binding IsOpen}"
- IsEnabled="{Binding IsEnableAlarm}"
- Style="{StaticResource EditToggleButtonStyle}" />
- </Grid>
-
-
- <!-- 当 StaysOpen 设置为 True 时 popup失去焦点的时候不会自动关闭 -->
- <Popup
- AllowsTransparency="True"
- Focusable="False"
- IsOpen="{Binding IsOpen}"
- Placement="Left"
- PlacementTarget="{Binding ElementName=tb}"
- StaysOpen="False">
- <Border Background="#081424" ClipToBounds="True">
- <Grid Margin="0">
- <Grid.Background>
- <ImageBrush ImageSource="/Resources/Images/边框1.png" />
- </Grid.Background>
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition />
- <RowDefinition />
- </Grid.RowDefinitions>
-
-
- <!--#region 离散量报警设置-->
- <StackPanel
- Grid.Row="0"
- Margin="10"
- Orientation="Vertical"
- Visibility="{Binding DataType, Converter={StaticResource discreteAlarmConvert}}">
-
- <Grid Margin="5">
- <pry:TitleTextBlock />
- <TextBlock
- Margin="10,5,30,5"
- Background="Transparent"
- FontSize="16"
- Foreground="#dd01FFFF"
- Text="离散量报警设置" />
- </Grid>
-
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
-
- <TextBlock
- Margin="5"
- Style="{StaticResource TextBlockStyle}"
- Text="选择触发模式:" />
-
- <ComboBox
- Grid.Column="1"
- Width="180"
- Margin="5"
- VerticalAlignment="Center"
- BorderBrush="#009dff"
- BorderThickness="1"
- FontFamily="楷体"
- FontSize="20"
- Foreground="#009dff"
- IsEditable="False"
- ItemsSource="{Binding DataContext.PopupDiscreteAlarmType, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- SelectedIndex="1"
- Style="{StaticResource ComboBoxStyle}"
- Text="{Binding DiscreteAlarmInfoSet.TrigAlarm}" />
- </Grid>
-
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
- <TextBlock
- Grid.Column="0"
- Margin="5"
- Style="{StaticResource TextBlockStyle}"
- Text="输入报警信息:" />
- <TextBox
- Grid.Column="1"
- Grid.ColumnSpan="2"
- Style="{StaticResource TextBoxStyle}"
- Text="{Binding DiscreteAlarmInfoSet.AlarmInfo}" />
- </Grid>
-
- </StackPanel>
- <!--#endregion-->
-
- <!--#region 模拟量报警设置-->
- <StackPanel
- Grid.Row="1"
- Margin="10"
- Visibility="{Binding DataType, Converter={StaticResource analogAlarmConvert}}">
-
- <Grid Margin="5">
- <pry:TitleTextBlock />
- <TextBlock
- Margin="10,5,30,5"
- Background="Transparent"
- FontSize="16"
- Foreground="#dd01FFFF"
- Text="模拟量报警设置" />
- </Grid>
-
- <ItemsControl ItemsSource="{Binding AnalogAlarmModels}">
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Grid Margin="0,0,0,8">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
-
- <Grid.RowDefinitions>
- <RowDefinition />
- <RowDefinition />
- </Grid.RowDefinitions>
-
- <Border
- Grid.RowSpan="2"
- Grid.ColumnSpan="3"
- BorderBrush="#55009dff"
- BorderThickness="0,0,0,1" />
-
- <CheckBox
- Margin="5,5,0,0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Background="#009dff"
- Content="{Binding AlarmTag}"
- FontSize="14"
- Foreground="#009dff"
- IsChecked="{Binding IsEnable}"
- Template="{StaticResource CbTemplate}" />
-
- <TextBlock
- Grid.Column="1"
- Margin="0,5,5,0"
- Style="{StaticResource TextBlockStyle}"
- Text="请输入报警值:" />
- <TextBox
- Grid.Column="2"
- Width="100"
- Margin="0,5,5,0"
- IsEnabled="{Binding IsEnable}"
- Style="{StaticResource TextBoxStyle}"
- Text="{Binding AlarmValue}" />
-
- <TextBlock
- Grid.Row="1"
- Grid.Column="0"
- Margin="5"
- Style="{StaticResource TextBlockStyle}"
- Text="输入报警信息:" />
- <TextBox
- Grid.Row="1"
- Grid.Column="1"
- Grid.ColumnSpan="2"
- Width="230"
- Height="35"
- Margin="5"
- IsEnabled="{Binding IsEnable}"
- Style="{StaticResource TextBoxStyle}"
- Text="{Binding AlarmInfo}" />
-
- </Grid>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
-
- </StackPanel>
- <!--#endregion-->
-
- <!--#region 按钮控制-->
-
- <Grid Grid.Row="2" Margin="10">
- <Grid.ColumnDefinitions>
- <ColumnDefinition />
- <ColumnDefinition />
- </Grid.ColumnDefinitions>
-
-
- <Button
- Height="40"
- Margin="10,5,10,10"
- Command="{Binding CancelCommand}"
- Content="取消"
- FontFamily="楷体"
- FontSize="20"
- FontWeight="DemiBold"
- Foreground="#009dff"
- Style="{StaticResource FGImageButtonStyle}" />
-
- <Button
- Grid.Column="1"
- Height="40"
- Margin="10,5,10,10"
- Command="{Binding ConfirmCommand}"
- Content="确认"
- FontFamily="楷体"
- FontSize="20"
- FontWeight="DemiBold"
- Foreground="#009dff"
- Style="{StaticResource FGImageButtonStyle}" />
-
- </Grid>
-
- <!--#endregion-->
-
- </Grid>
- </Border>
- </Popup>
- <Border
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,0"
- Cursor="SizeWE" />
- </Grid>
-
- <TextBlock
- Grid.Column="6"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Background="Transparent"
- FontSize="14"
- Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
- Text="{Binding CurrentValue}"
- Visibility="{Binding DataContext.CurrentVisibility, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" />
-
- <Button
- Grid.Column="6"
- Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
- CommandParameter="{Binding}"
- Content="删除"
- FontSize="16"
- Style="{StaticResource ControlButtonStyle}"
- Visibility="{Binding DataContext.RemoveButVisiblity, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}" />
-
- <Border
- Grid.ColumnSpan="7"
- BorderBrush="{StaticResource bordColor}"
- BorderThickness="1,0,1,1" />
-
- </Grid>
- <DataTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
- </Trigger>
- </DataTemplate.Triggers>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </ScrollViewer>
- </Grid>
-
-
- </Grid>
-
- </UserControl>
|