2025-09-14 19:13:40 +08:00
|
|
|
<UserControl x:Class="DMS.WPF.Views.TriggersView"
|
2025-09-14 16:16:10 +08:00
|
|
|
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"
|
2025-09-14 19:13:40 +08:00
|
|
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
2025-09-14 21:18:01 +08:00
|
|
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
|
|
|
|
xmlns:converters="clr-namespace:DMS.WPF.Converters"
|
2025-09-14 16:16:10 +08:00
|
|
|
mc:Ignorable="d"
|
2025-10-19 14:55:09 +08:00
|
|
|
|
2025-09-14 19:13:40 +08:00
|
|
|
d:DesignHeight="450" d:DesignWidth="800">
|
2025-09-14 21:18:01 +08:00
|
|
|
<UserControl.Resources>
|
|
|
|
|
<!-- Converters -->
|
|
|
|
|
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
|
|
|
|
<converters:BoolToStringConverter x:Key="BoolToStringConverter" />
|
|
|
|
|
<converters:BoolToColorConverter x:Key="BoolToColorConverter"/>
|
2025-10-19 14:55:09 +08:00
|
|
|
|
2025-09-14 21:18:01 +08:00
|
|
|
<!-- 触发器项模板 -->
|
|
|
|
|
<DataTemplate x:Key="TriggerItemTemplate">
|
2025-10-19 14:55:09 +08:00
|
|
|
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
|
|
|
|
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
BorderThickness="1"
|
|
|
|
|
CornerRadius="8"
|
|
|
|
|
Margin="5"
|
2025-10-19 14:55:09 +08:00
|
|
|
Padding="15"
|
|
|
|
|
Effect="{DynamicResource SharedDropShadow}">
|
2025-09-14 21:18:01 +08:00
|
|
|
<Grid>
|
|
|
|
|
<Grid.RowDefinitions>
|
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
|
<RowDefinition Height="Auto"/>
|
|
|
|
|
</Grid.RowDefinitions>
|
2025-09-14 16:16:10 +08:00
|
|
|
|
2025-09-14 21:18:01 +08:00
|
|
|
<!-- 触发器基本信息 -->
|
|
|
|
|
<StackPanel Grid.Row="0" Margin="0,0,0,10">
|
|
|
|
|
<Grid>
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
|
<ColumnDefinition Width="Auto"/>
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
2025-10-19 14:55:09 +08:00
|
|
|
<!-- 触发器名称和描述 -->
|
2025-09-14 21:18:01 +08:00
|
|
|
<StackPanel Grid.Column="0">
|
|
|
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
|
2025-10-19 14:55:09 +08:00
|
|
|
<ui:FontIcon Glyph=""
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="20"
|
|
|
|
|
Foreground="{DynamicResource SystemAccentColorBrush}"
|
|
|
|
|
Margin="0,0,8,0"/>
|
2025-10-19 14:55:09 +08:00
|
|
|
<!-- 显示触发器名称 -->
|
|
|
|
|
<TextBlock Text="{Binding Name}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontWeight="SemiBold"
|
|
|
|
|
FontSize="16"
|
2025-10-19 14:55:09 +08:00
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
|
|
|
|
|
<!-- 分隔符 -->
|
|
|
|
|
<TextBlock Text=" | "
|
|
|
|
|
Margin="8,0,8,0"
|
|
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"/>
|
|
|
|
|
<!-- 显示触发器描述 -->
|
|
|
|
|
<TextBlock Text="{Binding Description}"
|
|
|
|
|
FontWeight="Normal"
|
|
|
|
|
FontSize="14"
|
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"/>
|
2025-09-14 21:18:01 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
|
2025-10-19 14:55:09 +08:00
|
|
|
<!-- 变量ID显示 -->
|
2025-09-14 21:18:01 +08:00
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
|
<ui:FontIcon Glyph=""
|
|
|
|
|
FontSize="14"
|
2025-10-19 14:55:09 +08:00
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
Margin="0,0,5,0"/>
|
2025-10-19 14:55:09 +08:00
|
|
|
<TextBlock Text="{Binding VariableIds.Count, StringFormat='关联变量数量: {0}'}"
|
|
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
|
|
<!-- 状态指示器 -->
|
|
|
|
|
<StackPanel Grid.Column="1"
|
|
|
|
|
Orientation="Horizontal"
|
|
|
|
|
VerticalAlignment="Top">
|
|
|
|
|
<Border Background="{Binding IsActive,
|
|
|
|
|
Converter={StaticResource BoolToColorConverter},
|
|
|
|
|
ConverterParameter='Green;Red'}"
|
2025-10-19 14:55:09 +08:00
|
|
|
CornerRadius="20"
|
|
|
|
|
Width="12"
|
|
|
|
|
Height="12"
|
|
|
|
|
Margin="0,0,5,0">
|
2025-09-14 21:18:01 +08:00
|
|
|
<Border.ToolTip>
|
|
|
|
|
<TextBlock Text="{Binding IsActive,
|
|
|
|
|
Converter={StaticResource BoolToStringConverter},
|
|
|
|
|
ConverterParameter='已激活;未激活'}"/>
|
|
|
|
|
</Border.ToolTip>
|
|
|
|
|
</Border>
|
2025-10-19 14:55:09 +08:00
|
|
|
<TextBlock Text="{Binding IsActive,
|
|
|
|
|
Converter={StaticResource BoolToStringConverter},
|
|
|
|
|
ConverterParameter='已激活;未激活'}"
|
|
|
|
|
Foreground="{Binding IsActive,
|
|
|
|
|
Converter={StaticResource BoolToColorConverter},
|
|
|
|
|
ConverterParameter='Green;Red'}"
|
|
|
|
|
FontSize="12"
|
|
|
|
|
VerticalAlignment="Center"/>
|
2025-09-14 21:18:01 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
</Grid>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
|
|
<!-- 触发器详细信息 -->
|
|
|
|
|
<Grid Grid.Row="1">
|
|
|
|
|
<Grid.ColumnDefinitions>
|
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
|
<ColumnDefinition Width="*"/>
|
|
|
|
|
</Grid.ColumnDefinitions>
|
|
|
|
|
|
|
|
|
|
<!-- 左侧信息 -->
|
2025-10-19 14:55:09 +08:00
|
|
|
<StackPanel Grid.Column="0" Margin="0,0,10,0">
|
2025-09-14 21:18:01 +08:00
|
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,3">
|
2025-10-19 14:55:09 +08:00
|
|
|
<TextBlock Text="动作类型: "
|
2025-09-14 21:18:01 +08:00
|
|
|
FontWeight="SemiBold"
|
2025-10-19 14:55:09 +08:00
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
2025-10-19 14:55:09 +08:00
|
|
|
<TextBlock Text="{Binding Action}"
|
|
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
|
|
<StackPanel Orientation="Horizontal">
|
2025-10-19 14:55:09 +08:00
|
|
|
<TextBlock Text="创建时间: "
|
2025-09-14 21:18:01 +08:00
|
|
|
FontWeight="SemiBold"
|
2025-10-19 14:55:09 +08:00
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
2025-10-19 14:55:09 +08:00
|
|
|
<TextBlock Text="{Binding CreatedAt, StringFormat='{}{0:yyyy-MM-dd HH:mm}'}"
|
|
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
|
|
<!-- 右侧信息 -->
|
2025-10-19 14:55:09 +08:00
|
|
|
<StackPanel Grid.Column="1" Margin="10,0,0,0">
|
2025-09-14 21:18:01 +08:00
|
|
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,3">
|
2025-10-19 14:55:09 +08:00
|
|
|
<TextBlock Text="最后更新: "
|
2025-09-14 21:18:01 +08:00
|
|
|
FontWeight="SemiBold"
|
2025-10-19 14:55:09 +08:00
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
2025-10-19 14:55:09 +08:00
|
|
|
<TextBlock Text="{Binding UpdatedAt, StringFormat='{}{0:yyyy-MM-dd HH:mm}'}"
|
|
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
|
|
|
<TextBlock Text="最后触发: "
|
|
|
|
|
FontWeight="SemiBold"
|
2025-10-19 14:55:09 +08:00
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
|
|
|
|
<TextBlock Text="{Binding LastTriggeredAt, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"
|
2025-10-19 14:55:09 +08:00
|
|
|
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
|
2025-09-14 21:18:01 +08:00
|
|
|
FontSize="12"/>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Grid>
|
|
|
|
|
</Border>
|
|
|
|
|
</DataTemplate>
|
2025-10-19 14:55:09 +08:00
|
|
|
|
|
|
|
|
<!-- 定义阴影效果 -->
|
|
|
|
|
<DropShadowEffect x:Key="SharedDropShadow"
|
|
|
|
|
ShadowDepth="2"
|
|
|
|
|
BlurRadius="8"
|
|
|
|
|
Opacity="0.15"
|
|
|
|
|
Color="#888888"/>
|
2025-09-14 21:18:01 +08:00
|
|
|
</UserControl.Resources>
|
|
|
|
|
|
2025-10-19 14:55:09 +08:00
|
|
|
<Border Background="{DynamicResource SystemControlPageBackgroundAltHighBrush}"
|
|
|
|
|
CornerRadius="8"
|
|
|
|
|
Margin="10">
|
|
|
|
|
<StackPanel>
|
|
|
|
|
<!-- Toolbar -->
|
|
|
|
|
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
|
|
|
|
CornerRadius="8"
|
|
|
|
|
Margin="15,15,15,10">
|
|
|
|
|
<ui:CommandBar DefaultLabelPosition="Right" IsOpen="False" Margin="10">
|
|
|
|
|
<ui:AppBarButton Command="{Binding AddTriggerCommand}" Label="添加触发器">
|
|
|
|
|
<ui:AppBarButton.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Add}" />
|
|
|
|
|
</ui:AppBarButton.Icon>
|
|
|
|
|
</ui:AppBarButton>
|
|
|
|
|
<ui:AppBarButton Command="{Binding EditTriggerCommand}" Label="编辑触发器">
|
|
|
|
|
<ui:AppBarButton.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}" />
|
|
|
|
|
</ui:AppBarButton.Icon>
|
|
|
|
|
</ui:AppBarButton>
|
|
|
|
|
<ui:AppBarButton Command="{Binding DeleteTriggerCommand}" Label="删除触发器">
|
|
|
|
|
<ui:AppBarButton.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Delete}" />
|
|
|
|
|
</ui:AppBarButton.Icon>
|
|
|
|
|
</ui:AppBarButton>
|
|
|
|
|
<ui:AppBarButton Command="{Binding RefreshCommand}" Label="刷新">
|
|
|
|
|
<ui:AppBarButton.Icon>
|
|
|
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Refresh}" />
|
|
|
|
|
</ui:AppBarButton.Icon>
|
|
|
|
|
</ui:AppBarButton>
|
|
|
|
|
</ui:CommandBar>
|
|
|
|
|
</Border>
|
2025-09-14 16:16:10 +08:00
|
|
|
|
2025-10-19 14:55:09 +08:00
|
|
|
<!-- Triggers List -->
|
|
|
|
|
<ui:GridView
|
|
|
|
|
x:Name="TriggersGridView"
|
|
|
|
|
Margin="15"
|
|
|
|
|
IsItemClickEnabled="True"
|
|
|
|
|
ItemTemplate="{StaticResource TriggerItemTemplate}"
|
|
|
|
|
ItemsSource="{Binding TriggerItemListView}"
|
|
|
|
|
SelectedItem="{Binding SelectedTrigger}"
|
|
|
|
|
SelectionMode="Single">
|
|
|
|
|
<hc:Interaction.Triggers>
|
|
|
|
|
<hc:EventTrigger EventName="MouseDoubleClick">
|
|
|
|
|
<hc:InvokeCommandAction Command="{Binding NavigateToTriggerDetailCommand}" />
|
|
|
|
|
</hc:EventTrigger>
|
|
|
|
|
</hc:Interaction.Triggers>
|
|
|
|
|
</ui:GridView>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</Border>
|
2025-09-14 19:13:40 +08:00
|
|
|
</UserControl>
|