Upload files to 'ShipyardView'
This commit is contained in:
parent
def6f654b1
commit
3270235217
11
ShipyardView/App.config
Normal file
11
ShipyardView/App.config
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<appSettings>
|
||||||
|
<add key="SmtpClientHost" value="smtp.gmail.com" />
|
||||||
|
<add key="SmtpClientPort" value="587" />
|
||||||
|
<add key="PopHost" value="pop.gmail.com" />
|
||||||
|
<add key="PopPort" value="995" />
|
||||||
|
<add key="MailLogin" value="labsjackson33@gmail.com" />
|
||||||
|
<add key="MailPassword" value="iogl uzfn onyk zpsg" />
|
||||||
|
</appSettings>
|
||||||
|
</configuration>
|
@ -12,6 +12,7 @@ using ShipyardBusinessLogic.OfficePackage.Implements;
|
|||||||
using ShipyardBusinessLogic.OfficePackage;
|
using ShipyardBusinessLogic.OfficePackage;
|
||||||
using ShipyardContracts.StorageContracts;
|
using ShipyardContracts.StorageContracts;
|
||||||
using ShipyardDatabaseImplement;
|
using ShipyardDatabaseImplement;
|
||||||
|
using ShipyardContracts.BindingModels;
|
||||||
|
|
||||||
namespace ShipyardView
|
namespace ShipyardView
|
||||||
{
|
{
|
||||||
@ -31,7 +32,36 @@ namespace ShipyardView
|
|||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
ConfigureServices(services);
|
ConfigureServices(services);
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
try
|
||||||
|
{
|
||||||
|
var mailSender =
|
||||||
|
_serviceProvider.GetService<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, 10000);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var logger = _serviceProvider.GetService<ILogger>();
|
||||||
|
logger?.LogError(ex, "exception with mail");
|
||||||
|
}
|
||||||
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
}
|
}
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
{
|
{
|
||||||
@ -67,6 +97,11 @@ namespace ShipyardView
|
|||||||
services.AddTransient<IWorkProcess, WorkModeling>();
|
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||||
services.AddTransient<ImplementersForm>();
|
services.AddTransient<ImplementersForm>();
|
||||||
services.AddTransient<ImplementerForm>();
|
services.AddTransient<ImplementerForm>();
|
||||||
|
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||||
|
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
|
services.AddTransient<ViewMailForm>();
|
||||||
|
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||||
}
|
}
|
||||||
}
|
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user