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

- 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

@@ -35,6 +35,9 @@ public partial class GroupEditViewModel : ObservableObject
[ObservableProperty]
private IconProvider.IconOption? _selectedIcon;
[ObservableProperty]
private bool _autoRunOnStart;
/// <summary>
/// 可供勾选的普通工具列表IsGroup == false
/// </summary>
@@ -85,6 +88,7 @@ public partial class GroupEditViewModel : ObservableObject
Name = groupToEdit.Name;
HotKey = groupToEdit.HotKey;
SelectedCategory = Categories.FirstOrDefault(c => c.Id == groupToEdit.CategoryId);
AutoRunOnStart = groupToEdit.AutoRunOnStart;
if (!string.IsNullOrEmpty(groupToEdit.IconCode))
{
@@ -119,6 +123,7 @@ public partial class GroupEditViewModel : ObservableObject
_editingGroup.CategoryId = SelectedCategory?.Id ?? string.Empty;
_editingGroup.SubToolIds = selectedIds;
_editingGroup.IsValid = true;
_editingGroup.AutoRunOnStart = AutoRunOnStart;
_logService.Info($"已更新组合: {Name.Trim()}(包含 {selectedIds.Count} 个工具)");
}
else
@@ -131,7 +136,8 @@ public partial class GroupEditViewModel : ObservableObject
CategoryId = SelectedCategory?.Id ?? string.Empty,
IsGroup = true,
SubToolIds = selectedIds,
IsValid = true
IsValid = true,
AutoRunOnStart = AutoRunOnStart
});
_logService.Info($"已添加组合: {Name.Trim()}(包含 {selectedIds.Count} 个工具)");
}