36 lines
982 B
C#
36 lines
982 B
C#
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}");
|
|
}
|
|
|
|
}
|
|
}
|
|
} |