feat: 增强便携版支持与配置管理
- 更新 .gitignore 文件,添加便携版分发目录和 Fody 生成的配置文件。 - 修改 README.md,详细说明便携版的构建与分发流程,强调单文件分发的优势。 - 在 Config.cs 中实现便携配置管理,优先使用 exe 同目录的 config.json,提升用户体验。 - 更新 ExcelService.cs,优化默认模板的导出逻辑,支持现场替换模板文件。 - 在 MainForm.cs 中加载应用图标,提升界面一致性。 - 调整 Program.cs,确保在单文件分发时正确加载 native DLL。
This commit is contained in:
@@ -341,7 +341,8 @@ namespace TfsExcelImporter
|
||||
// 透明背景会让父容器改画自己的 BackColor(灰),这里直接给成操作条的白
|
||||
_badgeRun = new StepBadge { BackColor = Theme.Card };
|
||||
_btnPreview = NewButton("预览数据", BtnKind.Secondary, IconKind.Table, 120);
|
||||
_btnImport = NewButton("开始导入 TFS", BtnKind.Primary, IconKind.ArrowUp, 176);
|
||||
// 148 已够图标+文字(实际量出约 130),省下的宽度留给右侧状态文字与进度条
|
||||
_btnImport = NewButton("开始导入 TFS", BtnKind.Primary, IconKind.ArrowUp, 148);
|
||||
// 主/次按钮同高(层级靠主色表达,不再用 38px 拔高),避免操作条里两个按钮大小不齐
|
||||
_pbar = new ProgressTrack
|
||||
{
|
||||
@@ -390,13 +391,33 @@ namespace TfsExcelImporter
|
||||
_chipFail.SetBounds(_actionBar.Width - _chipFail.Width - M - Theme.Px(2), cy, _chipFail.Width, _chipFail.Height);
|
||||
_chipSkip.SetBounds(_chipFail.Left - G - _chipSkip.Width, cy, _chipSkip.Width, _chipSkip.Height);
|
||||
_chipOk.SetBounds(_chipSkip.Left - G - _chipOk.Width, cy, _chipOk.Width, _chipOk.Height);
|
||||
int statW = Theme.Px(160);
|
||||
_lblStatus.SetBounds(_chipOk.Left - statW - G, 0, statW, _actionBar.Height);
|
||||
// 状态文字按最长常规文案实测给宽,且只给一行的高度:
|
||||
// 宽度够了不折行,万一更长的文案也只省略尾巴,不会把计数拆到第二行。
|
||||
int statW = StatusLabelWidth();
|
||||
int statH = Theme.Caption.Height + Theme.Px(4);
|
||||
_lblStatus.SetBounds(_chipOk.Left - statW - G, (_actionBar.Height - statH) / 2, statW, statH);
|
||||
int left = _btnImport.Right + Theme.S16;
|
||||
int barW = Math.Max(Theme.Px(40), _lblStatus.Left - G - left);
|
||||
_pbar.SetBounds(left, (_actionBar.Height - _pbar.Height) / 2, barW, _pbar.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 操作条右侧状态文字的最大显示宽度:取各操作最长文案的实测宽度(160~280 之间夹取),
|
||||
/// 保证常规状态既不折行、也不省略尾部计数。更长的文案(如「Area 修正完成…(详见日志)」)
|
||||
/// 只省略尾巴——它们的数字在开头,不受影响。
|
||||
/// </summary>
|
||||
private static int StatusLabelWidth()
|
||||
{
|
||||
string[] samples =
|
||||
{
|
||||
"完成 999/999", // 导入结束:只报总数,分布交给右侧胶囊
|
||||
"补挂完成: 挂接 99 / 已有父跳过 99 / 失败 0" // 补挂父项:最长的一条常规状态
|
||||
};
|
||||
int w = 0;
|
||||
foreach (var s in samples) w = Math.Max(w, Theme.TextWidth(s, Theme.Caption));
|
||||
return Math.Min(Theme.Px(280), Math.Max(Theme.Px(160), w + Theme.Px(8)));
|
||||
}
|
||||
|
||||
// --- 日志抽屉 ---
|
||||
private void BuildCardLog()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user