52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using Microsoft.Extensions.Configuration;
|
|
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
|
|
{
|
|
public static IConfiguration Configuration;
|
|
/// <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}");
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|