using DIDemoLib; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; namespace WinFormDi { internal static class Program { /// /// The main entry point for the application. /// [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(); Application.Run(frm); } catch (Exception ex) { Console.WriteLine($"An error has occured: {ex.Message}"); } } } }