Files
personal-toolbox/PersonalToolBox/Models/ToolItem.cs
home-PC b715904439 新增工具/组合随软件启动自动运行功能
- ToolItem 模型新增 AutoRunOnStart 属性,持久化到配置文件
- App.OnStartup 启动后自动执行标记为自启动的工具/组合(间隔500ms)
- 工具编辑窗口和组合编辑窗口新增「随软件启动自动运行」CheckBox
- 主界面工具卡片左上角 Rocket 角标标识已启用自启的项目
2026-05-10 02:51:29 +08:00

66 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Text.Json.Serialization;
namespace PersonalToolBox.Models;
/// <summary>
/// 工具项模型,表示用户添加的一个可执行工具
/// </summary>
public class ToolItem
{
/// <summary>
/// 工具唯一标识 (UUID)
/// </summary>
public string Id { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// 工具显示名称
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// 内置图标库的图标枚举名称(如 "Github", "Wrench"),用于 FontAwesome 图标渲染
/// </summary>
public string IconCode { get; set; } = string.Empty;
/// <summary>
/// 可执行文件路径或 URL
/// </summary>
public string ExecutablePath { get; set; } = string.Empty;
/// <summary>
/// 运行参数(选填)
/// </summary>
public string Arguments { get; set; } = string.Empty;
/// <summary>
/// 所属分类 ID
/// </summary>
public string CategoryId { get; set; } = string.Empty;
/// <summary>
/// 全局快捷键(如 Ctrl+Alt+T选填
/// </summary>
public string HotKey { get; set; } = string.Empty;
/// <summary>
/// 路径是否有效(仅运行时计算,不存入 JSON
/// </summary>
[JsonIgnore]
public bool IsValid { get; set; } = true;
/// <summary>
/// 是否为组合卡片(一键多开)
/// </summary>
public bool IsGroup { get; set; }
/// <summary>
/// 当 IsGroup 为 true 时,存储需批量启动的子工具 ID 列表
/// </summary>
public List<string> SubToolIds { get; set; } = new();
/// <summary>
/// 是否在软件启动时自动运行
/// </summary>
public bool AutoRunOnStart { get; set; }
}