2025-09-14 19:13:40 +08:00
|
|
|
<ui:ContentDialog x:Class="DMS.WPF.Views.Dialogs.TriggerDialog"
|
2025-09-22 22:58:51 +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"
|
|
|
|
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
|
|
|
|
xmlns:enums="clr-namespace:DMS.Core.Models.Triggers;assembly=DMS.Core"
|
|
|
|
|
xmlns:vmd="clr-namespace:DMS.WPF.ViewModels.Dialogs"
|
|
|
|
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
|
|
|
|
xmlns:ex="clr-namespace:DMS.Extensions"
|
|
|
|
|
xmlns:converters="clr-namespace:DMS.WPF.Converters"
|
2025-10-06 18:17:56 +08:00
|
|
|
xmlns:items="clr-namespace:DMS.WPF.ItemViewModel"
|
2025-09-22 22:58:51 +08:00
|
|
|
Title="{Binding Title}"
|
|
|
|
|
mc:Ignorable="d"
|
2025-09-22 23:33:34 +08:00
|
|
|
d:DesignHeight="700"
|
2025-09-22 22:58:51 +08:00
|
|
|
d:DesignWidth="600"
|
|
|
|
|
d:DataContext="{d:DesignInstance vmd:TriggerDialogViewModel}"
|
|
|
|
|
MinWidth="500"
|
2025-09-22 23:33:34 +08:00
|
|
|
MinHeight="600"
|
2025-09-22 22:58:51 +08:00
|
|
|
PrimaryButtonText="{Binding PrimaryButText}"
|
|
|
|
|
CloseButtonText="取消"
|
|
|
|
|
PrimaryButtonCommand="{Binding SaveCommand}"
|
|
|
|
|
CloseButtonCommand="{Binding CancelCommand}"
|
|
|
|
|
DefaultButton="Primary">
|
|
|
|
|
|
2025-09-14 19:13:40 +08:00
|
|
|
<ui:ContentDialog.Resources>
|
2025-09-22 22:58:51 +08:00
|
|
|
<converters:EnumToVisibilityConverter x:Key="LocalEnumToVisibilityConverter" />
|
2025-09-22 23:33:34 +08:00
|
|
|
<converters:IntToVisibilityConverter x:Key="IntToVisibilityConverter" />
|
2025-09-23 09:28:08 +08:00
|
|
|
<converters:EmptyCollectionToVisibilityConverter x:Key="EmptyCollectionToVisibilityConverter" />
|
2025-09-22 22:58:51 +08:00
|
|
|
<ex:EnumBindingSource x:Key="ActionTypeEnum"
|
|
|
|
|
EnumType="{x:Type enums:ActionType}" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</ui:ContentDialog.Resources>
|
|
|
|
|
|
|
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
|
|
|
<StackPanel Margin="10">
|
|
|
|
|
<!-- Basic Info Section -->
|
2025-09-22 22:58:51 +08:00
|
|
|
<GroupBox Header="基本信息"
|
|
|
|
|
Padding="5">
|
2025-09-14 19:13:40 +08:00
|
|
|
<StackPanel>
|
2025-10-18 18:55:08 +08:00
|
|
|
<DockPanel Margin="0,0,0,5">
|
|
|
|
|
<Label Content="名称:"
|
|
|
|
|
Width="100"
|
|
|
|
|
VerticalAlignment="Center" />
|
|
|
|
|
<TextBox Text="{Binding Trigger.Name, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
|
Width="300"
|
|
|
|
|
HorizontalAlignment="Left" />
|
|
|
|
|
</DockPanel>
|
|
|
|
|
|
2025-09-14 19:13:40 +08:00
|
|
|
<DockPanel Margin="0,0,0,5">
|
2025-09-22 22:58:51 +08:00
|
|
|
<Label Content="描述:"
|
|
|
|
|
Width="100"
|
|
|
|
|
VerticalAlignment="Center" />
|
|
|
|
|
<TextBox Text="{Binding Trigger.Description, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
|
Width="300"
|
|
|
|
|
HorizontalAlignment="Left" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</DockPanel>
|
2025-09-22 22:58:51 +08:00
|
|
|
|
|
|
|
|
<CheckBox Content="激活"
|
|
|
|
|
IsChecked="{Binding Trigger.IsActive}"
|
2025-09-22 23:33:34 +08:00
|
|
|
Margin="0,0,0,10" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
</GroupBox>
|
|
|
|
|
|
2025-09-22 22:58:51 +08:00
|
|
|
|
2025-09-14 19:13:40 +08:00
|
|
|
|
|
|
|
|
<!-- Action Section -->
|
2025-09-22 22:58:51 +08:00
|
|
|
<GroupBox Header="触发动作"
|
|
|
|
|
Padding="5"
|
|
|
|
|
Margin="0,10,0,0">
|
2025-09-14 19:13:40 +08:00
|
|
|
<StackPanel>
|
|
|
|
|
<DockPanel Margin="0,0,0,5">
|
2025-09-22 22:58:51 +08:00
|
|
|
<Label Content="动作类型:"
|
|
|
|
|
Width="100"
|
|
|
|
|
VerticalAlignment="Center" />
|
2025-09-14 19:13:40 +08:00
|
|
|
<ComboBox ItemsSource="{Binding Source={StaticResource ActionTypeEnum}}"
|
|
|
|
|
SelectedItem="{Binding Trigger.Action}"
|
2025-09-22 22:58:51 +08:00
|
|
|
Width="200"
|
|
|
|
|
HorizontalAlignment="Left" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</DockPanel>
|
|
|
|
|
|
|
|
|
|
<!-- Conditional Fields based on Action Type -->
|
2025-09-22 22:58:51 +08:00
|
|
|
<StackPanel
|
|
|
|
|
Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=SendEmail}">
|
2025-09-14 19:13:40 +08:00
|
|
|
<DockPanel Margin="0,0,0,5">
|
2025-09-22 22:58:51 +08:00
|
|
|
<Label Content="收件人 (分号分隔):"
|
|
|
|
|
Width="150"
|
|
|
|
|
VerticalAlignment="Top" />
|
|
|
|
|
<TextBox
|
|
|
|
|
Text="{Binding EmailRecipients, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
|
|
|
|
AcceptsReturn="True"
|
|
|
|
|
TextWrapping="Wrap"
|
|
|
|
|
Width="350"
|
|
|
|
|
Height="60"
|
|
|
|
|
HorizontalAlignment="Left" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</DockPanel>
|
|
|
|
|
<DockPanel Margin="0,0,0,5">
|
2025-09-22 22:58:51 +08:00
|
|
|
<Label Content="邮件主题模板:"
|
|
|
|
|
Width="150"
|
|
|
|
|
VerticalAlignment="Center" />
|
|
|
|
|
<TextBox
|
|
|
|
|
Text="{Binding EmailSubjectTemplate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
|
|
|
|
Width="350"
|
|
|
|
|
HorizontalAlignment="Left" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</DockPanel>
|
|
|
|
|
<DockPanel Margin="0,0,0,5">
|
2025-09-22 22:58:51 +08:00
|
|
|
<Label Content="邮件内容模板:"
|
|
|
|
|
Width="150"
|
|
|
|
|
VerticalAlignment="Top" />
|
|
|
|
|
<TextBox
|
|
|
|
|
Text="{Binding EmailBodyTemplate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
|
|
|
|
AcceptsReturn="True"
|
|
|
|
|
TextWrapping="Wrap"
|
|
|
|
|
Width="350"
|
|
|
|
|
Height="100"
|
|
|
|
|
HorizontalAlignment="Left" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</DockPanel>
|
|
|
|
|
</StackPanel>
|
2025-09-22 22:58:51 +08:00
|
|
|
|
2025-09-14 19:13:40 +08:00
|
|
|
<!-- Add placeholders for other action types if needed -->
|
2025-09-22 22:58:51 +08:00
|
|
|
<StackPanel
|
|
|
|
|
Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=ActivateAlarm}">
|
|
|
|
|
<TextBlock Text="配置激活报警动作..."
|
|
|
|
|
Margin="5" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</StackPanel>
|
2025-09-22 22:58:51 +08:00
|
|
|
|
|
|
|
|
<StackPanel
|
|
|
|
|
Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=WriteToLog}">
|
|
|
|
|
<TextBlock Text="配置写入日志动作..."
|
|
|
|
|
Margin="5" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</StackPanel>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</GroupBox>
|
|
|
|
|
|
|
|
|
|
<!-- Suppression Section -->
|
2025-09-22 22:58:51 +08:00
|
|
|
<GroupBox Header="抑制设置"
|
|
|
|
|
Padding="5"
|
|
|
|
|
Margin="0,10,0,0">
|
2025-09-14 19:13:40 +08:00
|
|
|
<StackPanel>
|
|
|
|
|
<DockPanel Margin="0,0,0,5">
|
2025-09-22 22:58:51 +08:00
|
|
|
<Label Content="抑制持续时间 (秒):"
|
|
|
|
|
Width="150"
|
|
|
|
|
VerticalAlignment="Center" />
|
|
|
|
|
<TextBox
|
|
|
|
|
Text="{Binding Trigger.SuppressionDuration, Converter={StaticResource NullableTimeSpanToSecondsConverter}, UpdateSourceTrigger=PropertyChanged}"
|
|
|
|
|
Width="100"
|
|
|
|
|
HorizontalAlignment="Left" />
|
2025-09-14 19:13:40 +08:00
|
|
|
</DockPanel>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</GroupBox>
|
|
|
|
|
</StackPanel>
|
|
|
|
|
</ScrollViewer>
|
|
|
|
|
</ui:ContentDialog>
|