2024-04-08 21:11:09 +04:00
|
|
|
|
using ComputersShopBusinessLogic.BusinessLogics;
|
2024-03-26 20:07:16 +04:00
|
|
|
|
using ComputersShopContracts.BusinessLogicsContracts;
|
2024-02-27 11:54:31 +04:00
|
|
|
|
using ComputersShopContracts.StoragesContracts;
|
2024-05-05 16:59:47 +04:00
|
|
|
|
using ComputersShopFileImplement.Implements;
|
2024-04-08 21:11:09 +04:00
|
|
|
|
using ComputersShopView;
|
2024-02-27 11:54:31 +04:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NLog.Extensions.Logging;
|
|
|
|
|
using System;
|
|
|
|
|
|
2024-02-13 21:31:29 +04:00
|
|
|
|
namespace ComputersShopView
|
|
|
|
|
{
|
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
2024-04-08 21:11:09 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// IoC-êîíòåéíåð
|
|
|
|
|
/// </summary>
|
2024-02-27 11:54:31 +04:00
|
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
2024-04-08 21:11:09 +04:00
|
|
|
|
|
2024-02-13 21:31:29 +04:00
|
|
|
|
/// <summary>
|
2024-04-08 21:11:09 +04:00
|
|
|
|
/// The main entry point for the application.
|
2024-02-13 21:31:29 +04:00
|
|
|
|
/// </summary>
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
|
|
|
|
// To customize application configuration such as set high DPI settings or default font,
|
|
|
|
|
// see https://aka.ms/applicationconfiguration.
|
|
|
|
|
ApplicationConfiguration.Initialize();
|
2024-04-08 21:11:09 +04:00
|
|
|
|
|
2024-02-27 11:54:31 +04:00
|
|
|
|
var services = new ServiceCollection();
|
|
|
|
|
ConfigureServices(services);
|
|
|
|
|
_serviceProvider = services.BuildServiceProvider();
|
2024-04-08 21:11:09 +04:00
|
|
|
|
|
2024-02-27 11:54:31 +04:00
|
|
|
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
|
|
|
|
}
|
2024-04-08 21:11:09 +04:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Íàñòðîéêà IoC-êîíòåéíåðà è ëîããåðà
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="services"></param>
|
2024-02-27 11:54:31 +04:00
|
|
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.AddLogging(option =>
|
|
|
|
|
{
|
|
|
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
|
|
|
option.AddNLog("nlog.config");
|
|
|
|
|
});
|
2024-04-08 21:11:09 +04:00
|
|
|
|
|
2024-02-27 11:54:31 +04:00
|
|
|
|
services.AddTransient<IComponentStorage, ComponentStorage>();
|
|
|
|
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
|
|
|
|
services.AddTransient<IComputerStorage, ComputerStorage>();
|
2024-04-08 21:11:09 +04:00
|
|
|
|
services.AddTransient<IShopStorage, ShopStorage>();
|
|
|
|
|
|
2024-02-27 11:54:31 +04:00
|
|
|
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
|
|
|
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
|
|
|
|
services.AddTransient<IComputerLogic, ComputerLogic>();
|
2024-03-26 20:07:16 +04:00
|
|
|
|
services.AddTransient<IShopLogic, ShopLogic>();
|
2024-04-08 21:11:09 +04:00
|
|
|
|
|
2024-02-27 11:54:31 +04:00
|
|
|
|
services.AddTransient<FormMain>();
|
|
|
|
|
services.AddTransient<FormComponent>();
|
|
|
|
|
services.AddTransient<FormComponents>();
|
|
|
|
|
services.AddTransient<FormCreateOrder>();
|
|
|
|
|
services.AddTransient<FormComputer>();
|
|
|
|
|
services.AddTransient<FormComputerComponent>();
|
|
|
|
|
services.AddTransient<FormComputers>();
|
2024-03-26 20:07:16 +04:00
|
|
|
|
services.AddTransient<FormShops>();
|
2024-04-08 21:11:09 +04:00
|
|
|
|
services.AddTransient<FormShop>();
|
2024-03-26 20:07:16 +04:00
|
|
|
|
services.AddTransient<FormSupply>();
|
2024-05-05 16:09:41 +04:00
|
|
|
|
services.AddTransient<FormSell>();
|
2024-02-13 21:31:29 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|