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

- 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

@@ -257,6 +257,24 @@ public partial class MainViewModel : ObservableObject
RefreshData();
}
// ───────────────────────────── 自动运行 ─────────────────────────────
/// <summary>
/// 启动时自动运行标记为 AutoRunOnStart 的工具和组合
/// </summary>
public async Task ExecuteAutoRunToolsAsync()
{
var autoTools = _dataService.Config.Tools.Where(t => t.AutoRunOnStart).ToList();
if (autoTools.Count == 0) return;
_logService.Info($"正在启动 {autoTools.Count} 个自启动工具...");
foreach (var tool in autoTools)
{
await _processService.ExecuteAsync(tool);
await Task.Delay(500);
}
}
// ───────────────────────────── 数据刷新 ─────────────────────────────
/// <summary>