Add project files.
This commit is contained in:
49
StockInfoCore/Program.cs
Normal file
49
StockInfoCore/Program.cs
Normal file
@ -0,0 +1,49 @@
|
||||
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}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user