Files
mapo-iob-man/IOB-MAN/FluxLogData.cs
T
2025-06-17 09:15:06 +02:00

78 lines
2.1 KiB
C#

using IOB_MAN.Components.Pages;
using IOB_MAN.Core.Services;
using Microsoft.AspNetCore.Components.WebView.WindowsForms;
using Microsoft.Extensions.DependencyInjection;
using NLog;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace IOB_MAN
{
public partial class FluxLogData : Form
{
#region Public Constructors
/// <summary>
/// Init classe intestata sul codIOB corretto
/// </summary>
/// <param name="CodIOB"></param>
public FluxLogData(FluxLogManService mainFLMService, string CodIOB)
{
InitializeComponent();
codIob = CodIOB;
FLMService = mainFLMService;
InitBlazorView();
}
#endregion Public Constructors
#region Private Fields
/// <summary>
/// Classe logger
/// </summary>
private static Logger Log = LogManager.GetCurrentClassLogger();
private string codIob = "";
#endregion Private Fields
#region Private Properties
private static FluxLogManService FLMService { get; set; } = null!;
#endregion Private Properties
#region Private Methods
private void InitBlazorView()
{
Stopwatch sw = new Stopwatch();
sw.Start();
try
{
var services = new ServiceCollection();
services.AddWindowsFormsBlazorWebView();
services.AddSingleton<FluxLogManService>(FLMService);
blazorWebView1.HostPage = "wwwroot\\index.html";
blazorWebView1.Services = services.BuildServiceProvider();
blazorWebView1.RootComponents.Add<MainBlazor>("#app");
blazorWebView1.StartPath = $"/FlogDetail/{codIob}";
}
catch (Exception exc)
{
Log.Error($"Exception during setartup{Environment.NewLine}{exc}");
}
}
#endregion Private Methods
}
}