2024-02-21 10:36:30 +04:00
|
|
|
using AutoWorkshopContracts.BusinessLogicContracts;
|
|
|
|
using AutoWorkshopContracts.StoragesContracts;
|
|
|
|
using AutoWorkshopView.Forms;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
2024-02-20 23:51:24 +04:00
|
|
|
namespace AutoWorkshopView
|
2024-02-06 22:59:42 +04:00
|
|
|
{
|
|
|
|
internal static class Program
|
|
|
|
{
|
2024-02-21 10:36:30 +04:00
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
|
|
|
2024-02-06 22:59:42 +04:00
|
|
|
[STAThread]
|
|
|
|
static void Main()
|
|
|
|
{
|
2024-02-21 10:36:30 +04:00
|
|
|
var Services = new ServiceCollection();
|
|
|
|
ConfigureServices(Services);
|
|
|
|
|
|
|
|
_serviceProvider = Services.BuildServiceProvider();
|
|
|
|
|
|
|
|
Application.Run(_serviceProvider.GetRequiredService<MainForm>());
|
|
|
|
}
|
|
|
|
|
|
|
|
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<IIceCreamStorage, IceCreamStorage>();
|
|
|
|
Services.AddTransient<IComponentLogic, ComponentLogic>();
|
|
|
|
Services.AddTransient<IOrderLogic, OrderLogic>();
|
|
|
|
Services.AddTransient<IIceCreamLogic, IceCreamLogic>();
|
|
|
|
Services.AddTransient<MainForm>();
|
|
|
|
Services.AddTransient<ComponentForm>();
|
|
|
|
Services.AddTransient<ComponentsForm>();
|
|
|
|
Services.AddTransient<OrderForm>();
|
|
|
|
Services.AddTransient<IceCreamForm>();
|
|
|
|
Services.AddTransient<IceCreamComponentForm>();
|
|
|
|
Services.AddTransient<IceCreamsForm>();
|
2024-02-06 22:59:42 +04:00
|
|
|
}
|
|
|
|
}
|
2024-02-20 23:51:24 +04:00
|
|
|
}
|