forked from amkovkov/GranuSightSoftware2
feat: GSS2.Test - UI+DI, Vulkan render test
This commit is contained in:
+60
-3
@@ -1,25 +1,82 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging.Console;
|
||||
|
||||
using GSS2.Core;
|
||||
using GSS2.Core.Analysis.AmineContent.Database;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Vulkan;
|
||||
|
||||
namespace GSS2.Test;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static IHost ApplicationHost { get; }
|
||||
|
||||
static Program()
|
||||
{
|
||||
ApplicationHost = BuildHostApp();
|
||||
}
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
ApplicationHost.RunAsync();
|
||||
BuildAvaloniaApp()
|
||||
.UseStandardRuntimePlatformSubsystem()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
private static IHost BuildHostApp()
|
||||
{
|
||||
var builder = Host.CreateApplicationBuilder();
|
||||
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddConsole(options => options.FormatterName = nameof(ConsoleFormatter));
|
||||
builder.Logging.AddConsoleFormatter<ConsoleFormatter, ConsoleFormatterOptions>();
|
||||
builder.Logging.AddProvider(new FileLoggerProvider("full.log", true));
|
||||
builder.Logging.AddProvider(new FileLoggerProvider("last_run.log", false));
|
||||
builder.Services.AddSingleton<LibCameraLogSink>();
|
||||
|
||||
builder.Services.AddAmineContentCalibrationContext(builder.Configuration);
|
||||
builder.Services.AddAmineContentResultsContext(builder.Configuration);
|
||||
|
||||
builder.Services.AddLightsService("Hardware:Lights");
|
||||
builder.Services.AddTemperatureHumidityService("Hardware:TemperatureHumidity");
|
||||
builder.Services.AddIlluminatorService("Hardware:Illuminator");
|
||||
builder.Services.AddCameraService("Hardware:Camera", true);
|
||||
|
||||
builder.Services.AddUi();
|
||||
|
||||
var host = builder.Build();
|
||||
host.Services.GetRequiredService<LibCameraLogSink>();
|
||||
|
||||
using (var scope = host.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AmineContentCalibrationContext>();
|
||||
context.Database.Migrate();
|
||||
}
|
||||
using (var scope = host.Services.CreateScope())
|
||||
{
|
||||
var context = scope.ServiceProvider.GetRequiredService<AmineContentResultsContext>();
|
||||
context.Database.Migrate();
|
||||
}
|
||||
|
||||
return host;
|
||||
}
|
||||
|
||||
private static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.With(new X11PlatformOptions
|
||||
{
|
||||
RenderingMode = [X11RenderingMode.Vulkan]
|
||||
})
|
||||
.With(new VulkanOptions
|
||||
{
|
||||
VulkanInstanceCreationOptions = new VulkanInstanceCreationOptions
|
||||
{
|
||||
UseDebug = true
|
||||
}
|
||||
})
|
||||
.LogToTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user