Add startup PP drill tape generation

This commit is contained in:
2026-05-21 13:16:39 +08:00
parent 951486202e
commit 25a7458db3
6 changed files with 200 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ namespace DrillTools
//System.Diagnostics.Debug.WriteLine("创建 MainWindowViewModel...");
var viewModel = new MainWindowViewModel();
//System.Diagnostics.Debug.WriteLine("MainWindowViewModel 创建完成");
viewModel.IsStartupDrillTapeFile = !string.IsNullOrEmpty(initialFilePath);
//System.Diagnostics.Debug.WriteLine("设置 DataContext...");
DataContext = viewModel;
@@ -76,6 +77,7 @@ namespace DrillTools
try
{
// 保存原始文件路径
viewModel.IsStartupDrillTapeFile = true;
viewModel.OriginalFilePath = filePath;
// 加载钻带内容
@@ -141,6 +143,7 @@ namespace DrillTools
try
{
// 保存原始文件路径
ViewModel.IsStartupDrillTapeFile = false;
ViewModel.OriginalFilePath = openFileDialog.FileName;
string drillTapeContent = CommandTypeFileReader.ReadAllText(openFileDialog.FileName);
@@ -217,6 +220,22 @@ namespace DrillTools
}
}
/// <summary>
/// 生成 PP 钻带按钮点击事件
/// </summary>
private void GeneratePpDrillTapeButton_Click(object sender, RoutedEventArgs e)
{
try
{
string outputFilePath = ViewModel.GeneratePpDrillTape();
System.Windows.MessageBox.Show($"PP钻带已生成\n{outputFilePath}", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch (Exception ex)
{
System.Windows.MessageBox.Show($"生成PP钻带失败: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
/// <summary>
/// 生成排序种子按钮点击事件
/// </summary>
@@ -327,6 +346,7 @@ namespace DrillTools
try
{
// 保存原始文件路径
ViewModel.IsStartupDrillTapeFile = false;
ViewModel.OriginalFilePath = files[0];
string drillTapeContent = CommandTypeFileReader.ReadAllText(files[0]);