Files
personal-toolbox/PersonalToolBox/Models/ToolItem.cs
home-PC 85919381b1 Phase 7: 自定义图标系统 + 组合嵌套 + 删除功能 + UI 优化
- 安装 FontAwesome.Sharp v6.6.0,新增 Helpers/IconProvider.cs(190+ 图标,11 分类)
- ToolEditWindow/GroupEditWindow: 添加图标选择 ComboBox,按分类分组,带图标预览
- MainWindow 卡片模板: 使用 fa:IconBlock 渲染图标,IconCode 为空时回退首字母
- 组合角标从 emoji 改为 FontAwesome Cubes 图标,放置于卡片右上角
- ComboBox 样式修复: TextBlock→ContentPresenter,支持 ItemTemplate+DisplayMemberPath
- ComboBox 滚轮修复: CanContentScroll=False 解决分组模式下滑轮跳组问题
- 编辑弹窗: 所有输入控件添加 VerticalContentAlignment=Center
- 组合可包含其他组合: GetAncestorIds 递归排除自身及祖先防止循环引用
- ProcessExecutionService: 支持嵌套组合递归执行,visited 集合防死循环
- MainWindow 右键菜单新增删除功能,工具和组合均支持
- 移除侧边栏顶部个人工具箱标题文字
- 更新测试: 适配组合嵌套逻辑,新增祖先排除测试 (83/83 通过)
2026-05-10 02:19:32 +08:00

61 lines
1.6 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();
}