Interfaccia, parte 2: Attività, Impostazioni, collegamento, Importa, doppioni, primo avvio ed errori di configurazione
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
90 files changed
+7825
-49
No files matched your search
@@ -1,8 +1,10 @@
|
||||
using Febe.Core.Abstractions;
|
||||
using Febe.Core.Engine;
|
||||
using Febe.Core.Import;
|
||||
using Febe.Core.Library;
|
||||
using Febe.Core.Storage;
|
||||
using Febe.Data;
|
||||
using Febe.Web.Connection;
|
||||
using Febe.Web.Engine;
|
||||
using Febe.Web.Library;
|
||||
using Febe.Web.Native;
|
||||
@@ -27,11 +29,13 @@ public sealed record DemoOptions(int Port = FebeListen.DefaultPort, TimeZoneInfo
|
||||
public sealed class DemoHost : IAsyncDisposable
|
||||
{
|
||||
private readonly FebeDatabase _database;
|
||||
private readonly ImportService _import;
|
||||
|
||||
private DemoHost(string root, FebeDatabase database, WebApplication app, DemoWorld world, Uri address)
|
||||
private DemoHost(string root, FebeDatabase database, ImportService import, WebApplication app, DemoWorld world, Uri address)
|
||||
{
|
||||
Root = root;
|
||||
_database = database;
|
||||
_import = import;
|
||||
App = app;
|
||||
World = world;
|
||||
Address = address;
|
||||
@@ -55,6 +59,7 @@ public sealed class DemoHost : IAsyncDisposable
|
||||
var root = Path.Combine(options.Root ?? Path.GetTempPath(), "febe-dimostrazione-" + Guid.NewGuid().ToString("N")[..10]);
|
||||
Directory.CreateDirectory(root);
|
||||
FebeDatabase? database = null;
|
||||
ImportService? import = null;
|
||||
try
|
||||
{
|
||||
var clock = new SystemClock(options.Zone ?? TimeZoneInfo.Local);
|
||||
@@ -65,6 +70,8 @@ public sealed class DemoHost : IAsyncDisposable
|
||||
database = await FebeDatabase.OpenAsync(data.Root, ct).ConfigureAwait(false);
|
||||
await database.Settings.SetAsync(SettingKeys.LibraryRoot, layout.Root, ct).ConfigureAwait(false);
|
||||
var world = await DemoSeeder.SeedAsync(database, data, layout, clock, ct).ConfigureAwait(false);
|
||||
import = await DemoImport.PrepareAsync(root, database, world, layout, data, clock, ct).ConfigureAwait(false);
|
||||
var demoImport = import;
|
||||
var library = new FebeLibrary(database, data, layout, clock);
|
||||
var web = new FebeWebOptions
|
||||
{
|
||||
@@ -88,12 +95,23 @@ public sealed class DemoHost : IAsyncDisposable
|
||||
services.AddSingleton<INativeShell>(sp => sp.GetRequiredService<DemoShell>());
|
||||
services.AddSingleton<IBrowserWindow>(sp => sp.GetRequiredService<DemoShell>());
|
||||
services.AddSingleton<IMediaFileResolver, DemoFileResolver>();
|
||||
services.AddSingleton<IConfigurationProblems, DemoConfigurationProblems>();
|
||||
services.AddSingleton<IConnectionService, DemoConnectionService>();
|
||||
services.AddSingleton<IBrowserPreview, DemoBrowserPreview>();
|
||||
services.AddSingleton<IIncidentHistory, DemoIncidentHistory>();
|
||||
services.AddSingleton<IDataFolderChange, DemoDataFolderChange>();
|
||||
services.AddSingleton(demoImport);
|
||||
});
|
||||
await app.StartAsync(ct).ConfigureAwait(false);
|
||||
return new DemoHost(root, database, app, world, FebeWebHost.BoundAddress(app));
|
||||
return new DemoHost(root, database, import, app, world, FebeWebHost.BoundAddress(app));
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (import is not null)
|
||||
{
|
||||
await import.DisposeAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (database is not null)
|
||||
{
|
||||
await database.DisposeAsync().ConfigureAwait(false);
|
||||
@@ -113,6 +131,7 @@ public sealed class DemoHost : IAsyncDisposable
|
||||
finally
|
||||
{
|
||||
await App.DisposeAsync().ConfigureAwait(false);
|
||||
await _import.DisposeAsync().ConfigureAwait(false);
|
||||
await _database.DisposeAsync().ConfigureAwait(false);
|
||||
TryDelete(Root);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user