Files
limanapp/EgwControlCenter.App/BlazorForm.cs
T
2024-09-21 10:26:46 +02:00

46 lines
1.3 KiB
C#

using EgwControlCenter.App.Components.Pages;
using EgwControlCenter.Core;
using Microsoft.AspNetCore.Components.WebView.WindowsForms;
using Microsoft.Extensions.DependencyInjection;
namespace EgwControlCenter.App
{
public partial class BlazorForm : Form
{
#region Public Constructors
public BlazorForm()
{
InitializeComponent();
InitBlazorView();
}
#endregion Public Constructors
#region Private Methods
private void BlazorForm_Load(object sender, EventArgs e)
{
SetPosition();
}
private void InitBlazorView()
{
var services = new ServiceCollection();
services.AddWindowsFormsBlazorWebView();
services.AddSingleton<AppControlService>();
blazorWebView1.HostPage = "wwwroot\\index.html";
blazorWebView1.Services = services.BuildServiceProvider();
blazorWebView1.RootComponents.Add<MainBlazor>("#app");
}
private void SetPosition()
{
// posiziono in basso a sx...
Rectangle workArea = Screen.GetWorkingArea(this);
this.Location = new Point(workArea.Right - Size.Width, workArea.Bottom - Size.Height);
}
#endregion Private Methods
}
}