新增工具/组合随软件启动自动运行功能

- ToolItem 模型新增 AutoRunOnStart 属性,持久化到配置文件
- App.OnStartup 启动后自动执行标记为自启动的工具/组合(间隔500ms)
- 工具编辑窗口和组合编辑窗口新增「随软件启动自动运行」CheckBox
- 主界面工具卡片左上角 Rocket 角标标识已启用自启的项目
This commit is contained in:
2026-05-10 02:51:29 +08:00
parent 85919381b1
commit b715904439
8 changed files with 82 additions and 8 deletions

View File

@@ -105,6 +105,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70"/>
@@ -185,12 +186,20 @@
VerticalContentAlignment="Center"
Height="28" Margin="0,0,0,10" Padding="6,0"/>
<!-- 自动运行 -->
<CheckBox Grid.Row="4" Grid.Column="1"
IsChecked="{Binding AutoRunOnStart}"
Content="随软件启动自动运行"
Foreground="{DynamicResource Theme.Foreground}"
VerticalAlignment="Center"
Margin="0,0,0,10"/>
<!-- 子工具选择 -->
<TextBlock Grid.Row="4" Grid.Column="0"
<TextBlock Grid.Row="5" Grid.Column="0"
Text="包含工具:"
Foreground="{DynamicResource Theme.Foreground}"
VerticalAlignment="Top" Margin="0,4,0,0"/>
<Border Grid.Row="4" Grid.Column="1"
<Border Grid.Row="5" Grid.Column="1"
Background="{DynamicResource Theme.InputBackground}"
BorderBrush="{DynamicResource Theme.InputBorder}"
BorderThickness="1"
@@ -230,7 +239,7 @@
</Border>
<!-- 按钮 -->
<StackPanel Grid.Row="6" Grid.Column="1"
<StackPanel Grid.Row="7" Grid.Column="1"
Orientation="Horizontal" HorizontalAlignment="Right"
Margin="0,10,0,0">
<Button Content="保存"

View File

@@ -134,6 +134,23 @@
</Style>
</fa:IconBlock.Style>
</fa:IconBlock>
<!-- 自启动角标 -->
<fa:IconBlock Icon="Rocket" FontSize="10"
Foreground="{DynamicResource Theme.Accent}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="6,4,0,0">
<fa:IconBlock.Style>
<Style TargetType="fa:IconBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding AutoRunOnStart}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</fa:IconBlock.Style>
</fa:IconBlock>
</Grid>
</Border>
</DataTemplate>

View File

@@ -106,6 +106,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
@@ -229,13 +230,21 @@
Foreground="{DynamicResource Theme.TextSecondary}"
FontSize="11" Margin="0,0,0,16"/>
<!-- 自动运行 -->
<CheckBox Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="2"
IsChecked="{Binding AutoRunOnStart}"
Content="随软件启动自动运行"
Foreground="{DynamicResource Theme.Foreground}"
VerticalAlignment="Center"
Margin="0,0,0,12"/>
<!-- 分隔线 -->
<Border Grid.Row="7" Grid.ColumnSpan="3"
<Border Grid.Row="8" Grid.ColumnSpan="3"
BorderBrush="{DynamicResource Theme.CardBorder}"
BorderThickness="0,1,0,0" Margin="0,0,0,14"/>
<!-- 按钮 -->
<StackPanel Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="2"
<StackPanel Grid.Row="9" Grid.Column="1" Grid.ColumnSpan="2"
Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="保存"
Command="{Binding SaveCommand}"