refactor(Sample.Wpf): adapt demos for SessionStepBuilt/WorkpieceService/CatchExceptions changes

Made-with: Cursor
This commit is contained in:
iamboss 2026-04-14 17:18:05 +08:00
parent 58f3a19232
commit da83e59432
3 changed files with 6 additions and 2 deletions

View File

@ -2,6 +2,7 @@
using Hi.HiNcKits;
using Hi.Licenses;
using Hi.WpfPlus.Disp;
using Microsoft.Extensions.Logging;
using System.Windows;
namespace Sample.Disp;

View File

@ -7,6 +7,7 @@ using Hi.MachiningProcs;
using Hi.Numerical.Acts;
using Hi.WpfPlus.Disp;
using HiMachining.Milling;
using Microsoft.Extensions.Logging;
using System;
using System.IO;
using System.Threading.Tasks;

View File

@ -5,6 +5,7 @@ using Hi.Common.FileLines;
using System.Windows;
using Hi.MachiningSteps;
using Hi.HiNcKits;
using Microsoft.Extensions.Logging;
namespace Sample.Machining
{
@ -32,10 +33,11 @@ namespace Sample.Machining
localProjectService.LoadProject(projectPath);
MachiningProject machiningProject = localProjectService.MachiningProject;
localProjectService.RuntimeApi.MachiningStepSelected += (MachiningStep step) =>
localProjectService.RuntimeApi.SessionStepSelected += (MachiningStep step) =>
{
var sourceCommand = step.SourceCommand;
Console.WriteLine($"Step Selected: MRR = {step.Mrr_mm3ds} At \"{sourceCommand?.FilePath}\" (Line {sourceCommand?.GetLineNo()}) \"{sourceCommand?.Line}\"");
var indexedFileLine = sourceCommand.GetSentence().FirstIndexedFileLine;
Console.WriteLine($"Step Selected: MRR = {step.Mrr_mm3ds} At \"{indexedFileLine?.FilePath}\" (Line {indexedFileLine?.GetLineNo()}) \"{indexedFileLine?.Line}\"");
};
localProjectService.PacePlayer.Start();
#endregion