PIbd-23_Bakshaeva_E.A._Moto.../MotorPlant/MotorPlantView/Program.cs

51 lines
1.9 KiB
C#
Raw Normal View History

2024-02-28 14:16:56 +04:00
using MotorPlantBusinessLogics.BusinessLogics;
using MotorPlantContracts.BusinessLogicsContracts;
using MotorPlantContracts.StoragesContracts;
using MotorPlantListImplement.Implements;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
2024-03-13 19:12:28 +04:00
using System;
2024-02-28 14:16:56 +04:00
namespace MotorPlantView
2024-02-14 12:09:20 +04:00
{
internal static class Program
{
2024-02-28 14:16:56 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-02-14 12:09:20 +04:00
[STAThread]
static void Main()
{
2024-03-13 19:12:28 +04:00
ApplicationConfiguration.Initialize();
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
2024-02-28 14:16:56 +04:00
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IEngineStorage, EngineStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IEngineLogic, EngineLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormEngine>();
services.AddTransient<FormEngineComponent>();
2024-03-13 19:12:28 +04:00
services.AddTransient<FormEngines>();
2024-02-14 12:09:20 +04:00
}
}
}