diff --git a/Common/DemoMessageAndExceptionHandling.cs b/Common/DemoMessageAndExceptionHandling.cs
deleted file mode 100644
index b34dcd9..0000000
--- a/Common/DemoMessageAndExceptionHandling.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using System.Threading.Tasks;
-using Hi.Common;
-using Hi.Common.Messages;
-
-namespace Sample.Common;
-
-///
-/// Demonstrates common message and exception handling patterns in HiAPI applications
-///
-///
-/// ### Source Code
-/// [!code-csharp[SampleCode](~/../Hi.Sample/Common/DemoMessageAndExceptionHandling.cs)]
-///
-public static class DemoMessageAndExceptionHandling
-{
- ///
- /// Demonstrates normal message handling
- ///
- internal static void DemoNormalMessages()
- {
- #region Normal_Messages
- MessageUtil.ReportMessage("Operation completed successfully.");
- MessageUtil.ReportWarning("Please check your input.");
- #endregion
- }
- ///
- /// Demonstrates exception handling in synchronous code
- ///
- internal static void DemoSynchronousExceptionHandling()
- {
- #region Sync_Exception
- try
- {
- // Your code here
- throw new NotImplementedException("Demo exception");
- }
- catch (Exception ex)
- {
- ExceptionUtil.ShowException(ex, null);
- }
- #endregion
- }
- ///
- /// Demonstrates exception handling in asynchronous code
- ///
- internal static async Task DemoAsynchronousExceptionHandling()
- {
- #region Async_Exception
- await Task.Run(() =>
- {
- // Your async operation here
- throw new NotImplementedException("Demo async exception");
- }).ShowIfCatched(null);
- #endregion
- }
-}
\ No newline at end of file
diff --git a/HelloHiAPI.cs b/HelloHiAPI.cs
index 05f80e4..772a908 100644
--- a/HelloHiAPI.cs
+++ b/HelloHiAPI.cs
@@ -18,7 +18,8 @@ namespace Sample
static int Main(string[] args)
{
Console.WriteLine("HiAPI starting.");
- LocalApp.AppBegin();
+ using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b => b.AddConsole());
+ LocalApp.AppBegin(loggerFactory.CreateLogger("Hi.Sample"));
Console.WriteLine("Hello World! HiAPI.");
diff --git a/Machining/DemoBuildGeomOnlyMachiningProject.cs b/Machining/DemoBuildGeomOnlyMachiningProject.cs
index 9d05b29..16774fe 100644
--- a/Machining/DemoBuildGeomOnlyMachiningProject.cs
+++ b/Machining/DemoBuildGeomOnlyMachiningProject.cs
@@ -42,7 +42,8 @@ public static class DemoBuildGeomOnlyMachiningProject
static void Main()
{
- LocalApp.AppBegin();
+ using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b => b.AddConsole());
+ LocalApp.AppBegin(loggerFactory.CreateLogger("Hi.Sample"));
LocalProjectService localProjectService = new LocalProjectService();
var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
diff --git a/Machining/DemoBuildMachiningProject.cs b/Machining/DemoBuildMachiningProject.cs
index c95e66d..a48f355 100644
--- a/Machining/DemoBuildMachiningProject.cs
+++ b/Machining/DemoBuildMachiningProject.cs
@@ -142,7 +142,8 @@ public static class DemoBuildMachiningProject
[STAThread]
static void Main()
{
- LocalApp.AppBegin();
+ using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b => b.AddConsole());
+ LocalApp.AppBegin(loggerFactory.CreateLogger("Hi.Sample"));
LocalProjectService localProjectService = new LocalProjectService();
var projectPath = "C:/HiNC-Projects/NewProject/Main.hincproj";
diff --git a/Machining/DemoUseMachiningProject.cs b/Machining/DemoUseMachiningProject.cs
index 82bd88a..bc65eb7 100644
--- a/Machining/DemoUseMachiningProject.cs
+++ b/Machining/DemoUseMachiningProject.cs
@@ -21,7 +21,8 @@ public static class DemoUseMachiningProject
{
static void Main()
{
- LocalApp.AppBegin();
+ using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b => b.AddConsole());
+ LocalApp.AppBegin(loggerFactory.CreateLogger("Hi.Sample"));
LocalProjectService localProjectService = new LocalProjectService();
#region ProjectLoading