mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 21:46:30 +00:00
57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
using System.Windows;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Serilog;
|
|
|
|
namespace Azaion.LoaderUI;
|
|
|
|
public partial class App
|
|
{
|
|
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 host = Host.CreateDefaultBuilder()
|
|
.ConfigureAppConfiguration((_, config) => config
|
|
.AddCommandLine(Environment.GetCommandLineArgs())
|
|
.AddJsonFile(Constants.CONFIG_JSON_FILE, optional: true))
|
|
.UseSerilog()
|
|
.ConfigureServices((context, services) =>
|
|
{
|
|
services.AddSingleton<Login>();
|
|
services.Configure<DirectoriesConfig>(context.Configuration.GetSection(nameof(DirectoriesConfig)));
|
|
services.AddHttpClient<IAzaionApi, AzaionApi>((sp, client) =>
|
|
{
|
|
client.BaseAddress = new Uri(Constants.API_URL);
|
|
client.DefaultRequestHeaders.Add("Accept", "application/json");
|
|
client.DefaultRequestHeaders.Add("User-Agent", "Azaion.LoaderUI");
|
|
});
|
|
})
|
|
.Build();
|
|
host.Start();
|
|
|
|
host.Services.GetRequiredService<Login>().Show();
|
|
}
|
|
|
|
|
|
|
|
//AFter:
|
|
//_loaderClient.Login(credentials);
|
|
//_loaderClient.Dispose();
|
|
}
|
|
|