新增应用程序图标并优化界面与匹配逻辑

- 增加 复制.ico 作为应用图标,并在项目文件中配置 ApplicationIcon。
- 修正 MatchFolderName 数字编号截取索引,保证匹配准确。
- 调整主窗口高度为 645,优化界面体验。
- LogTextBox 允许编辑(去除 IsReadOnly)。
- 处理单个料号时回车后自动聚焦输入框,提升操作流畅度。
- 代码格式优化,提升可读性。
This commit is contained in:
2025-12-29 16:41:44 +08:00
parent 18a2c9b4b2
commit 0a534e7e08
5 changed files with 44 additions and 39 deletions

View File

@@ -27,7 +27,7 @@ namespace CopyRou
_fileService = new FileService();
_logger = new Logger();
_config = AppConfig.Load();
InitializeUI();
SubscribeToEvents();
}
@@ -37,7 +37,7 @@ namespace CopyRou
// 加载配置到UI
SourcePathsTextBox.Text = _config.GetSourcePathsText();
DestPathTextBox.Text = _config.DestPath;
// 设置初始状态
StartButton.IsEnabled = true;
ProgressBar.Value = 0;
@@ -102,7 +102,7 @@ namespace CopyRou
});
await _fileService.ProcessCodes(materialNumbers, sourcePaths, destPath, progress, _logger);
_logger.Log("=== 处理完成 ===");
System.Windows.MessageBox.Show("处理完成!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
@@ -130,7 +130,7 @@ namespace CopyRou
_config.SetSourcePathsFromText(SourcePathsTextBox.Text);
_config.DestPath = DestPathTextBox.Text;
_config.Save();
System.Windows.MessageBox.Show("配置已保存", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
@@ -138,7 +138,7 @@ namespace CopyRou
{
var dialog = new System.Windows.Forms.FolderBrowserDialog();
dialog.Description = "选择源路径";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
var currentPaths = GetSourcePaths();
@@ -154,7 +154,7 @@ namespace CopyRou
{
var dialog = new System.Windows.Forms.FolderBrowserDialog();
dialog.Description = "选择目标路径";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
DestPathTextBox.Text = dialog.SelectedPath;
@@ -179,6 +179,7 @@ namespace CopyRou
if (e.Key == System.Windows.Input.Key.Enter)
{
ProcessSingleCode();
SingleCodeTextBox.Focus();
}
}
@@ -249,12 +250,12 @@ namespace CopyRou
});
await _fileService.ProcessCodes(materialNumbers, sourcePaths, destPath, progress, _logger);
_logger.Log("=== 单个料号处理完成 ===");
// 清空输入框
SingleCodeTextBox.Clear();
// 将焦点返回到输入框,方便继续输入
SingleCodeTextBox.Focus();
}
@@ -277,7 +278,7 @@ namespace CopyRou
_config.SetSourcePathsFromText(SourcePathsTextBox.Text);
_config.DestPath = DestPathTextBox.Text;
_config.Save();
base.OnClosed(e);
}
}