feat(app): 初始化 OmniNotify 测试工具
创建基于 .NET 8 WPF 的桌面测试程序,支持配置通知接口、频道、标题和正文,并通过内置模板快速发送不同类型的测试消息。 实现服务检测、单次发送、自动定时发送、模板轮换、批量发送、非法频道切换和发送日志记录,便于验证 OmniNotify 本地消息 API 的基础行为与异常场景。 Initial-Commit: true
This commit is contained in:
178
MainWindow.xaml
Normal file
178
MainWindow.xaml
Normal file
@@ -0,0 +1,178 @@
|
||||
<Window x:Class="OmniNotifyTest.MainWindow"
|
||||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="OmniNotify 测试器"
|
||||
MinWidth="1060"
|
||||
MinHeight="720"
|
||||
Width="1180"
|
||||
Height="760"
|
||||
Background="#F4F6F8"
|
||||
FontFamily="Microsoft YaHei UI">
|
||||
<Window.Resources>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Height" Value="34" />
|
||||
<Setter Property="Padding" Value="14,0" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
</Style>
|
||||
<Style TargetType="TextBox">
|
||||
<Setter Property="MinHeight" Value="32" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style TargetType="ComboBox">
|
||||
<Setter Property="MinHeight" Value="32" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style TargetType="GroupBox">
|
||||
<Setter Property="Margin" Value="0,0,0,12" />
|
||||
<Setter Property="Padding" Value="10" />
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Margin="18">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<DockPanel Margin="0,0,0,14">
|
||||
<StackPanel>
|
||||
<TextBlock Text="OmniNotify 测试器" FontSize="26" FontWeight="SemiBold" Foreground="#172033" />
|
||||
<TextBlock Text="{Binding StatusText}" Margin="0,4,0,0" Foreground="#607085" />
|
||||
</StackPanel>
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="检测服务" Margin="0,0,8,0" Click="CheckServer_Click" />
|
||||
<Button Content="清空日志" Click="ClearLog_Click" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="330" />
|
||||
<ColumnDefinition Width="14" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Background="White" BorderBrush="#D9E0EA" BorderThickness="1" CornerRadius="6" Padding="14">
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Top">
|
||||
<TextBlock Text="连接" FontSize="16" FontWeight="SemiBold" Foreground="#1E293B" Margin="0,0,0,10" />
|
||||
<TextBlock Text="OmniNotify 地址" Foreground="#526173" Margin="0,0,0,4" />
|
||||
<TextBox Text="{Binding Endpoint, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,12" />
|
||||
|
||||
<TextBlock Text="频道" FontSize="16" FontWeight="SemiBold" Foreground="#1E293B" Margin="0,8,0,10" />
|
||||
<ComboBox ItemsSource="{Binding Channels}"
|
||||
Text="{Binding SelectedChannel, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsEditable="True"
|
||||
Margin="0,0,0,8" />
|
||||
<UniformGrid Columns="2" Margin="0,0,0,12">
|
||||
<Button Content="添加频道" Margin="0,0,4,0" Click="AddChannel_Click" />
|
||||
<Button Content="非法频道" Margin="4,0,0,0" Click="UseIllegalChannel_Click" />
|
||||
</UniformGrid>
|
||||
|
||||
<TextBlock Text="模板" FontSize="16" FontWeight="SemiBold" Foreground="#1E293B" Margin="0,8,0,10" />
|
||||
</StackPanel>
|
||||
|
||||
<ListBox ItemsSource="{Binding Presets}"
|
||||
SelectedItem="{Binding SelectedPreset}"
|
||||
DisplayMemberPath="Name"
|
||||
MinHeight="220"
|
||||
SelectionChanged="Preset_SelectionChanged" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border Background="White" BorderBrush="#D9E0EA" BorderThickness="1" CornerRadius="6" Padding="16" Margin="0,0,0,14">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="18" />
|
||||
<ColumnDefinition Width="300" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel>
|
||||
<TextBlock Text="消息内容" FontSize="16" FontWeight="SemiBold" Foreground="#1E293B" Margin="0,0,0,10" />
|
||||
<TextBlock Text="标题" Foreground="#526173" Margin="0,0,0,4" />
|
||||
<TextBox Text="{Binding MessageTitle, UpdateSourceTrigger=PropertyChanged}" Margin="0,0,0,10" />
|
||||
<TextBlock Text="正文" Foreground="#526173" Margin="0,0,0,4" />
|
||||
<TextBox Text="{Binding Body, UpdateSourceTrigger=PropertyChanged}"
|
||||
AcceptsReturn="True"
|
||||
TextWrapping="Wrap"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
MinHeight="132"
|
||||
VerticalContentAlignment="Top" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="2">
|
||||
<TextBlock Text="发送控制" FontSize="16" FontWeight="SemiBold" Foreground="#1E293B" Margin="0,0,0,10" />
|
||||
<Button Content="发送一次" Height="38" Click="SendOnce_Click" />
|
||||
|
||||
<GroupBox Header="自动发送" Margin="0,14,0,12">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="105" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="间隔(ms)" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="1" Text="{Binding IntervalMilliseconds, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBlock Grid.Row="1" Text="发送次数" VerticalAlignment="Center" Margin="0,8,0,0" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding AutoLimit, UpdateSourceTrigger=PropertyChanged}" Margin="0,8,0,0" />
|
||||
<CheckBox Grid.Row="2" Grid.ColumnSpan="2" Content="自动轮换模板" IsChecked="{Binding RotatePresets}" Margin="0,10,0,0" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<UniformGrid Columns="2">
|
||||
<Button Content="开始自动" Margin="0,0,4,0" Click="StartAuto_Click" />
|
||||
<Button Content="停止" Margin="4,0,0,0" Click="StopAuto_Click" />
|
||||
</UniformGrid>
|
||||
|
||||
<GroupBox Header="批量爆发" Margin="0,14,0,0">
|
||||
<DockPanel>
|
||||
<TextBox Text="{Binding BurstCount, UpdateSourceTrigger=PropertyChanged}" Width="80" Margin="0,0,8,0" />
|
||||
<Button Content="快速发送" Click="Burst_Click" />
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="1" Background="White" BorderBrush="#D9E0EA" BorderThickness="1" CornerRadius="6" Padding="12">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="发送日志" FontSize="16" FontWeight="SemiBold" Foreground="#1E293B" Margin="0,0,0,10" />
|
||||
<DataGrid Grid.Row="1"
|
||||
ItemsSource="{Binding Logs}"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
CanUserAddRows="False"
|
||||
HeadersVisibility="Column"
|
||||
GridLinesVisibility="Horizontal">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="时间" Binding="{Binding TimeText}" Width="92" />
|
||||
<DataGridTextColumn Header="频道" Binding="{Binding Channel}" Width="120" />
|
||||
<DataGridTextColumn Header="标题" Binding="{Binding Title}" Width="180" />
|
||||
<DataGridTextColumn Header="HTTP" Binding="{Binding StatusCode}" Width="70" />
|
||||
<DataGridTextColumn Header="结果" Binding="{Binding Result}" Width="*" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user