Archived
deploy webservice static-file routing for docsite folder URLs, per-instance step-cache db, and constant-height panel title bars.
This commit is contained in:
@@ -156,6 +156,7 @@ execute NC files, and properly manage project resources using
|
||||
using Hi.Common.Messages;
|
||||
using Hi.HiNcKits;
|
||||
using Hi.MachiningProcs;
|
||||
using Hi.NcParsers;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -191,17 +192,22 @@ public static class DemoUseMachiningProject
|
||||
Console.WriteLine($"Set message event.");
|
||||
|
||||
using StreamWriter writer = new StreamWriter("msg.txt");
|
||||
//show message if something abnormal.
|
||||
localProjectService.SessionProgress.CollectionItemAdded += pack =>
|
||||
{
|
||||
if (pack.Tags.Contains(MessageFlag.Warning.ToString()) ||
|
||||
pack.Tags.Contains(MessageFlag.Error.ToString()) ||
|
||||
pack.Tags.Contains(MessageFlag.Exception.ToString()))
|
||||
{
|
||||
var sourceCommand = pack.SourceCommand;
|
||||
writer.WriteLine($"{pack.Message} At \"{sourceCommand?.FilePath}\" (Line {sourceCommand?.GetLineNo()}) \"{sourceCommand?.Line}\"");
|
||||
}
|
||||
};
|
||||
//show message if something abnormal, from each partitioned message sink:
|
||||
//shell (session lifecycle), NC diagnostics, and step-anchored diagnostics.
|
||||
void LogIfAbnormal(IMessage message, ISentenceCarrier sentenceCarrier)
|
||||
{
|
||||
var severity = message.GetSeverity();
|
||||
if (severity != Severity.Warning && severity != Severity.Error)
|
||||
return;
|
||||
var ncLine = sentenceCarrier?.GetSentence()?.FirstIndexedFileLine;
|
||||
writer.WriteLine($"{message.GetNotification()} At \"{ncLine?.FilePath}\" (Line {ncLine?.GetLineNo()}) \"{ncLine?.Line}\"");
|
||||
}
|
||||
localProjectService.OnShellMessageAdded += (index, message)
|
||||
=> LogIfAbnormal(message, null);
|
||||
localProjectService.NcDiagnosticProgress.MessageAdded += (index, diagnostic)
|
||||
=> LogIfAbnormal(diagnostic, diagnostic.SentenceCarrier);
|
||||
localProjectService.StepDiagnosticProgress.MessageAdded += (index, diagnostic)
|
||||
=> LogIfAbnormal(diagnostic, diagnostic.SentenceCarrier);
|
||||
Console.WriteLine($"Set machining step event.");
|
||||
//show MRR.
|
||||
localProjectService.SessionShell.SessionStepBuilt += (preStep, curStep) =>
|
||||
|
||||
Reference in New Issue
Block a user