mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 10:06:30 +00:00
60 lines
1.7 KiB
C#
60 lines
1.7 KiB
C#
using System.Windows;
|
|
using Azaion.CommonSecurity;
|
|
using Azaion.CommonSecurity.Services;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Serilog;
|
|
|
|
namespace Azaion.LoaderUI;
|
|
|
|
public partial class App
|
|
{
|
|
private LoaderClient _loaderClient = null!;
|
|
private readonly CancellationTokenSource _loaderUITokenSource = new();
|
|
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
{
|
|
base.OnStartup(e);
|
|
Start();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
Log.Logger = new LoggerConfiguration()
|
|
.Enrich.FromLogContext()
|
|
.MinimumLevel.Information()
|
|
.WriteTo.Console()
|
|
.WriteTo.File(
|
|
path: "Logs/log.txt",
|
|
rollingInterval: RollingInterval.Day)
|
|
.CreateLogger();
|
|
|
|
var initConfig = SecurityConstants.ReadInitConfig();
|
|
_loaderClient = new LoaderClient(initConfig.LoaderClientConfig, Log.Logger, _loaderUITokenSource.Token);
|
|
_loaderClient.StartClient();
|
|
_loaderClient.Connect();
|
|
|
|
var host = Host.CreateDefaultBuilder()
|
|
.ConfigureAppConfiguration((_, config) => config
|
|
.AddCommandLine(Environment.GetCommandLineArgs())
|
|
.AddJsonFile(SecurityConstants.CONFIG_PATH, optional: true, reloadOnChange: true))
|
|
.UseSerilog()
|
|
.ConfigureServices((context, services) =>
|
|
{
|
|
services.AddSingleton<Login>();
|
|
})
|
|
.Build();
|
|
host.Start();
|
|
|
|
host.Services.GetRequiredService<Login>().Show();
|
|
}
|
|
|
|
|
|
|
|
//AFter:
|
|
//_loaderClient.Login(credentials);
|
|
//_loaderClient.Dispose();
|
|
}
|
|
|