PIbd-21_Shanygin_A.V_Garmen.../GarmentFactory/GarmentFactoryView/Program.cs

49 lines
1.9 KiB
C#
Raw Normal View History

2024-03-11 00:46:45 +04:00
using GarmentFactoryBusinessLogic.BusinessLogics;
using GarmentFactoryContracts.BusinessLogicsContracts;
using GarmentFactoryContracts.StoragesContracts;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
2024-03-19 23:39:33 +04:00
using GarmentFactoryDatabaseImplement.Implements;
2024-03-11 00:46:45 +04:00
using System.Drawing;
2024-03-11 00:36:15 +04:00
namespace GarmentFactoryView
{
internal static class Program
{
2024-03-11 00:46:45 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-03-11 00:36:15 +04:00
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
2024-03-11 00:46:45 +04:00
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
2024-03-11 00:36:15 +04:00
}
2024-03-11 00:46:45 +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<ITextileStorage, TextileStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<ITextileLogic, TextileLogic>();
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormTextile>();
services.AddTransient<FormTextileComponent>();
services.AddTransient<FormTextiles>();
}
2024-03-11 00:36:15 +04:00
}
2024-03-11 00:46:45 +04:00
}