feat: 实现触发器详情页面和优化触发器列表视图
This commit is contained in:
@@ -130,6 +130,10 @@
|
||||
<!--Mqtt服务器详情页-->
|
||||
<DataTemplate DataType="{x:Type vm:MqttServerDetailViewModel}">
|
||||
<local:MqttServerDetailView DataContext="{Binding }"/>
|
||||
</DataTemplate>
|
||||
<!--触发器详情页-->
|
||||
<DataTemplate DataType="{x:Type vm:TriggerDetailViewModel}">
|
||||
<local:TriggerDetailView DataContext="{Binding }"/>
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
|
||||
403
DMS.WPF/Views/TriggerDetailView.xaml
Normal file
403
DMS.WPF/Views/TriggerDetailView.xaml
Normal file
@@ -0,0 +1,403 @@
|
||||
<UserControl
|
||||
x:Class="DMS.WPF.Views.TriggerDetailView"
|
||||
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:helper="clr-namespace:DMS.WPF.Helper"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:converters="clr-namespace:DMS.WPF.Converters"
|
||||
xmlns:valueConverts="clr-namespace:DMS.WPF.ValueConverts"
|
||||
xmlns:triggers="clr-namespace:DMS.Core.Models.Triggers;assembly=DMS.Core"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<valueConverts:EnumDescriptionConverter x:Key="EnumDescriptionConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<converters:BoolToStringConverter x:Key="BoolToStringConverter" />
|
||||
<converters:BoolToColorConverter x:Key="BoolToColorConverter"/>
|
||||
<converters:NullableTimeSpanToSecondsConverter x:Key="NullableTimeSpanToSecondsConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<DockPanel>
|
||||
<!-- 顶部导航栏 -->
|
||||
<Border
|
||||
Margin="20,10"
|
||||
Padding="15"
|
||||
DockPanel.Dock="Top">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 返回触发器列表按钮 -->
|
||||
<Button
|
||||
Grid.Column="0"
|
||||
Margin="0,0,10,0"
|
||||
Command="{Binding NavigateToTriggersCommand}"
|
||||
Style="{StaticResource ButtonDefault}"
|
||||
ToolTip="返回触发器列表">
|
||||
<Button.Content>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.ArrowLeft8}" />
|
||||
</StackPanel>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
|
||||
<!-- 操作菜单栏 -->
|
||||
<ui:CommandBar
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Right"
|
||||
DefaultLabelPosition="Right"
|
||||
IsOpen="False">
|
||||
|
||||
<ui:AppBarButton
|
||||
x:Name="EditButton"
|
||||
Command="{Binding EditTriggerCommand}"
|
||||
Label="编辑">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
|
||||
<ui:AppBarButton x:Name="ShareButton" Label="分享">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Share}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
|
||||
<ui:CommandBar.SecondaryCommands>
|
||||
<ui:AppBarButton
|
||||
x:Name="SettingsButton"
|
||||
Icon="Setting"
|
||||
Label="设置" />
|
||||
</ui:CommandBar.SecondaryCommands>
|
||||
</ui:CommandBar>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 主内容区域 -->
|
||||
<ScrollViewer DockPanel.Dock="Top" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="20">
|
||||
<!-- Trigger Details -->
|
||||
<Border
|
||||
Margin="0,0,0,10"
|
||||
Padding="15"
|
||||
Background="White"
|
||||
BorderBrush="#E0E0E0"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="5"
|
||||
Opacity="0.1"
|
||||
ShadowDepth="2"
|
||||
Color="#888888" />
|
||||
</Border.Effect>
|
||||
|
||||
<StackPanel>
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{StaticResource MdFontIcons}"
|
||||
FontSize="24"
|
||||
Foreground="#2196F3"
|
||||
Glyph="" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="触发器详情" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid Margin="0,8,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Tag}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="名称:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,10,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#333333"
|
||||
Text="{Binding CurrentTrigger.Name}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Tag}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="描述:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="3"
|
||||
Margin="0,0,0,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#333333"
|
||||
Text="{Binding CurrentTrigger.Description}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.StatusCircleCheckmark}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="状态:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,10,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{Binding CurrentTrigger.IsActive,
|
||||
Converter={StaticResource BoolToColorConverter},
|
||||
ConverterParameter='Green;Red'}"
|
||||
Text="{Binding CurrentTrigger.IsActive,
|
||||
Converter={StaticResource BoolToStringConverter},
|
||||
ConverterParameter='已激活;未激活'}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Mail}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="动作类型:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="3"
|
||||
Margin="0,0,0,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#333333"
|
||||
Text="{Binding CurrentTrigger.Action}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{StaticResource MdFontIcons}"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Glyph="󰪆" />
|
||||
<TextBlock VerticalAlignment="Center" Text="抑制持续时间:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,10,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#333333"
|
||||
Text="{Binding CurrentTrigger.SuppressionDuration,
|
||||
Converter={StaticResource NullableTimeSpanToSecondsConverter}}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Calendar}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="创建时间:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="3"
|
||||
Margin="0,0,0,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#333333"
|
||||
Text="{Binding CurrentTrigger.CreatedAt, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.Calendar}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="最后更新:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,10,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#333333"
|
||||
Text="{Binding CurrentTrigger.UpdatedAt, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Icon="{x:Static ui:SegoeFluentIcons.DateTime}" />
|
||||
<TextBlock VerticalAlignment="Center" Text="最后触发:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Grid.Column="3"
|
||||
Margin="0,0,0,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#333333"
|
||||
Text="{Binding CurrentTrigger.LastTriggeredAt, StringFormat='yyyy-MM-dd HH:mm:ss'}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,5,12"
|
||||
Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="0,0,5,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{StaticResource MdFontIcons}"
|
||||
FontSize="16"
|
||||
Foreground="#666666"
|
||||
Glyph="󰚧" />
|
||||
<TextBlock VerticalAlignment="Center" Text="关联变量数:" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Margin="0,0,10,12"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#333333"
|
||||
Text="{Binding CurrentTrigger.VariableIds.Count}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Associated Variables -->
|
||||
<Border
|
||||
Margin="0,0,0,10"
|
||||
Padding="15"
|
||||
Background="White"
|
||||
BorderBrush="#E0E0E0"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="5"
|
||||
Opacity="0.1"
|
||||
ShadowDepth="2"
|
||||
Color="#888888" />
|
||||
</Border.Effect>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="0,0,0,10"
|
||||
Style="{StaticResource SubtitleTextBlockStyle}"
|
||||
Text="关联变量" />
|
||||
<DataGrid
|
||||
x:Name="AssociatedVariablesDataGrid"
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserDeleteRows="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding AssociatedVariables}"
|
||||
SelectionMode="Extended">
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<helper:SelectedItemsBehavior SelectedItems="{Binding SelectedVariables}" />
|
||||
</i:Interaction.Behaviors>
|
||||
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" Header="变量名称" />
|
||||
<DataGridTextColumn Binding="{Binding Description}" Header="变量描述" />
|
||||
<DataGridTextColumn Binding="{Binding DeviceName}" Header="设备名称" />
|
||||
<DataGridTextColumn Binding="{Binding VariableTableName}" Header="变量表名称" />
|
||||
<DataGridTextColumn Binding="{Binding S7Address}" Header="变量地址" />
|
||||
<DataGridTextColumn Binding="{Binding DataType}" Header="数据类型" />
|
||||
<DataGridTextColumn Binding="{Binding DisplayValue}" Header="显示值" />
|
||||
<DataGridTextColumn Binding="{Binding LastModified, StringFormat='yyyy-MM-dd HH:mm:ss'}" Header="最后更新" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
15
DMS.WPF/Views/TriggerDetailView.xaml.cs
Normal file
15
DMS.WPF/Views/TriggerDetailView.xaml.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace DMS.WPF.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// TriggerDetailView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TriggerDetailView : UserControl
|
||||
{
|
||||
public TriggerDetailView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,28 +7,23 @@
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:converters="clr-namespace:DMS.WPF.Converters"
|
||||
mc:Ignorable="d"
|
||||
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<!-- Converters -->
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
|
||||
<converters:BoolToStringConverter x:Key="BoolToStringConverter" />
|
||||
<converters:BoolToColorConverter x:Key="BoolToColorConverter"/>
|
||||
|
||||
|
||||
<!-- 触发器项模板 -->
|
||||
<DataTemplate x:Key="TriggerItemTemplate">
|
||||
<Border Background="White"
|
||||
BorderBrush="#E0E0E0"
|
||||
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Margin="5"
|
||||
Padding="15">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect ShadowDepth="2"
|
||||
BlurRadius="5"
|
||||
Opacity="0.1"
|
||||
Color="#888888"/>
|
||||
</Border.Effect>
|
||||
|
||||
Padding="15"
|
||||
Effect="{DynamicResource SharedDropShadow}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -43,40 +38,39 @@
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 触发器描述和变量信息 -->
|
||||
<!-- 触发器名称和描述 -->
|
||||
<StackPanel Grid.Column="0">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,5">
|
||||
<ui:FontIcon Glyph=""
|
||||
<ui:FontIcon Glyph=""
|
||||
FontSize="20"
|
||||
Foreground="{DynamicResource SystemAccentColorBrush}"
|
||||
Margin="0,0,8,0"/>
|
||||
<TextBlock Text="{Binding Description}"
|
||||
<!-- 显示触发器名称 -->
|
||||
<TextBlock Text="{Binding Name}"
|
||||
FontWeight="SemiBold"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Center"/>
|
||||
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}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 变量ID显示 -->
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:FontIcon Glyph=""
|
||||
FontSize="14"
|
||||
Foreground="#888888"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
||||
Margin="0,0,5,0"/>
|
||||
<TextBlock Text="{Binding VariableId}"
|
||||
Foreground="#888888"
|
||||
FontSize="12"
|
||||
Margin="0,0,15,0"/>
|
||||
|
||||
<Rectangle Width="1"
|
||||
Height="12"
|
||||
Fill="#CCCCCC"
|
||||
Margin="5,0"/>
|
||||
|
||||
<ui:FontIcon Glyph=""
|
||||
FontSize="14"
|
||||
Foreground="#888888"
|
||||
Margin="10,0,5,0"/>
|
||||
<TextBlock Text="{Binding Condition}"
|
||||
Foreground="#888888"
|
||||
<TextBlock Text="{Binding VariableIds.Count, StringFormat='关联变量数量: {0}'}"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
||||
FontSize="12"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
@@ -88,16 +82,24 @@
|
||||
<Border Background="{Binding IsActive,
|
||||
Converter={StaticResource BoolToColorConverter},
|
||||
ConverterParameter='Green;Red'}"
|
||||
CornerRadius="8"
|
||||
Width="16"
|
||||
Height="16"
|
||||
Margin="0,0,10,0">
|
||||
CornerRadius="20"
|
||||
Width="12"
|
||||
Height="12"
|
||||
Margin="0,0,5,0">
|
||||
<Border.ToolTip>
|
||||
<TextBlock Text="{Binding IsActive,
|
||||
Converter={StaticResource BoolToStringConverter},
|
||||
ConverterParameter='已激活;未激活'}"/>
|
||||
</Border.ToolTip>
|
||||
</Border>
|
||||
<TextBlock Text="{Binding IsActive,
|
||||
Converter={StaticResource BoolToStringConverter},
|
||||
ConverterParameter='已激活;未激活'}"
|
||||
Foreground="{Binding IsActive,
|
||||
Converter={StaticResource BoolToColorConverter},
|
||||
ConverterParameter='Green;Red'}"
|
||||
FontSize="12"
|
||||
VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
@@ -110,56 +112,47 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧信息 -->
|
||||
<StackPanel Grid.Column="0">
|
||||
<StackPanel Grid.Column="0" Margin="0,0,10,0">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,3">
|
||||
<TextBlock Text="阈值/范围: "
|
||||
<TextBlock Text="动作类型: "
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#666666"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
||||
FontSize="12"/>
|
||||
<TextBlock Text="{Binding Threshold, StringFormat='{}{0:N2}'}"
|
||||
Foreground="#333333"
|
||||
<TextBlock Text="{Binding Action}"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
|
||||
FontSize="12"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="下限: "
|
||||
<TextBlock Text="创建时间: "
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#666666"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
||||
FontSize="12"/>
|
||||
<TextBlock Text="{Binding LowerBound, StringFormat='{}{0:N2}'}"
|
||||
Foreground="#333333"
|
||||
FontSize="12"
|
||||
Margin="0,0,15,0"/>
|
||||
|
||||
<TextBlock Text="上限: "
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#666666"
|
||||
FontSize="12"/>
|
||||
<TextBlock Text="{Binding UpperBound, StringFormat='{}{0:N2}'}"
|
||||
Foreground="#333333"
|
||||
<TextBlock Text="{Binding CreatedAt, StringFormat='{}{0:yyyy-MM-dd HH:mm}'}"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
|
||||
FontSize="12"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 右侧信息 -->
|
||||
<StackPanel Grid.Column="1">
|
||||
<StackPanel Grid.Column="1" Margin="10,0,0,0">
|
||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,3">
|
||||
<TextBlock Text="动作: "
|
||||
<TextBlock Text="最后更新: "
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#666666"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
||||
FontSize="12"/>
|
||||
<TextBlock Text="{Binding Action}"
|
||||
Foreground="#333333"
|
||||
<TextBlock Text="{Binding UpdatedAt, StringFormat='{}{0:yyyy-MM-dd HH:mm}'}"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
|
||||
FontSize="12"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="最后触发: "
|
||||
FontWeight="SemiBold"
|
||||
Foreground="#666666"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseMediumBrush}"
|
||||
FontSize="12"/>
|
||||
<TextBlock Text="{Binding LastTriggeredAt, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"
|
||||
Foreground="#333333"
|
||||
Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}"
|
||||
FontSize="12"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
@@ -167,47 +160,62 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- 定义阴影效果 -->
|
||||
<DropShadowEffect x:Key="SharedDropShadow"
|
||||
ShadowDepth="2"
|
||||
BlurRadius="8"
|
||||
Opacity="0.15"
|
||||
Color="#888888"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<StackPanel>
|
||||
<!-- Toolbar -->
|
||||
<ui:CommandBar DefaultLabelPosition="Right" IsOpen="False" Margin="0,0,0,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 LoadTriggersCommand}" Label="刷新">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Refresh}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
</ui:CommandBar>
|
||||
<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>
|
||||
|
||||
<!-- Triggers List -->
|
||||
<ui:GridView
|
||||
x:Name="TriggersGridView"
|
||||
Margin="20"
|
||||
IsItemClickEnabled="True"
|
||||
ItemTemplate="{StaticResource TriggerItemTemplate}"
|
||||
ItemsSource="{Binding Triggers}"
|
||||
SelectedItem="{Binding SelectedTrigger}"
|
||||
SelectionMode="Single">
|
||||
<hc:Interaction.Triggers>
|
||||
<hc:EventTrigger EventName="MouseDoubleClick">
|
||||
<hc:InvokeCommandAction Command="{Binding EditTriggerCommand}" />
|
||||
</hc:EventTrigger>
|
||||
</hc:Interaction.Triggers>
|
||||
</ui:GridView>
|
||||
</StackPanel>
|
||||
<!-- 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>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user