38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using NLog.Extensions.Logging;
|
|
|
|
namespace ProjectMonorail
|
|
{
|
|
internal static class Program
|
|
{
|
|
/// <summary>
|
|
/// The main entry point for the application.
|
|
/// </summary>
|
|
[STAThread]
|
|
private static void Main()
|
|
{
|
|
ApplicationConfiguration.Initialize();
|
|
|
|
ServiceCollection services = new ServiceCollection();
|
|
ConfigureServices(services);
|
|
using ServiceProvider serviceProvider = services.BuildServiceProvider();
|
|
|
|
Application.Run(serviceProvider.GetRequiredService<FormMonorailCollection>());
|
|
}
|
|
|
|
/// <summary>
|
|
/// Êîíôèãóðàöèÿ ñåðâèñà DI
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
{
|
|
services.AddSingleton<FormMonorailCollection>()
|
|
.AddLogging(option =>
|
|
{
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
option.AddNLog("nlog.config");
|
|
});
|
|
}
|
|
}
|
|
} |