继续修改触发器
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:triggers="clr-namespace:DMS.Core.Models.Triggers;assembly=DMS.Core"
|
||||
xmlns:converters="clr-namespace:DMS.WPF.Converters"
|
||||
xmlns:localConverters="clr-namespace:DMS.WPF.Converters" <!-- 引入本地转换器命名空间 -->
|
||||
xmlns:localConverters="clr-namespace:DMS.WPF.Converters"
|
||||
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern">
|
||||
<Application.Resources>
|
||||
|
||||
@@ -4,8 +4,11 @@ using AutoMapper.Internal;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Application.Services;
|
||||
using DMS.Application.Services.Processors;
|
||||
using DMS.Application.Services.Triggers;
|
||||
using DMS.Application.Services.Triggers.Impl;
|
||||
using DMS.Core.Interfaces;
|
||||
using DMS.Core.Interfaces.Repositories;
|
||||
using DMS.Core.Interfaces.Repositories.Triggers;
|
||||
using DMS.Core.Interfaces.Services;
|
||||
using DMS.Infrastructure.Configuration;
|
||||
using DMS.Infrastructure.Configurations;
|
||||
@@ -14,6 +17,7 @@ using DMS.Infrastructure.Interfaces;
|
||||
using DMS.Infrastructure.Interfaces.Services;
|
||||
using DMS.Infrastructure.Repositories;
|
||||
using DMS.Infrastructure.Services;
|
||||
using DMS.WPF.Converters;
|
||||
using DMS.WPF.Helper;
|
||||
using DMS.WPF.Interfaces;
|
||||
using DMS.WPF.Logging;
|
||||
@@ -21,12 +25,14 @@ using DMS.WPF.Services;
|
||||
using DMS.WPF.ViewModels;
|
||||
using DMS.WPF.ViewModels.Dialogs;
|
||||
using DMS.WPF.ViewModels.Items;
|
||||
using DMS.WPF.ViewModels.Triggers;
|
||||
using DMS.WPF.Views;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NLog;
|
||||
using NLog.Web;
|
||||
using SqlSugar;
|
||||
using ILogger = Microsoft.Extensions.Logging.ILogger;
|
||||
using LogLevel = Microsoft.Extensions.Logging.LogLevel;
|
||||
|
||||
@@ -204,6 +210,8 @@ public partial class App : System.Windows.Application
|
||||
return new SqlSugarDbContext(appSettings);
|
||||
});
|
||||
|
||||
|
||||
|
||||
services.AddSingleton<IInitializeRepository, InitializeRepository>();
|
||||
services.AddSingleton<IDeviceRepository, DeviceRepository>();
|
||||
services.AddSingleton<IVariableTableRepository, VariableTableRepository>();
|
||||
@@ -216,7 +224,7 @@ public partial class App : System.Windows.Application
|
||||
services.AddSingleton<INlogRepository, NlogRepository>();
|
||||
services.AddSingleton<IRepositoryManager, RepositoryManager>();
|
||||
services.AddSingleton<IAlarmHistoryRepository, AlarmHistoryRepository>(); // 添加这行
|
||||
services.AddSingleton<ITriggerRepository, SqlSugarTriggerRepository>(); // 注册触发器仓储
|
||||
services.AddSingleton<ITriggerRepository, TriggerRepository>(); // 注册触发器仓储
|
||||
services.AddSingleton<IEmailAccountRepository, EmailAccountRepository>();
|
||||
services.AddSingleton<IEmailMessageRepository, EmailMessageRepository>();
|
||||
services.AddSingleton<IEmailTemplateRepository, EmailTemplateRepository>();
|
||||
@@ -321,7 +329,7 @@ public partial class App : System.Windows.Application
|
||||
services.AddTransient<AlarmSettingsDialogViewModel>();
|
||||
services.AddTransient<EmailAccountDialogViewModel>();
|
||||
services.AddTransient<EmailTemplateDialogViewModel>();
|
||||
services.AddTransient<TriggerEditorViewModel>(); // 注册 TriggerEditorViewModel
|
||||
services.AddTransient<TriggerDialogViewModel>(); // 注册 TriggerEditorViewModel
|
||||
|
||||
// 注册View视图
|
||||
services.AddSingleton<SplashWindow>();
|
||||
@@ -335,6 +343,7 @@ public partial class App : System.Windows.Application
|
||||
services.AddScoped<DeviceDetailView>();
|
||||
services.AddScoped<MqttsView>();
|
||||
services.AddSingleton<EmailManagementView>();
|
||||
services.AddSingleton<TriggersView>(); // 注册 TriggersView
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -144,6 +144,16 @@
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Dialogs\TriggerDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\TriggersView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<XamlRuntime>Wpf</XamlRuntime>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -166,6 +176,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="ViewModels\Items\" />
|
||||
<Folder Include="ViewModels\Triggers\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using DMS.WPF.Interfaces;
|
||||
using DMS.WPF.ViewModels.Triggers;
|
||||
using DMS.WPF.Views;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
|
||||
@@ -29,7 +30,8 @@ namespace DMS.WPF.Services
|
||||
{ typeof(HistorySettingsDialogViewModel), typeof(HistorySettingsDialog) },
|
||||
{ typeof(AlarmSettingsDialogViewModel), typeof(AlarmSettingsDialog) },
|
||||
{ typeof(EmailAccountDialogViewModel), typeof(EmailAccountDialog) },
|
||||
{ typeof(EmailTemplateDialogViewModel), typeof(EmailTemplateDialog) }
|
||||
{ typeof(EmailTemplateDialogViewModel), typeof(EmailTemplateDialog) },
|
||||
{ typeof(TriggerDialogViewModel), typeof(TriggerDialog) }
|
||||
// Add other mappings here
|
||||
// ... other dialogs
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using DMS.WPF.Interfaces;
|
||||
using DMS.WPF.ViewModels;
|
||||
using DMS.WPF.ViewModels.Items;
|
||||
using DMS.WPF.ViewModels.Triggers;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DMS.WPF.Services;
|
||||
@@ -96,6 +97,8 @@ public class NavigationService : INavigationService
|
||||
return App.Current.Services.GetRequiredService<SettingViewModel>();
|
||||
case "EmailManagementView":
|
||||
return App.Current.Services.GetRequiredService<EmailManagementViewModel>();
|
||||
case "TriggersView":
|
||||
return App.Current.Services.GetRequiredService<TriggersViewModel>();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,21 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Application.DTOs.Triggers;
|
||||
using DMS.Application.Interfaces;
|
||||
using DMS.Core.Models.Triggers;
|
||||
using DMS.WPF.Interfaces;
|
||||
using DMS.WPF.Services;
|
||||
|
||||
namespace DMS.WPF.ViewModels.Triggers
|
||||
namespace DMS.WPF.ViewModels.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// 触发器编辑器视图模型
|
||||
/// </summary>
|
||||
public partial class TriggerEditorViewModel : DialogViewModelBase<TriggerDefinitionDto?>
|
||||
public partial class TriggerDialogViewModel : DialogViewModelBase<TriggerDefinitionDto?>
|
||||
{
|
||||
private readonly IVariableAppService _variableAppService; // To populate variable selection dropdown
|
||||
private readonly IDialogService _dialogService;
|
||||
@@ -29,18 +27,15 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
|
||||
// Properties for easier binding in XAML for SendEmail action config
|
||||
[ObservableProperty]
|
||||
[Required(ErrorMessage = "收件人不能为空")]
|
||||
private string _emailRecipients = "";
|
||||
|
||||
[ObservableProperty]
|
||||
[Required(ErrorMessage = "邮件主题模板不能为空")]
|
||||
private string _emailSubjectTemplate = "";
|
||||
|
||||
[ObservableProperty]
|
||||
[Required(ErrorMessage = "邮件内容模板不能为空")]
|
||||
private string _emailBodyTemplate = "";
|
||||
|
||||
public TriggerEditorViewModel(
|
||||
public TriggerDialogViewModel(
|
||||
IVariableAppService variableAppService,
|
||||
IDialogService dialogService,
|
||||
INotificationService notificationService)
|
||||
@@ -54,7 +49,7 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
/// 初始化视图模型(传入待编辑的触发器)
|
||||
/// </summary>
|
||||
/// <param name="parameter">待编辑的触发器 DTO</param>
|
||||
public override async Task OnInitializedAsync(object? parameter)
|
||||
public async Task OnInitializedAsync(object? parameter)
|
||||
{
|
||||
if (parameter is TriggerDefinitionDto triggerDto)
|
||||
{
|
||||
@@ -84,7 +79,7 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_notificationService.ShowWarning($"无法解析邮件配置: {ex.Message}");
|
||||
_notificationService.ShowWarn($"无法解析邮件配置: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,7 +92,7 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
{
|
||||
try
|
||||
{
|
||||
var variables = await _variableAppService.GetAllAsync();
|
||||
var variables = await _variableAppService.GetAllVariablesAsync();
|
||||
AvailableVariables = variables ?? new List<VariableDto>();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -116,13 +111,13 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
// Basic validation
|
||||
if (Trigger.VariableId == Guid.Empty)
|
||||
{
|
||||
_notificationService.ShowWarning("请选择关联的变量");
|
||||
_notificationService.ShowWarn("请选择关联的变量");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Trigger.Description))
|
||||
{
|
||||
_notificationService.ShowWarning("请输入触发器描述");
|
||||
_notificationService.ShowWarn("请输入触发器描述");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,7 +130,7 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
case ConditionType.NotEqualTo:
|
||||
if (!Trigger.Threshold.HasValue)
|
||||
{
|
||||
_notificationService.ShowWarning($"{Trigger.Condition} 条件需要设置阈值");
|
||||
_notificationService.ShowWarn($"{Trigger.Condition} 条件需要设置阈值");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -143,12 +138,12 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
case ConditionType.OutOfRange:
|
||||
if (!Trigger.LowerBound.HasValue || !Trigger.UpperBound.HasValue)
|
||||
{
|
||||
_notificationService.ShowWarning($"{Trigger.Condition} 条件需要设置下限和上限");
|
||||
_notificationService.ShowWarn($"{Trigger.Condition} 条件需要设置下限和上限");
|
||||
return;
|
||||
}
|
||||
if (Trigger.LowerBound > Trigger.UpperBound)
|
||||
{
|
||||
_notificationService.ShowWarning("下限必须小于或等于上限");
|
||||
_notificationService.ShowWarn("下限必须小于或等于上限");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -159,19 +154,19 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(EmailRecipients))
|
||||
{
|
||||
_notificationService.ShowWarning("请输入至少一个收件人邮箱地址");
|
||||
_notificationService.ShowWarn("请输入至少一个收件人邮箱地址");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(EmailSubjectTemplate))
|
||||
{
|
||||
_notificationService.ShowWarning("请输入邮件主题模板");
|
||||
_notificationService.ShowWarn("请输入邮件主题模板");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(EmailBodyTemplate))
|
||||
{
|
||||
_notificationService.ShowWarning("请输入邮件内容模板");
|
||||
_notificationService.ShowWarn("请输入邮件内容模板");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -199,7 +194,7 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
}
|
||||
|
||||
// Close dialog with the updated trigger DTO
|
||||
await CloseDialogAsync(Trigger);
|
||||
await Close(Trigger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -208,7 +203,7 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
[RelayCommand]
|
||||
private async Task CancelAsync()
|
||||
{
|
||||
await CloseDialogAsync(null); // Return null to indicate cancellation
|
||||
await Close(null); // Return null to indicate cancellation
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ using DMS.Application.DTOs.Triggers;
|
||||
using DMS.Application.Services.Triggers;
|
||||
using DMS.WPF.Interfaces;
|
||||
using DMS.WPF.Services;
|
||||
using DMS.WPF.ViewModels.Dialogs;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DMS.WPF.ViewModels.Triggers
|
||||
{
|
||||
@@ -70,7 +72,10 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
UpdatedAt = DateTime.UtcNow
|
||||
};
|
||||
|
||||
var result = await _dialogService.ShowDialogAsync<TriggerEditorViewModel, TriggerDefinitionDto?>("编辑触发器", newTrigger);
|
||||
TriggerDialogViewModel viewModel = App.Current.Services.GetRequiredService<TriggerDialogViewModel>();
|
||||
await viewModel.OnInitializedAsync(newTrigger);
|
||||
|
||||
var result = await _dialogService.ShowDialogAsync(viewModel);
|
||||
if (result != null)
|
||||
{
|
||||
try
|
||||
@@ -95,7 +100,7 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
{
|
||||
if (SelectedTrigger == null)
|
||||
{
|
||||
_notificationService.ShowWarning("请先选择一个触发器");
|
||||
_notificationService.ShowWarn("请先选择一个触发器");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -117,8 +122,10 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
CreatedAt = SelectedTrigger.CreatedAt,
|
||||
UpdatedAt = SelectedTrigger.UpdatedAt
|
||||
};
|
||||
TriggerDialogViewModel viewModel = App.Current.Services.GetRequiredService<TriggerDialogViewModel>();
|
||||
await viewModel.OnInitializedAsync(triggerToEdit);
|
||||
|
||||
var result = await _dialogService.ShowDialogAsync<TriggerEditorViewModel, TriggerDefinitionDto?>("编辑触发器", triggerToEdit);
|
||||
var result = await _dialogService.ShowDialogAsync(viewModel);
|
||||
if (result != null)
|
||||
{
|
||||
try
|
||||
@@ -154,11 +161,11 @@ namespace DMS.WPF.ViewModels.Triggers
|
||||
{
|
||||
if (SelectedTrigger == null)
|
||||
{
|
||||
_notificationService.ShowWarning("请先选择一个触发器");
|
||||
_notificationService.ShowWarn("请先选择一个触发器");
|
||||
return;
|
||||
}
|
||||
|
||||
var confirm = await _dialogService.ShowConfirmDialogAsync("确认删除", $"确定要删除触发器 '{SelectedTrigger.Description}' 吗?");
|
||||
var confirm = await _dialogService.ShowDialogAsync(new ConfirmDialogViewModel("确认删除", $"确定要删除触发器 '{SelectedTrigger.Description}' 吗?","删除"));
|
||||
if (confirm)
|
||||
{
|
||||
try
|
||||
176
DMS.WPF/Views/Dialogs/TriggerDialog.xaml
Normal file
176
DMS.WPF/Views/Dialogs/TriggerDialog.xaml
Normal file
@@ -0,0 +1,176 @@
|
||||
<ui:ContentDialog x:Class="DMS.WPF.Views.Dialogs.TriggerDialog"
|
||||
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:vc="clr-namespace:DMS.WPF.ValueConverts"
|
||||
xmlns:ex="clr-namespace:DMS.Extensions"
|
||||
xmlns:converters="clr-namespace:DMS.WPF.Converters"
|
||||
Title="{Binding Title}"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="600"
|
||||
MinWidth="500" MinHeight="500"
|
||||
PrimaryButtonText="{Binding PrimaryButText}"
|
||||
CloseButtonText="取消"
|
||||
PrimaryButtonCommand="{Binding SaveCommand}"
|
||||
CloseButtonCommand="{Binding CancelCommand}"
|
||||
DefaultButton="Primary">
|
||||
|
||||
<ui:ContentDialog.Resources>
|
||||
<converters:EnumToVisibilityConverter x:Key="LocalEnumToVisibilityConverter"/>
|
||||
<ex:EnumBindingSource x:Key="ConditionTypeEnum" EnumType="{x:Type enums:ConditionType}" />
|
||||
<ex:EnumBindingSource x:Key="ActionTypeEnum" EnumType="{x:Type enums:ActionType}" />
|
||||
</ui:ContentDialog.Resources>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel Margin="10">
|
||||
<!-- Basic Info Section -->
|
||||
<GroupBox Header="基本信息" Padding="5">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="关联变量:" Width="100" VerticalAlignment="Center"/>
|
||||
<ComboBox ItemsSource="{Binding AvailableVariables}"
|
||||
DisplayMemberPath="Name"
|
||||
SelectedValuePath="Id"
|
||||
SelectedValue="{Binding Trigger.VariableId}"
|
||||
Width="200" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="描述:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Description, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="300" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<CheckBox Content="激活" IsChecked="{Binding Trigger.IsActive}" Margin="0,0,0,5"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- Condition Section -->
|
||||
<GroupBox Header="触发条件" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="条件类型:" Width="100" VerticalAlignment="Center"/>
|
||||
<ComboBox ItemsSource="{Binding Source={StaticResource ConditionTypeEnum}}"
|
||||
SelectedItem="{Binding Trigger.Condition}"
|
||||
Width="200" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<!-- Conditional Fields based on Condition Type -->
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=GreaterThan}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="阈值:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Threshold, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=LessThan}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="阈值:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Threshold, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=EqualTo}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="阈值:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Threshold, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=NotEqualTo}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="阈值:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Threshold, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=InRange}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="下限:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.LowerBound, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="上限:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.UpperBound, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=OutOfRange}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="下限:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.LowerBound, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="上限:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.UpperBound, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- Action Section -->
|
||||
<GroupBox Header="触发动作" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="动作类型:" Width="100" VerticalAlignment="Center"/>
|
||||
<ComboBox ItemsSource="{Binding Source={StaticResource ActionTypeEnum}}"
|
||||
SelectedItem="{Binding Trigger.Action}"
|
||||
Width="200" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<!-- Conditional Fields based on Action Type -->
|
||||
<StackPanel Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=SendEmail}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="收件人 (分号分隔):" Width="150" VerticalAlignment="Top"/>
|
||||
<TextBox Text="{Binding EmailRecipients, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
||||
AcceptsReturn="True" TextWrapping="Wrap"
|
||||
Width="350" Height="60" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="邮件主题模板:" Width="150" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding EmailSubjectTemplate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
||||
Width="350" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="邮件内容模板:" Width="150" VerticalAlignment="Top"/>
|
||||
<TextBox Text="{Binding EmailBodyTemplate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
||||
AcceptsReturn="True" TextWrapping="Wrap"
|
||||
Width="350" Height="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Add placeholders for other action types if needed -->
|
||||
<StackPanel Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=ActivateAlarm}">
|
||||
<TextBlock Text="配置激活报警动作..." Margin="5"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=WriteToLog}">
|
||||
<TextBlock Text="配置写入日志动作..." Margin="5"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- Suppression Section -->
|
||||
<GroupBox Header="抑制设置" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="抑制持续时间 (秒):" Width="150" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.SuppressionDuration, Converter={StaticResource NullableTimeSpanToSecondsConverter}, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</ui:ContentDialog>
|
||||
32
DMS.WPF/Views/Dialogs/TriggerDialog.xaml.cs
Normal file
32
DMS.WPF/Views/Dialogs/TriggerDialog.xaml.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Windows.Controls;
|
||||
using DMS.WPF.Helper;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
|
||||
namespace DMS.WPF.Views.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// TriggerDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TriggerDialog : ContentDialog
|
||||
{
|
||||
private const int ContentAreaMaxWidth = 1000;
|
||||
private const int ContentAreaMaxHeight = 800;
|
||||
|
||||
public TriggerDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Opened += OnOpened;
|
||||
}
|
||||
|
||||
private void OnOpened(ContentDialog sender, ContentDialogOpenedEventArgs args)
|
||||
{
|
||||
// 修改对话框内容的最大宽度和最大高度
|
||||
var backgroundElementBorder = VisualTreeFinder.FindVisualChildByName<Border>(this, "BackgroundElement");
|
||||
if (backgroundElementBorder != null)
|
||||
{
|
||||
backgroundElementBorder.MaxWidth = ContentAreaMaxWidth;
|
||||
backgroundElementBorder.MaxHeight = ContentAreaMaxHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@
|
||||
xmlns:tb="http://hardcodet.net/taskbar"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
||||
xmlns:vmt="clr-namespace:DMS.WPF.ViewModels.Triggers"
|
||||
Title="设备管理系统"
|
||||
Width="1080"
|
||||
Height="800"
|
||||
@@ -112,6 +113,10 @@
|
||||
<DataTemplate DataType="{x:Type vm:EmailManagementViewModel}">
|
||||
<local:EmailManagementView />
|
||||
</DataTemplate>
|
||||
<!-- 触发器管理页 -->
|
||||
<DataTemplate DataType="{x:Type vmt:TriggersViewModel}">
|
||||
<local:TriggersView/>
|
||||
</DataTemplate>
|
||||
<!-- 设备详情页 -->
|
||||
<DataTemplate DataType="{x:Type vm:DeviceDetailViewModel}">
|
||||
<local:DeviceDetailView />
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
<UserControl x:Class="DMS.WPF.Views.Triggers.TriggerEditorView"
|
||||
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:local="clr-namespace:DMS.WPF.Views.Triggers"
|
||||
xmlns:viewmodels="clr-namespace:DMS.WPF.ViewModels.Triggers;assembly=DMS.WPF"
|
||||
xmlns:converters="clr-namespace:DMS.WPF.Converters;assembly=DMS.WPF"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="600" d:DesignWidth="600"
|
||||
MinWidth="500" MinHeight="500">
|
||||
<UserControl.DataContext>
|
||||
<viewmodels:TriggerEditorViewModel />
|
||||
</UserControl.DataContext>
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<TextBlock Grid.Row="0" Text="{Binding Title}" FontSize="18" FontWeight="Bold" Margin="0,0,0,10"/>
|
||||
|
||||
<!-- ScrollViewer for form content -->
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<!-- Basic Info Section -->
|
||||
<GroupBox Header="基本信息" Padding="5">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="关联变量:" Width="100" VerticalAlignment="Center"/>
|
||||
<ComboBox ItemsSource="{Binding AvailableVariables}"
|
||||
DisplayMemberPath="Name"
|
||||
SelectedValuePath="Id"
|
||||
SelectedValue="{Binding Trigger.VariableId}"
|
||||
Width="200" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="描述:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Description, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="300" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<CheckBox Content="激活" IsChecked="{Binding Trigger.IsActive}" Margin="0,0,0,5"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- Condition Section -->
|
||||
<GroupBox Header="触发条件" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="条件类型:" Width="100" VerticalAlignment="Center"/>
|
||||
<ComboBox ItemsSource="{Binding Source={StaticResource ConditionTypeEnum}}"
|
||||
SelectedItem="{Binding Trigger.Condition}"
|
||||
Width="200" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<!-- Conditional Fields based on Condition Type -->
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=GreaterThan}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="阈值:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Threshold, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=LessThan}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="阈值:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Threshold, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=EqualTo}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="阈值:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Threshold, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=NotEqualTo}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="阈值:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.Threshold, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=InRange}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="下限:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.LowerBound, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="上限:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.UpperBound, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Condition, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=OutOfRange}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="下限:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.LowerBound, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="上限:" Width="100" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.UpperBound, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- Action Section -->
|
||||
<GroupBox Header="触发动作" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="动作类型:" Width="100" VerticalAlignment="Center"/>
|
||||
<ComboBox ItemsSource="{Binding Source={StaticResource ActionTypeEnum}}"
|
||||
SelectedItem="{Binding Trigger.Action}"
|
||||
Width="200" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
|
||||
<!-- Conditional Fields based on Action Type -->
|
||||
<StackPanel Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=SendEmail}">
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="收件人 (分号分隔):" Width="150" VerticalAlignment="Top"/>
|
||||
<TextBox Text="{Binding EmailRecipients, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
||||
AcceptsReturn="True" TextWrapping="Wrap"
|
||||
Width="350" Height="60" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="邮件主题模板:" Width="150" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding EmailSubjectTemplate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
||||
Width="350" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="邮件内容模板:" Width="150" VerticalAlignment="Top"/>
|
||||
<TextBox Text="{Binding EmailBodyTemplate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
||||
AcceptsReturn="True" TextWrapping="Wrap"
|
||||
Width="350" Height="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Add placeholders for other action types if needed -->
|
||||
<StackPanel Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=ActivateAlarm}">
|
||||
<TextBlock Text="配置激活报警动作..." Margin="5"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Visibility="{Binding Trigger.Action, Converter={StaticResource LocalEnumToVisibilityConverter}, ConverterParameter=WriteToLog}">
|
||||
<TextBlock Text="配置写入日志动作..." Margin="5"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<!-- Suppression Section -->
|
||||
<GroupBox Header="抑制设置" Padding="5" Margin="0,10,0,0">
|
||||
<StackPanel>
|
||||
<DockPanel Margin="0,0,0,5">
|
||||
<Label Content="抑制持续时间 (秒):" Width="150" VerticalAlignment="Center"/>
|
||||
<TextBox Text="{Binding Trigger.SuppressionDuration, Converter={StaticResource NullableTimeSpanToSecondsConverter}, UpdateSourceTrigger=PropertyChanged}"
|
||||
Width="100" HorizontalAlignment="Left"/>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Buttons -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
|
||||
<Button Content="{Binding PrimaryButText}" Command="{Binding SaveCommand}" Margin="0,0,5,0" Width="80"/>
|
||||
<Button Content="取消" Command="{Binding CancelCommand}" Width="80"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace DMS.WPF.Views.Triggers
|
||||
{
|
||||
/// <summary>
|
||||
/// TriggerEditorView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TriggerEditorView : UserControl
|
||||
{
|
||||
public TriggerEditorView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace DMS.WPF.Views.Triggers
|
||||
{
|
||||
/// <summary>
|
||||
/// TriggersView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TriggersView : Page
|
||||
{
|
||||
public TriggersView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,12 @@
|
||||
<Page x:Class="DMS.WPF.Views.Triggers.TriggersView"
|
||||
<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"
|
||||
xmlns:local="clr-namespace:DMS.WPF.Views.Triggers"
|
||||
xmlns:viewmodels="clr-namespace:DMS.WPF.ViewModels.Triggers;assembly=DMS.WPF"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Title="TriggersView">
|
||||
<Page.DataContext>
|
||||
<viewmodels:TriggersViewModel />
|
||||
</Page.DataContext>
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
@@ -19,12 +15,28 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Toolbar -->
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,0,0,10">
|
||||
<Button Content="添加" Command="{Binding AddTriggerCommand}" Margin="0,0,5,0"/>
|
||||
<Button Content="编辑" Command="{Binding EditTriggerCommand}" Margin="0,0,5,0"/>
|
||||
<Button Content="删除" Command="{Binding DeleteTriggerCommand}" Margin="0,0,5,0"/>
|
||||
<Button Content="刷新" Command="{Binding LoadTriggersCommand}" Margin="0,0,5,0"/>
|
||||
</StackPanel>
|
||||
<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"
|
||||
@@ -48,4 +60,4 @@
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Page>
|
||||
</UserControl>
|
||||
18
DMS.WPF/Views/TriggersView.xaml.cs
Normal file
18
DMS.WPF/Views/TriggersView.xaml.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Windows.Controls;
|
||||
using DMS.WPF.ViewModels.Triggers;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace DMS.WPF.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// TriggersView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class TriggersView : UserControl
|
||||
{
|
||||
public TriggersView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = App.Current.Services.GetRequiredService<TriggersViewModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user