89 lines
3.8 KiB
C#
89 lines
3.8 KiB
C#
using AutoWorkshopBusinessLogic.BusinessLogics;
|
|
using AutoWorkshopBusinessLogic.OfficePackage.Implements;
|
|
using AutoWorkshopBusinessLogic.OfficePackage;
|
|
using AutoWorkshopContracts.BusinessLogicContracts;
|
|
using AutoWorkshopView.Forms;
|
|
using Microsoft.Extensions.Logging;
|
|
using NLog.Extensions.Logging;
|
|
using AutoWorkshopContracts.BusinessLogicsContracts;
|
|
using AutoWorkshopBusinessLogic.MailWorker;
|
|
using AutoWorkshopContracts.BindingModels;
|
|
using AutoWorkshopContracts.DI;
|
|
|
|
namespace AutoWorkshopView
|
|
{
|
|
internal static class Program
|
|
{
|
|
[STAThread]
|
|
static void Main()
|
|
{
|
|
ApplicationConfiguration.Initialize();
|
|
InitDependency();
|
|
|
|
try
|
|
{
|
|
var MailSender = DependencyManager.Instance.Resolve<AbstractMailWorker>();
|
|
MailSender?.MailConfig(new MailConfigBindingModel
|
|
{
|
|
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
|
MailPassword = System.Configuration.ConfigurationManager.AppSettings["MailPassword"] ?? string.Empty,
|
|
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ?? string.Empty,
|
|
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClientPort"]),
|
|
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
|
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
|
|
});
|
|
|
|
var Timer = new System.Threading.Timer(new TimerCallback(MailCheck!), null, 0, 100000);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
var Logger = DependencyManager.Instance.Resolve<ILogger>();
|
|
Logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
|
|
}
|
|
|
|
Application.Run(DependencyManager.Instance.Resolve<MainForm>());
|
|
}
|
|
|
|
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.CheckMailAsync();
|
|
|
|
private static void InitDependency()
|
|
{
|
|
DependencyManager.InitDependency();
|
|
DependencyManager.Instance.AddLogging(Option =>
|
|
{
|
|
Option.SetMinimumLevel(LogLevel.Information);
|
|
Option.AddNLog("nlog.config");
|
|
});
|
|
|
|
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
|
|
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
|
DependencyManager.Instance.RegisterType<IRepairLogic, RepairLogic>();
|
|
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
|
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
|
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
|
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
|
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
|
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
|
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
|
|
|
DependencyManager.Instance.RegisterType<MainForm>();
|
|
DependencyManager.Instance.RegisterType<FormComponent>();
|
|
DependencyManager.Instance.RegisterType<FormComponents>();
|
|
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
|
DependencyManager.Instance.RegisterType<FormRepair>();
|
|
DependencyManager.Instance.RegisterType<FormRepairComponent>();
|
|
DependencyManager.Instance.RegisterType<FormRepairs>();
|
|
DependencyManager.Instance.RegisterType<FormReportRepairComponents>();
|
|
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
|
DependencyManager.Instance.RegisterType<FormClients>();
|
|
DependencyManager.Instance.RegisterType<FormImplementers>();
|
|
DependencyManager.Instance.RegisterType<FormImplementer>();
|
|
DependencyManager.Instance.RegisterType<FormMail>();
|
|
}
|
|
}
|
|
}
|