Phase 6: 一键多开 (工具组合) 功能
- 数据模型: ToolItem 新增 IsGroup(bool) + SubToolIds(List<string>) 字段
- 执行逻辑: ProcessExecutionService 改为 ExecuteAsync, 组合卡片遍历子工具逐一启动(500ms延迟), 孤儿ID跳过并打印警告
- 组合编辑: GroupEditViewModel + GroupEditWindow, 复选框列表勾选非组合工具
- 主界面: 标题栏新增 '+添加组合' 按钮(蓝色), 组合卡片右下角显示 📦 角标
- 右键菜单: 区分 '编辑工具' (普通) 和 '编辑组合' (IsGroup=true)
- 快捷键: HotKeyManager 适配 ExecuteAsync 异步调用
- 测试: 82 tests total (ProcessExecution 4->6, GroupEdit 5 new)
This commit is contained in:
@@ -143,10 +143,10 @@ public partial class MainViewModel : ObservableObject
|
||||
/// 执行工具(双击卡片或右键菜单)
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
private void ExecuteTool(ToolItem? tool)
|
||||
private async Task ExecuteTool(ToolItem? tool)
|
||||
{
|
||||
if (tool == null) return;
|
||||
_processService.Execute(tool);
|
||||
await _processService.ExecuteAsync(tool);
|
||||
}
|
||||
|
||||
// ───────────────────────────── 分类管理命令 ─────────────────────────────
|
||||
@@ -206,6 +206,38 @@ public partial class MainViewModel : ObservableObject
|
||||
RefreshData();
|
||||
}
|
||||
|
||||
// ───────────────────────────── 组合管理命令 ─────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
/// 添加组合
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
private void AddGroup()
|
||||
{
|
||||
var vm = _serviceProvider.GetRequiredService<GroupEditViewModel>();
|
||||
var window = new GroupEditWindow(vm);
|
||||
window.ShowDialog();
|
||||
|
||||
if (vm.Saved) RefreshData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑组合
|
||||
/// </summary>
|
||||
[RelayCommand]
|
||||
private void EditGroup(ToolItem tool)
|
||||
{
|
||||
if (tool == null || !tool.IsGroup) return;
|
||||
|
||||
var dataService = _serviceProvider.GetRequiredService<IDataService>();
|
||||
var logService = _serviceProvider.GetRequiredService<ILogService>();
|
||||
var editVm = new GroupEditViewModel(dataService, logService, tool);
|
||||
var window = new GroupEditWindow(editVm);
|
||||
window.ShowDialog();
|
||||
|
||||
if (editVm.Saved) RefreshData();
|
||||
}
|
||||
|
||||
// ───────────────────────────── 数据刷新 ─────────────────────────────
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user