Add project files.

This commit is contained in:
2023-08-07 09:18:08 +02:00
parent 7542685963
commit 1f39c39d96
10 changed files with 374 additions and 0 deletions

36
WinFormDi/Program.cs Normal file
View File

@ -0,0 +1,36 @@
using DIDemoLib;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace WinFormDi
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
var host = ContainerConfig.Configure();
using var scope = host.Services.CreateScope();
try
{
var services = scope.ServiceProvider;
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.SetHighDpiMode(HighDpiMode.SystemAware);
var frm = services.GetRequiredService<MainWindow>();
Application.Run(frm);
}
catch (Exception ex)
{
Console.WriteLine($"An error has occured: {ex.Message}");
}
}
}
}