- 根据触发器类型动态展示对应配置区域,减少无关字段干扰。 - 将单次、每日、每周、每月和生效时间范围改为日期选择器与时分秒下拉选择,避免手动输入时间格式。 - 为单次执行增加延后执行快捷设置,支持常用快捷按钮和自定义分钟、小时、天后执行。 - 移除开机自启设置、注册表写入逻辑和相关配置字段,降低对用户系统的影响。 - 同步优化部分任务状态、触发摘要和设置界面文案。
268 lines
21 KiB
XML
268 lines
21 KiB
XML
<Window x:Class="OmniScheduler.TaskEditorWindow"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
Title="任务编辑"
|
|
Height="690"
|
|
Width="900"
|
|
MinHeight="620"
|
|
MinWidth="820"
|
|
WindowStartupLocation="CenterOwner"
|
|
Icon="app.ico">
|
|
<Window.Resources>
|
|
<Style x:Key="SectionTitle" TargetType="TextBlock">
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Margin" Value="0,0,0,8" />
|
|
</Style>
|
|
<Style x:Key="FieldLabel" TargetType="TextBlock">
|
|
<Setter Property="Width" Value="90" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="Margin" Value="0,0,10,0" />
|
|
</Style>
|
|
<Style x:Key="FieldRow" TargetType="StackPanel">
|
|
<Setter Property="Orientation" Value="Horizontal" />
|
|
<Setter Property="Margin" Value="0,8,0,0" />
|
|
</Style>
|
|
<Style x:Key="TimeCombo" TargetType="ComboBox">
|
|
<Setter Property="Width" Value="58" />
|
|
<Setter Property="Height" Value="30" />
|
|
<Setter Property="DisplayMemberPath" Value="Label" />
|
|
</Style>
|
|
</Window.Resources>
|
|
|
|
<DockPanel Margin="12">
|
|
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,12,0,0">
|
|
<TextBlock x:Name="ValidationText" Foreground="#B42318" VerticalAlignment="Center" Margin="0,0,14,0" />
|
|
<Button Content="保存" Width="90" Click="Save_Click" />
|
|
<Button Content="取消" Width="90" Click="Cancel_Click" />
|
|
</StackPanel>
|
|
|
|
<TabControl>
|
|
<TabItem Header="常规">
|
|
<Grid Margin="14">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="130" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<TextBlock Text="任务名称" Grid.Row="0" VerticalAlignment="Center" />
|
|
<TextBox x:Name="NameBox" Grid.Row="0" Grid.Column="1" Height="30" />
|
|
<TextBlock Text="启用任务" Grid.Row="1" Margin="0,12,0,0" VerticalAlignment="Center" />
|
|
<CheckBox x:Name="EnabledBox" Grid.Row="1" Grid.Column="1" Margin="0,12,0,0" VerticalAlignment="Center" />
|
|
<TextBlock Text="任务描述" Grid.Row="2" Margin="0,12,0,0" />
|
|
<TextBox x:Name="DescriptionBox" Grid.Row="2" Grid.Column="1" Margin="0,12,0,0" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" />
|
|
</Grid>
|
|
</TabItem>
|
|
|
|
<TabItem Header="触发器">
|
|
<Grid Margin="14">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="245" />
|
|
<ColumnDefinition Width="14" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<DockPanel Grid.Column="0">
|
|
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="0,8,0,0">
|
|
<Button Content="添加" Click="AddTrigger_Click" />
|
|
<Button Content="删除" Click="RemoveTrigger_Click" />
|
|
</StackPanel>
|
|
<ListBox x:Name="TriggersList" DisplayMemberPath="Summary" SelectionChanged="TriggersList_SelectionChanged" />
|
|
</DockPanel>
|
|
|
|
<Border Grid.Column="2" BorderBrush="#D8DEE9" BorderThickness="1" Padding="12">
|
|
<Grid>
|
|
<TextBlock x:Name="TriggerEmptyText"
|
|
Text="请先添加或选择一个触发器。"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Foreground="#667085" />
|
|
|
|
<DockPanel x:Name="TriggerEditorPanel">
|
|
<StackPanel DockPanel.Dock="Top">
|
|
<TextBlock Text="触发类型" Style="{StaticResource SectionTitle}" />
|
|
<ComboBox x:Name="KindBox" Height="30" DisplayMemberPath="Label" SelectionChanged="Field_Changed" />
|
|
</StackPanel>
|
|
|
|
<GroupBox DockPanel.Dock="Bottom" Header="高级调度与预览" Margin="0,14,0,0">
|
|
<DockPanel Margin="10">
|
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
|
|
<TextBlock Text="错过触发补偿策略" VerticalAlignment="Center" Margin="0,0,10,0" />
|
|
<ComboBox x:Name="MisfireBox" Width="180" Height="30" DisplayMemberPath="Label" />
|
|
</StackPanel>
|
|
<TextBox x:Name="PreviewBox" Margin="0,12,0,0" IsReadOnly="True" AcceptsReturn="True" Height="130" />
|
|
</DockPanel>
|
|
</GroupBox>
|
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto" Margin="0,14,0,0">
|
|
<StackPanel>
|
|
<StackPanel x:Name="OneTimeSection">
|
|
<TextBlock Text="单次执行" Style="{StaticResource SectionTitle}" />
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="快速设置" Style="{StaticResource FieldLabel}" />
|
|
<TextBox x:Name="OneTimeDelayValueBox" Width="70" Height="30" Text="5" />
|
|
<ComboBox x:Name="OneTimeDelayUnitBox" Width="90" Height="30" Margin="8,0,0,0" DisplayMemberPath="Label" />
|
|
<TextBlock Text="后执行" VerticalAlignment="Center" Margin="8,0,10,0" />
|
|
<Button Content="应用" Width="70" Click="ApplyOneTimeDelay_Click" />
|
|
</StackPanel>
|
|
<StackPanel Orientation="Horizontal" Margin="100,8,0,0">
|
|
<Button Content="5 分钟后" Tag="5" Click="QuickOneTimeDelay_Click" />
|
|
<Button Content="30 分钟后" Tag="30" Margin="8,0,0,0" Click="QuickOneTimeDelay_Click" />
|
|
<Button Content="1 小时后" Tag="60" Margin="8,0,0,0" Click="QuickOneTimeDelay_Click" />
|
|
<Button Content="明天此时" Tag="1440" Margin="8,0,0,0" Click="QuickOneTimeDelay_Click" />
|
|
</StackPanel>
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="执行日期" Style="{StaticResource FieldLabel}" />
|
|
<DatePicker x:Name="OneTimeDatePicker" Width="150" Height="30" SelectedDateChanged="Field_Changed" />
|
|
</StackPanel>
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="执行时间" Style="{StaticResource FieldLabel}" />
|
|
<ComboBox x:Name="OneTimeHourBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="时" VerticalAlignment="Center" Margin="4,0,8,0" />
|
|
<ComboBox x:Name="OneTimeMinuteBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="分" VerticalAlignment="Center" Margin="4,0,8,0" />
|
|
<ComboBox x:Name="OneTimeSecondBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="秒" VerticalAlignment="Center" Margin="4,0,0,0" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<StackPanel x:Name="IntervalSection">
|
|
<TextBlock Text="固定间隔" Style="{StaticResource SectionTitle}" />
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="每隔" Style="{StaticResource FieldLabel}" />
|
|
<TextBox x:Name="IntervalValueBox" Width="80" Height="30" TextChanged="Field_Changed" />
|
|
<ComboBox x:Name="IntervalUnitBox" Width="120" Height="30" Margin="8,0,0,0" DisplayMemberPath="Label" SelectionChanged="Field_Changed" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<StackPanel x:Name="DailySection">
|
|
<TextBlock Text="每日定时" Style="{StaticResource SectionTitle}" />
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="执行时间" Style="{StaticResource FieldLabel}" />
|
|
<ComboBox x:Name="DailyHourBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="时" VerticalAlignment="Center" Margin="4,0,8,0" />
|
|
<ComboBox x:Name="DailyMinuteBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="分" VerticalAlignment="Center" Margin="4,0,8,0" />
|
|
<ComboBox x:Name="DailySecondBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="秒" VerticalAlignment="Center" Margin="4,0,0,0" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<StackPanel x:Name="WeeklySection">
|
|
<TextBlock Text="每周定时" Style="{StaticResource SectionTitle}" />
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="星期" Style="{StaticResource FieldLabel}" />
|
|
<WrapPanel>
|
|
<CheckBox x:Name="SunBox" Content="日" Margin="0,0,10,0" Checked="Field_Changed" Unchecked="Field_Changed" />
|
|
<CheckBox x:Name="MonBox" Content="一" Margin="0,0,10,0" Checked="Field_Changed" Unchecked="Field_Changed" />
|
|
<CheckBox x:Name="TueBox" Content="二" Margin="0,0,10,0" Checked="Field_Changed" Unchecked="Field_Changed" />
|
|
<CheckBox x:Name="WedBox" Content="三" Margin="0,0,10,0" Checked="Field_Changed" Unchecked="Field_Changed" />
|
|
<CheckBox x:Name="ThuBox" Content="四" Margin="0,0,10,0" Checked="Field_Changed" Unchecked="Field_Changed" />
|
|
<CheckBox x:Name="FriBox" Content="五" Margin="0,0,10,0" Checked="Field_Changed" Unchecked="Field_Changed" />
|
|
<CheckBox x:Name="SatBox" Content="六" Margin="0,0,10,0" Checked="Field_Changed" Unchecked="Field_Changed" />
|
|
</WrapPanel>
|
|
</StackPanel>
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="执行时间" Style="{StaticResource FieldLabel}" />
|
|
<ComboBox x:Name="WeeklyHourBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="时" VerticalAlignment="Center" Margin="4,0,8,0" />
|
|
<ComboBox x:Name="WeeklyMinuteBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="分" VerticalAlignment="Center" Margin="4,0,8,0" />
|
|
<ComboBox x:Name="WeeklySecondBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="秒" VerticalAlignment="Center" Margin="4,0,0,0" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<StackPanel x:Name="MonthlySection">
|
|
<TextBlock Text="每月定时" Style="{StaticResource SectionTitle}" />
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="日期" Style="{StaticResource FieldLabel}" />
|
|
<TextBox x:Name="MonthDayBox" Width="80" Height="30" TextChanged="Field_Changed" />
|
|
<TextBlock Text="日" VerticalAlignment="Center" Margin="4,0,10,0" />
|
|
<CheckBox x:Name="LastBusinessDayBox" Content="每月最后一个工作日" VerticalAlignment="Center" Checked="Field_Changed" Unchecked="Field_Changed" />
|
|
</StackPanel>
|
|
<StackPanel Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="执行时间" Style="{StaticResource FieldLabel}" />
|
|
<ComboBox x:Name="MonthlyHourBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="时" VerticalAlignment="Center" Margin="4,0,8,0" />
|
|
<ComboBox x:Name="MonthlyMinuteBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="分" VerticalAlignment="Center" Margin="4,0,8,0" />
|
|
<ComboBox x:Name="MonthlySecondBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text="秒" VerticalAlignment="Center" Margin="4,0,0,0" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
|
|
<StackPanel x:Name="CronSection">
|
|
<TextBlock Text="Cron 表达式" Style="{StaticResource SectionTitle}" />
|
|
<TextBox x:Name="CronBox" Height="30" TextChanged="Field_Changed" />
|
|
<TextBlock Text="适合高级规则;下方会实时预览未来 5 次执行时间。" Foreground="#667085" Margin="0,6,0,0" />
|
|
</StackPanel>
|
|
|
|
<Separator Margin="0,16,0,12" />
|
|
<StackPanel x:Name="WindowSection">
|
|
<TextBlock Text="生效时间范围" Style="{StaticResource SectionTitle}" />
|
|
<CheckBox x:Name="UseStartsAtBox" Content="设置起始生效时间" Checked="WindowOption_Changed" Unchecked="WindowOption_Changed" />
|
|
<StackPanel x:Name="StartsAtPanel" Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="开始于" Style="{StaticResource FieldLabel}" />
|
|
<DatePicker x:Name="StartsAtDatePicker" Width="150" Height="30" SelectedDateChanged="Field_Changed" />
|
|
<ComboBox x:Name="StartsAtHourBox" Style="{StaticResource TimeCombo}" Margin="8,0,0,0" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text=":" VerticalAlignment="Center" Margin="4,0" />
|
|
<ComboBox x:Name="StartsAtMinuteBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text=":" VerticalAlignment="Center" Margin="4,0" />
|
|
<ComboBox x:Name="StartsAtSecondBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
</StackPanel>
|
|
<CheckBox x:Name="UseEndsAtBox" Content="设置结束失效时间" Margin="0,10,0,0" Checked="WindowOption_Changed" Unchecked="WindowOption_Changed" />
|
|
<StackPanel x:Name="EndsAtPanel" Style="{StaticResource FieldRow}">
|
|
<TextBlock Text="结束于" Style="{StaticResource FieldLabel}" />
|
|
<DatePicker x:Name="EndsAtDatePicker" Width="150" Height="30" SelectedDateChanged="Field_Changed" />
|
|
<ComboBox x:Name="EndsAtHourBox" Style="{StaticResource TimeCombo}" Margin="8,0,0,0" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text=":" VerticalAlignment="Center" Margin="4,0" />
|
|
<ComboBox x:Name="EndsAtMinuteBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
<TextBlock Text=":" VerticalAlignment="Center" Margin="4,0" />
|
|
<ComboBox x:Name="EndsAtSecondBox" Style="{StaticResource TimeCombo}" SelectionChanged="Field_Changed" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
</TabItem>
|
|
|
|
<TabItem Header="消息动作">
|
|
<Grid Margin="14">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="130" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<TextBlock Text="目标地址" VerticalAlignment="Center" />
|
|
<TextBox x:Name="TargetUrlBox" Grid.Column="1" Height="30" IsReadOnly="True" />
|
|
<TextBlock Text="频道" Grid.Row="1" Margin="0,10,0,0" VerticalAlignment="Center" />
|
|
<ComboBox x:Name="ChannelBox" Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" Height="30" IsEditable="True" />
|
|
<TextBlock Text="标题" Grid.Row="2" Margin="0,10,0,0" VerticalAlignment="Center" />
|
|
<TextBox x:Name="TitleBox" Grid.Row="2" Grid.Column="1" Margin="0,10,0,0" Height="30" />
|
|
<TextBlock Text="内容" Grid.Row="3" Margin="0,10,0,0" />
|
|
<TextBox x:Name="BodyBox" Grid.Row="3" Grid.Column="1" Margin="0,10,0,0" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" />
|
|
<StackPanel Grid.Row="4" Grid.Column="1" Orientation="Horizontal" Margin="0,10,0,0">
|
|
<Button Content="发送测试消息" Click="TestSend_Click" />
|
|
<TextBlock x:Name="TestResultText" VerticalAlignment="Center" Margin="8,0,0,0" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</TabItem>
|
|
</TabControl>
|
|
</DockPanel>
|
|
</Window>
|