refactor(demos): DemoSessionMessage reads IMessage instead of MultiTagMessage
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5ed0c3311e
commit
6f0cb1bc1c
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using Hi.Common;
|
using Hi.Common;
|
||||||
using Hi.Common.FileLines;
|
using Hi.Common.FileLines;
|
||||||
|
using Hi.Common.Messages;
|
||||||
using Hi.Geom;
|
using Hi.Geom;
|
||||||
using Hi.HiNcKits;
|
using Hi.HiNcKits;
|
||||||
using Hi.MachiningProcs;
|
using Hi.MachiningProcs;
|
||||||
@ -24,12 +25,12 @@ public static class DemoSessionMessage
|
|||||||
#region Demo_UseSessionMessageHost
|
#region Demo_UseSessionMessageHost
|
||||||
internal static void DemoUseSessionMessageHost(LocalProjectService localProjectService)
|
internal static void DemoUseSessionMessageHost(LocalProjectService localProjectService)
|
||||||
{
|
{
|
||||||
SessionProgress sessionMessageHost = localProjectService.SessionProgress;
|
MixedProgress0 sessionMessageHost = localProjectService.MixedProgress;
|
||||||
|
|
||||||
SessionProgress.FilterFlag filterFlags =
|
MixedProgress0.FilterFlag filterFlags =
|
||||||
SessionProgress.FilterFlag.NC |
|
MixedProgress0.FilterFlag.NC |
|
||||||
SessionProgress.FilterFlag.Progress |
|
MixedProgress0.FilterFlag.Progress |
|
||||||
SessionProgress.FilterFlag.Error;
|
MixedProgress0.FilterFlag.Error;
|
||||||
string filterText = null;
|
string filterText = null;
|
||||||
var filteredSessionMessageList = sessionMessageHost
|
var filteredSessionMessageList = sessionMessageHost
|
||||||
.GetFliteredList(filterFlags, filterText);
|
.GetFliteredList(filterFlags, filterText);
|
||||||
@ -45,9 +46,8 @@ public static class DemoSessionMessage
|
|||||||
Console.Write($"Message/NC: {nc.Line}; File: {nc.FilePath}; LineNo: {nc.GetLineNo()}; ");
|
Console.Write($"Message/NC: {nc.Line}; File: {nc.FilePath}; LineNo: {nc.GetLineNo()}; ");
|
||||||
|
|
||||||
// For SessionMessageHost.FilterFlag.Progress or Error.
|
// For SessionMessageHost.FilterFlag.Progress or Error.
|
||||||
var multiTagMessage = sessionMessage.MultiTagMessage;
|
if (sessionMessage.Data is IMessage message)
|
||||||
if (multiTagMessage != null)
|
Console.WriteLine($"Message/NC: {message.GetNotification()}");
|
||||||
Console.WriteLine($"Message/NC: {multiTagMessage.Message}");
|
|
||||||
var exception = sessionMessage.Exception;
|
var exception = sessionMessage.Exception;
|
||||||
if (exception != null)
|
if (exception != null)
|
||||||
Console.WriteLine($"Message/NC: {exception.Message}");
|
Console.WriteLine($"Message/NC: {exception.Message}");
|
||||||
@ -60,7 +60,7 @@ public static class DemoSessionMessage
|
|||||||
|
|
||||||
internal static void DemoUseSessionMessageHost2(LocalProjectService localProjectService)
|
internal static void DemoUseSessionMessageHost2(LocalProjectService localProjectService)
|
||||||
{
|
{
|
||||||
SessionProgress sessionMessageHost = localProjectService.SessionProgress;
|
MixedProgress0 sessionMessageHost = localProjectService.MixedProgress;
|
||||||
IMachiningChain machiningChain = localProjectService.MachiningChain;
|
IMachiningChain machiningChain = localProjectService.MachiningChain;
|
||||||
|
|
||||||
PresentAttribute mrrPresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.Mrr_mm3ds)).GetCustomAttribute<PresentAttribute>();
|
PresentAttribute mrrPresent = typeof(MachiningStep).GetProperty(nameof(MachiningStep.Mrr_mm3ds)).GetCustomAttribute<PresentAttribute>();
|
||||||
@ -70,11 +70,11 @@ public static class DemoSessionMessage
|
|||||||
string torqueUnit = torquePresent?.TailUnitString;
|
string torqueUnit = torquePresent?.TailUnitString;
|
||||||
string torqueFormat = torquePresent?.DataFormatString;
|
string torqueFormat = torquePresent?.DataFormatString;
|
||||||
|
|
||||||
SessionProgress.FilterFlag filterFlags =
|
MixedProgress0.FilterFlag filterFlags =
|
||||||
SessionProgress.FilterFlag.Step |
|
MixedProgress0.FilterFlag.Step |
|
||||||
SessionProgress.FilterFlag.NC |
|
MixedProgress0.FilterFlag.NC |
|
||||||
SessionProgress.FilterFlag.Progress |
|
MixedProgress0.FilterFlag.Progress |
|
||||||
SessionProgress.FilterFlag.Error;
|
MixedProgress0.FilterFlag.Error;
|
||||||
string filterText = null;
|
string filterText = null;
|
||||||
var filteredSessionMessageList = sessionMessageHost
|
var filteredSessionMessageList = sessionMessageHost
|
||||||
.GetFliteredList(filterFlags, filterText);
|
.GetFliteredList(filterFlags, filterText);
|
||||||
@ -106,9 +106,8 @@ public static class DemoSessionMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For SessionMessageHost.FilterFlag.Progress or Error.
|
// For SessionMessageHost.FilterFlag.Progress or Error.
|
||||||
var multiTagMessage = sessionMessage.MultiTagMessage;
|
if (sessionMessage.Data is IMessage message)
|
||||||
if (multiTagMessage != null)
|
Console.WriteLine($"Message/NC: {message.GetNotification()}");
|
||||||
Console.WriteLine($"Message/NC: {multiTagMessage.Message}");
|
|
||||||
var exception = sessionMessage.Exception;
|
var exception = sessionMessage.Exception;
|
||||||
if (exception != null)
|
if (exception != null)
|
||||||
Console.WriteLine($"Message/NC: {exception.Message}");
|
Console.WriteLine($"Message/NC: {exception.Message}");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user