Files
CapMachine/CapMachine.Wpf/Views/DialogLogicRuleView.xaml
2025-07-11 14:58:47 +08:00

328 lines
14 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<UserControl
x:Class="CapMachine.Wpf.Views.DialogLogicRuleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
Width="1600"
Height="800"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<DataGrid
Name="MainDatagrid"
Margin="5"
AutoGenerateColumns="False"
CanUserAddRows="False"
HeadersVisibility="Column"
IsReadOnly="True"
ItemsSource="{Binding ListLogicRuleDto}">
<DataGrid.Columns>
<DataGridTextColumn
Width="180"
Binding="{Binding Name}"
Header="规则名称" />
<DataGridTextColumn
Width="180"
Binding="{Binding ParameterType}"
Header="参数类型" />
<DataGridTextColumn
Width="*"
Binding="{Binding Expression}"
Header="表达式" />
<DataGridTextColumn
Width="100"
Binding="{Binding Description}"
Header="描述" />
</DataGrid.Columns>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<prism:InvokeCommandAction Command="{Binding GridSelectionChangedCmd}" CommandParameter="{Binding ElementName=MainDatagrid, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</DataGrid>
<!-- 右侧编辑面板 -->
<Grid Grid.Column="1" Margin="10,5,5,5">
<Grid.Resources>
<Style x:Key="EditLabelStyle" TargetType="TextBlock">
<Setter Property="Width" Value="100" />
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="5,0" />
</Style>
<Style x:Key="EditTextBoxStyle" TargetType="TextBox">
<Setter Property="FontSize" Value="16" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,5" />
<Setter Property="Padding" Value="5,3" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 标题 -->
<Border
Grid.Row="0"
Margin="0,0,0,5"
Padding="10,5"
Background="#2196F3"
CornerRadius="5">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="5,0,10,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="22"
Foreground="White"
Text="&#xe73a;" />
<TextBlock
VerticalAlignment="Center"
FontSize="18"
FontWeight="Bold"
Foreground="White"
Text="规则详情" />
</StackPanel>
</Border>
<!-- 名称 -->
<StackPanel
Grid.Row="1"
Margin="0,5"
Orientation="Horizontal">
<TextBlock
Margin="5,0,10,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="18"
Text="&#xe6f0;" />
<TextBlock Style="{StaticResource EditLabelStyle}" Text="规则名称" />
<TextBox
Width="250"
Style="{StaticResource EditTextBoxStyle}"
Text="{Binding SelectedRule.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<!-- 描述 -->
<StackPanel
Grid.Row="2"
Margin="0,5"
Orientation="Horizontal">
<TextBlock
Margin="5,0,10,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="18"
Text="&#xe7e4;" />
<TextBlock Style="{StaticResource EditLabelStyle}" Text="规则描述" />
<TextBox
Width="250"
Style="{StaticResource EditTextBoxStyle}"
Text="{Binding SelectedRule.Description, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<!-- 参数类型 -->
<StackPanel
Grid.Row="3"
Margin="0,5"
Orientation="Horizontal">
<TextBlock
Margin="5,0,10,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="18"
Text="&#xe9c1;" />
<TextBlock Style="{StaticResource EditLabelStyle}" Text="参数类型" />
<TextBox
Width="250"
Style="{StaticResource EditTextBoxStyle}"
Text="{Binding SelectedRule.ParameterType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<!-- 表达式 -->
<StackPanel
Grid.Row="4"
Margin="0,5"
Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="5,0,10,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="18"
Text="&#xe661;" />
<TextBlock
Style="{StaticResource EditLabelStyle}"
Text="规则表达式:"
TextWrapping="Wrap" />
</StackPanel>
<Border
Margin="3,5"
BorderBrush="Gray"
BorderThickness="1">
<!--<RichTextBox 1可输入公式2输入值用value 代替3公式需符合三元表达式可嵌套
Height="200"
materialDesign:HintAssist.Hint="规则输入"
AcceptsReturn="True"
IsDocumentEnabled="True"
IsReadOnly="False"
SpellCheck.IsEnabled="True"
VerticalScrollBarVisibility="Auto">
<FlowDocument>
<Paragraph>
<Run FontWeight="Bold">
注意:
1可输入公式
2输入值用value 代替;
3公式需符合三元表达式可嵌套
</Run>
<LineBreak />
<Run
FontStyle="Normal"
FontWeight="Bold"
Foreground="Blue"
Text="{Binding SelectedRule.Expression}" />
<LineBreak />
</Paragraph>
</FlowDocument>
</RichTextBox>-->
<TextBox
Height="360"
Margin="0"
Padding="5"
AcceptsReturn="True"
Background="#404040"
FontSize="16"
FontWeight="Bold"
Foreground="WhiteSmoke"
Text="{Binding SelectedRule.Expression, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto" />
</Border>
<TextBlock
FontSize="14"
Text="1可输入公式2输入值用value 代替3公式需符合三元表达式可嵌套"
TextWrapping="Wrap" />
</StackPanel>
<!-- 操作按钮 -->
<StackPanel
Grid.Row="5"
Margin="0,20,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Orientation="Horizontal">
<Button
Margin="5,0"
Padding="15,5"
Command="{Binding RuleCmd}"
CommandParameter="Create">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="2,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="18"
Foreground="White"
Text="&#xe8c0;" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Foreground="White"
Text="新建" />
</StackPanel>
</Button>
<Button
Margin="5,0"
Padding="15,5"
Command="{Binding RuleCmd}"
CommandParameter="Update">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="2,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="18"
Foreground="White"
Text="&#xe625;" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Foreground="White"
Text="更新" />
</StackPanel>
</Button>
<Button
Margin="5,0"
Padding="15,5"
Command="{Binding RuleCmd}"
CommandParameter="Delete">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="2,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="18"
Foreground="White"
Text="&#xe933;" />
<TextBlock
VerticalAlignment="Center"
FontSize="14"
Foreground="White"
Text="删除" />
</StackPanel>
</Button>
</StackPanel>
</Grid>
</Grid>
<StackPanel
Grid.Row="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Margin="10,10"
Command="{Binding SaveCmd}"
Content="确定"
Foreground="White" />
<!--<Button
Margin="10,0"
Command="{Binding CancelCmd}"
Content="取消"
Foreground="White" />-->
</StackPanel>
</Grid>
</UserControl>