Files
DMS/DMS.WPF/Views/TriggersView.xaml

63 lines
3.5 KiB
Plaintext
Raw Normal View History

2025-09-14 19:13:40 +08:00
<UserControl x:Class="DMS.WPF.Views.TriggersView"
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"
mc:Ignorable="d"
2025-09-14 19:13:40 +08:00
d:DesignHeight="450" d:DesignWidth="800">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Toolbar -->
2025-09-14 19:13:40 +08:00
<ui:CommandBar Grid.Row="0" 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>
<!-- Triggers List -->
<DataGrid Grid.Row="1"
ItemsSource="{Binding Triggers}"
SelectedItem="{Binding SelectedTrigger}"
AutoGenerateColumns="False"
IsReadOnly="True"
SelectionMode="Single">
<DataGrid.Columns>
<DataGridTextColumn Header="描述" Binding="{Binding Description}" Width="*" />
<DataGridTextColumn Header="变量ID" Binding="{Binding VariableId}" Width="150" />
<DataGridTextColumn Header="条件" Binding="{Binding Condition}" Width="100" />
<DataGridTextColumn Header="阈值/范围" Binding="{Binding Threshold, StringFormat='{}{0:N2}'}" Width="100" />
<DataGridTextColumn Header="下限" Binding="{Binding LowerBound, StringFormat='{}{0:N2}'}" Width="100" />
<DataGridTextColumn Header="上限" Binding="{Binding UpperBound, StringFormat='{}{0:N2}'}" Width="100" />
<DataGridTextColumn Header="动作" Binding="{Binding Action}" Width="100" />
<DataGridTextColumn Header="激活" Binding="{Binding IsActive}" Width="60" />
<DataGridTextColumn Header="最后触发" Binding="{Binding LastTriggeredAt, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}" Width="150" />
<DataGridTextColumn Header="创建时间" Binding="{Binding CreatedAt, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}" Width="150" />
<DataGridTextColumn Header="更新时间" Binding="{Binding UpdatedAt, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}" Width="150" />
</DataGrid.Columns>
</DataGrid>
</Grid>
2025-09-14 19:13:40 +08:00
</UserControl>