Files
StockInfoCoreApp/StockInfoCore/Program.cs
2021-05-09 22:10:25 +02:00

50 lines
1.2 KiB
C#

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace StockInfoCore
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
var builder = new HostBuilder()
.ConfigureServices((_, services) =>
{
services.AddDIInfo();
});
var host = builder.Build();
using var scope = host.Services.CreateScope();
try
{
var services = scope.ServiceProvider;
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var frm = services.GetRequiredService<frmInitial>();
Application.Run(frm);
}
catch (Exception ex)
{
Console.WriteLine($"An error has occured: { ex.Message}");
}
}
}
}