Update commenti x test doxygen
This commit is contained in:
+49
-5
@@ -1,4 +1,16 @@
|
||||
using IOB_MAN.Core.Services;
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <param name="CodIOB"></param>
|
||||
/// <param name="mainFLMService">Service providing access to flux log data and operations.</param>
|
||||
/// <param name="CodIOB">The IOB code (e.g., "PLC001") for which detailed logs are requested.</param>
|
||||
public FluxLogData(FluxLogManService mainFLMService, string CodIOB)
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -27,22 +46,44 @@ namespace IOB_MAN
|
||||
#region Private Fields
|
||||
|
||||
/// <summary>
|
||||
/// Classe logger
|
||||
/// Logger instance for structured logging within this form.
|
||||
/// Used to capture errors during startup or UI rendering.
|
||||
/// </summary>
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// The IOB code (e.g., "PLC001") associated with the logs being displayed.
|
||||
/// Used to route the correct data in the Blazor component.
|
||||
/// </summary>
|
||||
private string codIob = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Injected service for managing flux log operations.
|
||||
/// Responsible for retrieving, filtering, and presenting log data.
|
||||
/// </summary>
|
||||
private static FluxLogManService FLMService { get; set; } = null!;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
private void InitBlazorView()
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
@@ -52,14 +93,17 @@ namespace IOB_MAN
|
||||
var services = new ServiceCollection();
|
||||
services.AddWindowsFormsBlazorWebView();
|
||||
services.AddSingleton<FluxLogManService>(FLMService);
|
||||
|
||||
blazorWebView1.HostPage = "wwwroot\\index.html";
|
||||
blazorWebView1.Services = services.BuildServiceProvider();
|
||||
blazorWebView1.RootComponents.Add<MainBlazor>("#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}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user