2024-03-05 22:24:38 +04:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using NLog.Extensions.Logging;
|
|
|
|
using TransportCompanyBusinessLogic.BusinessLogics;
|
|
|
|
using TransportCompanyContracts.BusinessLogicsContracts;
|
|
|
|
using TransportCompanyContracts.StoragesContracts;
|
|
|
|
using TransportCompanyDatabaseImplement.Implements;
|
|
|
|
using TransportCompanyView;
|
|
|
|
|
2024-02-24 11:50:48 +04:00
|
|
|
namespace TransportCompanyView
|
|
|
|
{
|
|
|
|
internal static class Program
|
|
|
|
{
|
2024-03-05 22:24:38 +04:00
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
2024-02-24 11:50:48 +04:00
|
|
|
/// <summary>
|
|
|
|
/// The main entry point for the application.
|
|
|
|
/// </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-03-05 22:24:38 +04:00
|
|
|
var services = new ServiceCollection();
|
|
|
|
ConfigureServices(services);
|
|
|
|
_serviceProvider = services.BuildServiceProvider();
|
|
|
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddLogging(option =>
|
|
|
|
{
|
|
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
|
|
option.AddNLog("nlog.config");
|
|
|
|
});
|
|
|
|
|
|
|
|
services.AddTransient<ICargoStorage, CargoStorage>();
|
|
|
|
services.AddTransient<IDriverStorage, DriverStorage>();
|
|
|
|
services.AddTransient<IPointStorage, PointStorage>();
|
|
|
|
services.AddTransient<ITransportationStorage, TransportationStorage>();
|
|
|
|
services.AddTransient<ITransportStorage, TransportStorage>();
|
|
|
|
services.AddTransient<ICargoLogic, CargoLogic>();
|
|
|
|
services.AddTransient<IDriverLogic, DriverLogic>();
|
|
|
|
services.AddTransient<IPointLogic, PointLogic>();
|
|
|
|
services.AddTransient<ITransportationLogic, TransportationLogic>();
|
|
|
|
services.AddTransient<ITransportLogic, TransportLogic>();
|
|
|
|
services.AddTransient<FormCargo>();
|
|
|
|
services.AddTransient<FormCargos>();
|
|
|
|
services.AddTransient<FormDriver>();
|
|
|
|
services.AddTransient<FormDrivers>();
|
|
|
|
services.AddTransient<FormPoint>();
|
|
|
|
services.AddTransient<FormPoints>();
|
|
|
|
services.AddTransient<FormTransport>();
|
|
|
|
services.AddTransient<FormTransports>();
|
|
|
|
services.AddTransient<FormCreateTransportation>();
|
|
|
|
services.AddTransient<FormMain>();
|
|
|
|
|
2024-02-24 11:50:48 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|