diff --git a/IOB-MAN/FluxLogData.cs b/IOB-MAN/FluxLogData.cs
index 068db78..9f0e05d 100644
--- a/IOB-MAN/FluxLogData.cs
+++ b/IOB-MAN/FluxLogData.cs
@@ -1,4 +1,16 @@
-using IOB_MAN.Core.Services;
+///
+/// Dedicated Windows Forms form for viewing detailed flux log data of a specific IOB (Industrial Operation Block).
+///
+/// This component serves as a specialized viewer that loads a Blazor-based UI to display real-time or historical flux logs
+/// for a given IOB (e.g., PLC, HMI) using a specific CodIOB.
+///
+/// Key Features:
+/// - Takes a CodIOB (code identifier) and a FluxLogManService instance to initialize the view.
+/// - Hosts a Blazor WebAssembly UI via Windows Forms BlazorWebView.
+/// - Loads a route in the Blazor app (e.g., /FlogDetail/{codIob}) to display logs for the selected IOB.
+/// - Provides a focused, isolated environment for log inspection without interfering with the main dashboard.
+///
+using IOB_MAN.Core.Services;
using Microsoft.AspNetCore.Components.WebView.WindowsForms;
using Microsoft.Extensions.DependencyInjection;
using NLog;
@@ -11,9 +23,16 @@ namespace IOB_MAN
#region Public Constructors
///
- /// Init classe intestata sul codIOB corretto
+ /// Initializes a new instance of the FluxLogData form.
+ ///
+ /// Parameters:
+ /// - mainFLMService: The FluxLogManService instance responsible for managing log data and access.
+ /// - CodIOB: The unique identifier (code) of the IOB for which logs are being viewed.
+ ///
+ /// Initializes the form, sets the IOB code, and configures the Blazor view to display logs.
///
- ///
+ /// Service providing access to flux log data and operations.
+ /// The IOB code (e.g., "PLC001") for which detailed logs are requested.
public FluxLogData(FluxLogManService mainFLMService, string CodIOB)
{
InitializeComponent();
@@ -27,22 +46,44 @@ namespace IOB_MAN
#region Private Fields
///
- /// Classe logger
+ /// Logger instance for structured logging within this form.
+ /// Used to capture errors during startup or UI rendering.
///
private static Logger Log = LogManager.GetCurrentClassLogger();
+ ///
+ /// The IOB code (e.g., "PLC001") associated with the logs being displayed.
+ /// Used to route the correct data in the Blazor component.
+ ///
private string codIob = "";
#endregion Private Fields
#region Private Properties
+ ///
+ /// Injected service for managing flux log operations.
+ /// Responsible for retrieving, filtering, and presenting log data.
+ ///
private static FluxLogManService FLMService { get; set; } = null!;
#endregion Private Properties
#region Private Methods
+ ///
+ /// Initializes the Blazor WebView to display detailed flux log data for the specified IOB.
+ ///
+ /// Steps:
+ /// 1. Creates a ServiceCollection and adds the BlazorWebView support.
+ /// 2. Registers the FluxLogManService as a singleton to provide log data access.
+ /// 3. Sets the host page to index.html.
+ /// 4. Configures the root component to render MainBlazor within the "#app" element.
+ /// 5. Sets the initial navigation path to /FlogDetail/{codIob} so the Blazor app loads the correct log view.
+ ///
+ /// Exception Handling:
+ /// - Catches any startup errors and logs them for debugging.
+ ///
private void InitBlazorView()
{
Stopwatch sw = new Stopwatch();
@@ -52,14 +93,17 @@ namespace IOB_MAN
var services = new ServiceCollection();
services.AddWindowsFormsBlazorWebView();
services.AddSingleton(FLMService);
+
blazorWebView1.HostPage = "wwwroot\\index.html";
blazorWebView1.Services = services.BuildServiceProvider();
blazorWebView1.RootComponents.Add("#app");
+
+ // Navigate to the detailed log page for the selected IOB
blazorWebView1.StartPath = $"/FlogDetail/{codIob}";
}
catch (Exception exc)
{
- Log.Error($"Exception during setartup{Environment.NewLine}{exc}");
+ Log.Error($"Exception during startup{Environment.NewLine}{exc}");
}
}