123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- <UserControl x:Class="GDNXFD.Alert.Config.Views.RuleForm"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:val="clr-namespace:GDNXFD.Alert.Config.Validations"
- xmlns:control="clr-namespace:GDNXFD.Alert.Config.Controls"
- xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
- xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"
- mc:Ignorable="d"
- d:DesignHeight="666" d:DesignWidth="1024" Background="{StaticResource module-background-color-brush }" >
- <Grid >
- <Grid.RowDefinitions>
- <RowDefinition Height="24px"></RowDefinition>
- <RowDefinition Height="auto"></RowDefinition>
- <RowDefinition Height="*"></RowDefinition>
- <RowDefinition Height="auto"></RowDefinition>
- <RowDefinition Height="50px"></RowDefinition>
- </Grid.RowDefinitions>
- <!--导航-->
- <Grid Grid.Row="0" Background="{StaticResource second-background-color-brush }" >
- <Button Grid.Row="0" Style="{StaticResource BackButtonStyle}" Width="18" Height="18"
- ToolTip="{Binding Back, Source={StaticResource Provider}, Mode=OneWay}"
- Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.CancelCommand }" >
- <Image Source="/Resources/Images/back.png" Stretch="Uniform" Width="15" Height="15"></Image>
- </Button>
- <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource FormTitleStyle}">
- <Run Text="{Binding FormTitle, Mode=OneWay}" />
- </TextBlock>
- </Grid>
- <Border Grid.Row="1" IsEnabled="{Binding IsFormEditable}" Style="{StaticResource FormBorderStyle}" Background="{StaticResource second-background-color-brush }" >
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition></RowDefinition>
- <RowDefinition></RowDefinition>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock Text="统一编码" Grid.Row="0" Grid.Column="0"
- Style="{StaticResource LabelStyle}" Margin="0"></TextBlock>
- <TextBox Style="{StaticResource TextBox}"
- Grid.Row="1" Grid.Column="0" IsEnabled="{Binding IsIdEditable}" >
- <TextBox.Text>
- <Binding Path="AlertRule.Id" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" ValidatesOnDataErrors="True" NotifyOnSourceUpdated="True">
- <Binding.ValidationRules>
- <val:AlertRuleIDValidationRule ValidatesOnTargetUpdated="True"></val:AlertRuleIDValidationRule>
- </Binding.ValidationRules>
- </Binding>
- </TextBox.Text>
- </TextBox>
- <TextBlock Text="规则名称" Grid.Row="0" Grid.Column="1" Margin="10,0,0,0"
- Style="{StaticResource LabelStyle}"></TextBlock>
- <TextBox Style="{StaticResource TextBox}" Grid.Row="1" Grid.Column="1" Margin="10,0,0,0" >
- <TextBox.Text>
- <Binding Path="AlertRule.Name" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" ValidatesOnDataErrors="True" NotifyOnSourceUpdated="True">
- <Binding.ValidationRules>
- <val:RequiredValidationRule ValidatesOnTargetUpdated="True"></val:RequiredValidationRule>
- </Binding.ValidationRules>
- </Binding>
- </TextBox.Text>
- </TextBox>
- <TextBlock Style="{StaticResource LabelStyle}" Grid.Row="0" Grid.Column="2"
- Margin="10,0,0,0" Text="报警级别"></TextBlock>
- <ComboBox VerticalAlignment="Center" Style="{StaticResource ComboBox}" Grid.Row="1" Grid.Column="2"
- Margin="10,0,0,0" ItemsSource="{Binding LevelList}" DisplayMemberPath="Name">
- <ComboBox.SelectedItem>
- <Binding Path="SelectedAlertLevel" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
- <Binding.ValidationRules>
- <val:SelectedAlertLevelValidationRule ValidatesOnTargetUpdated="True" ValidationStep="UpdatedValue"></val:SelectedAlertLevelValidationRule>
- </Binding.ValidationRules>
- </Binding>
- </ComboBox.SelectedItem>
- </ComboBox>
- <TextBlock Style="{StaticResource LabelStyle}" Grid.Row="0" Grid.Column="3"
- Margin="10,0,0,0" Text="报警类型"></TextBlock>
- <ComboBox VerticalAlignment="Center" Style="{StaticResource ComboBox}" Grid.Row="1" Grid.Column="3"
- Margin="10,0,0,0" ItemsSource="{Binding CategoryList}" DisplayMemberPath="Name">
- <ComboBox.SelectedItem>
- <Binding Path="SelectedAlertCategory" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged">
- <Binding.ValidationRules>
- <val:SelectedAlertCategoryValidationRule ValidatesOnTargetUpdated="True" ValidationStep="UpdatedValue"></val:SelectedAlertCategoryValidationRule>
- </Binding.ValidationRules>
- </Binding>
- </ComboBox.SelectedItem>
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="SelectionChanged">
- <cmd:EventToCommand Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.CategorySelectionChangedCommand }"
- PassEventArgsToCommand="True" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </ComboBox>
- <TextBlock Style="{StaticResource LabelStyle}" Grid.Row="0" Grid.Column="4"
- Margin="10,0,0,0" Text="是否启用"/>
- <StackPanel Margin="10,0,0,0" Grid.Row="1" Grid.Column="4" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left">
- <RadioButton Style="{StaticResource FormRadios}" Margin="5 0 0 0" IsChecked="{Binding Path=AlertRuleEnabled}"
- Content="启 用"/>
- <RadioButton Style="{StaticResource FormRadios}" Margin="20 0 0 0" IsChecked="{Binding Path=AlertRuleDisabled}"
- Content="停 用"/>
- </StackPanel>
- </Grid>
- </Border>
- <Border Grid.Row="2" Style="{StaticResource FormBorderStyle}" IsEnabled="{Binding IsFormEditable}" Background="{StaticResource second-background-color-brush }" >
- <Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4">
- <Grid.RowDefinitions>
- <RowDefinition MaxHeight="300" ></RowDefinition>
- <RowDefinition Height="*"></RowDefinition>
- <RowDefinition Height="10"></RowDefinition>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="80"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <!--<TextBlock Grid.Row="2" Grid.Column="0" Text="表达式" Style="{StaticResource LabelStyle}"></TextBlock>-->
- <!--<Button Grid.Row="2" Grid.Column="1" Style="{StaticResource ConfirmButtonStyle}" Height="20" Width="80"
- HorizontalAlignment="Left" VerticalAlignment="Bottom"
- Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.CheckExpressionCommand }"
- ToolTip="{Binding UploadFile, Source={StaticResource Provider}, Mode=OneWay}">
- <TextBlock Text="验 证" Style="{StaticResource ButtonLabelStyle}"></TextBlock>
- </Button>-->
- <TextBox x:Name="txtExpression" Grid.Row="1" Grid.ColumnSpan="2"
- TextWrapping="Wrap" AcceptsReturn="True" Padding="3" VerticalContentAlignment="Top"
- MaxLength="3999" MinHeight="80" >
- <TextBox.Text>
- <Binding Path="AlertRule.Expression" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" ValidatesOnDataErrors="True" NotifyOnSourceUpdated="True">
- <Binding.ValidationRules>
- <val:RequiredValidationRule ValidatesOnTargetUpdated="True"></val:RequiredValidationRule>
- </Binding.ValidationRules>
- </Binding>
- </TextBox.Text>
- </TextBox>
- <Border Grid.Row="0" Grid.ColumnSpan="2" Visibility="{Binding ShowExpressionEditor, Converter={StaticResource BooleanToVisibilityConverter}}"
- BorderThickness="1" BorderBrush="Gray" >
- <Grid MaxHeight="300" MinHeight="100">
- <Grid.RowDefinitions>
- <RowDefinition Height="20" ></RowDefinition>
- <RowDefinition Height="*"></RowDefinition>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition></ColumnDefinition>
- <ColumnDefinition Width="3"></ColumnDefinition>
- <ColumnDefinition></ColumnDefinition>
- <ColumnDefinition Width="3"></ColumnDefinition>
- <ColumnDefinition></ColumnDefinition>
- <ColumnDefinition Width="3"></ColumnDefinition>
- <ColumnDefinition></ColumnDefinition>
- <ColumnDefinition Width="3"></ColumnDefinition>
- <ColumnDefinition></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <GridSplitter Grid.Column="1" Grid.RowSpan="2" Width="2" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="#dddddd" />
- <GridSplitter Grid.Column="3" Grid.RowSpan="2" Width="2" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="#dddddd" />
- <GridSplitter Grid.Column="5" Grid.RowSpan="2" Width="2" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="#dddddd" />
- <GridSplitter Grid.Column="7" Grid.RowSpan="2" Width="2" HorizontalAlignment="Center" VerticalAlignment="Stretch" Background="#dddddd" />
- <!--范围-->
- <StackPanel Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Orientation="Vertical" Margin="6 0 6 0" VerticalAlignment="Top">
- <TextBlock Grid.Row="0" Text="风场" Style="{StaticResource LabelStyle}"
- Visibility="{Binding ShowStation, Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
- <control:MultiSelectComboBox x:Name="mcStation"
- Visibility="{Binding ShowStation, Converter={StaticResource BooleanToVisibilityConverter}}"
- ItemsSource="{Binding ItemsStation}" SelectedItems="{Binding SelectedItemsStation}" >
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="SelectionChanged">
- <cmd:EventToCommand Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.StationSelectionChangedCommand }"
- PassEventArgsToCommand="True" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </control:MultiSelectComboBox>
- <TextBlock Grid.Row="0" Text="风机类型" Style="{StaticResource LabelStyle}"
- Visibility="{Binding ShowModel, Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
- <control:MultiSelectComboBox x:Name="mcModel"
- Visibility="{Binding ShowModel, Converter={StaticResource BooleanToVisibilityConverter}}"
- ItemsSource="{Binding ItemsModel}" SelectedItems="{Binding SelectedItemsModel}" >
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="SelectionChanged">
- <cmd:EventToCommand Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.ModelSelectionChangedCommand }"
- PassEventArgsToCommand="True" />
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </control:MultiSelectComboBox>
- <TextBlock Grid.Row="0" Text="风机" Style="{StaticResource LabelStyle}"
- Visibility="{Binding ShowWindturbine, Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
- <control:MultiSelectComboBox x:Name="mcWindturbine"
- Visibility="{Binding ShowWindturbine, Converter={StaticResource BooleanToVisibilityConverter}}"
- ItemsSource="{Binding ItemsWindturbine,Mode=TwoWay}" SelectedItems="{Binding SelectedItemsWindturbine, Mode=TwoWay}" />
- <TextBlock Grid.Row="0" Text="工程" Style="{StaticResource LabelStyle}"
- Visibility="{Binding ShowProject, Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
- <control:MultiSelectComboBox x:Name="mcProject"
- Visibility="{Binding ShowProject, Converter={StaticResource BooleanToVisibilityConverter}}"
- ItemsSource="{Binding ItemsProject}" SelectedItems="{Binding SelectedItemsProject}" />
- <TextBlock Grid.Row="0" Text="线路" Style="{StaticResource LabelStyle}"
- Visibility="{Binding ShowLine, Converter={StaticResource BooleanToVisibilityConverter}}"></TextBlock>
- <control:MultiSelectComboBox x:Name="mcLine"
- Visibility="{Binding ShowLine, Converter={StaticResource BooleanToVisibilityConverter}}"
- ItemsSource="{Binding ItemsLine}" SelectedItems="{Binding SelectedItemsLine}" />
- </StackPanel>
- <!--AI测点-->
- <Grid Grid.Row="0" Grid.Column="2">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="70"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock Grid.Column="0" Style="{StaticResource LabelStyle}" Text="AI测点" />
- <!--规则列表检索条件-->
- <control:TextBoxKeyboard Grid.Column="1" MaxLength="50" Style="{StaticResource TextBox}"
- Text="{Binding AIFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- Template="{DynamicResource SearchTextBoxTemplate}">
- </control:TextBoxKeyboard>
- </Grid>
- <ListBox Grid.Row="1" Grid.Column="2" ItemsSource="{Binding AiList}" ItemTemplate="{StaticResource TestingPointTemplate}"
- MouseDoubleClick="ListBoxAI_MouseDoubleClick">
- </ListBox>
-
- <!--DI测点-->
- <Grid Grid.Row="0" Grid.Column="4">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="70"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock Grid.Column="0" Style="{StaticResource LabelStyle}" Text="DI测点" />
- <!--规则列表检索条件-->
- <control:TextBoxKeyboard Grid.Column="1" MaxLength="50" Style="{StaticResource TextBox}"
- Text="{Binding DIFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- Template="{DynamicResource SearchTextBoxTemplate}">
- </control:TextBoxKeyboard>
- </Grid>
- <ListBox Grid.Row="1" Grid.Column="4" ItemsSource="{Binding DiList}" ItemTemplate="{StaticResource TestingPointTemplate}"
- MouseDoubleClick="ListBoxDI_MouseDoubleClick" >
- </ListBox>
-
- <!--数学函数-->
- <Grid Grid.Row="0" Grid.Column="6">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="70"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock Grid.Column="0" Style="{StaticResource LabelStyle}" Text="函数" />
- <!--规则列表检索条件-->
- <control:TextBoxKeyboard Grid.Column="1" MaxLength="50" Style="{StaticResource TextBox}"
- Text="{Binding MethodFilter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- Template="{DynamicResource SearchTextBoxTemplate}">
- </control:TextBoxKeyboard>
- </Grid>
- <ListBox Grid.Row="1" Grid.Column="6" MouseDoubleClick="ListBoxMath_MouseDoubleClick"
- ItemsSource="{Binding MethodList}">
- </ListBox>
- <!--运算符-->
- <Border Grid.Row="0" Grid.Column="8" >
- <TextBlock Style="{StaticResource LabelStyle}">
- <Run Text="运算符"></Run>
- </TextBlock>
- </Border>
- <ListBox Grid.Row="1" Grid.Column="8" MouseDoubleClick="ListBoxSymbol_MouseDoubleClick" >
- <ListBox.ItemsPanel>
- <ItemsPanelTemplate>
- <UniformGrid Columns="4" Rows="6"/>
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">+</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">-</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">*</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">/</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">(</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">)</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">></ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">>=</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}"><</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}"><=</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">==</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">!=</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">&&</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">||</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">!</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">%</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">true</ListBoxItem>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}" Content="false" Margin="0"/>
- <ListBoxItem Style="{StaticResource AlternativeColorItemStyle}">,</ListBoxItem>
- </ListBox>
- </Grid>
- </Border>
- </Grid>
- </Border>
- <Border Grid.Row="3" IsEnabled="{Binding IsFormEditable}" Style="{StaticResource FormBorderStyle}" Background="{StaticResource second-background-color-brush }" >
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition></RowDefinition>
- <RowDefinition></RowDefinition>
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="*"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <TextBlock Style="{StaticResource LabelStyle}" Grid.Row="0" Grid.Column="0" Text="规则描述"/>
- <TextBox Text="{Binding AlertRule.Description, Mode=TwoWay}"
- Grid.Row="1" Grid.Column="0" Style="{StaticResource TextArea}" />
- <TextBlock Grid.Row="0" Grid.Column="1" Margin="10,0,0,0" Text="标签" Style="{StaticResource LabelStyle}"></TextBlock>
- <TextBox x:Name="txtTag" Grid.Row="1" Grid.Column="1" Margin="10,0,0,0" Text="{Binding AlertRule.Tag, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnSourceUpdated=True}"
- Style="{StaticResource TextArea}" />
- </Grid>
- </Border>
- <Grid Grid.Row="4" Margin="0,10,0,10" >
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"></ColumnDefinition>
- <ColumnDefinition Width="60"></ColumnDefinition>
- <ColumnDefinition Width="20"></ColumnDefinition>
- <ColumnDefinition Width="80"></ColumnDefinition>
- <ColumnDefinition Width="60"></ColumnDefinition>
- </Grid.ColumnDefinitions>
- <Button Grid.Column="1" Style="{StaticResource ConfirmButtonStyle}" Height="30" Width="60" Focusable="True"
- HorizontalAlignment="Left" VerticalAlignment="Bottom" IsEnabled="{Binding IsFormEditable}"
- Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.SaveCommand }" IsDefault="True">
- <TextBlock Text="确 定" Style="{StaticResource ButtonLabelStyle}"></TextBlock>
- </Button>
- <Button Grid.Column="3" Name="CancelButton" Style="{StaticResource CancelButtonStyle}" Height="30" Width="60" Focusable="True"
- HorizontalAlignment="Right" VerticalAlignment="Bottom" IsDefault="True"
- Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.CancelCommand }" IsCancel="True">
- <TextBlock Text="取 消" Style="{StaticResource ButtonLabelStyle}"></TextBlock>
- </Button>
- </Grid>
- </Grid>
- </UserControl>
|