mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 16:46:08 +02:00
- Introduced CreateChannelDialog for user to create new channels with name and topic. - Added OnCreateChannelRequested event in MainWindow for channel creation. - Enhanced EchoHubConnection with OnReconnected event for connection state handling. - Updated EchoHubDbContext to use application base directory for SQLite database path. - Integrated Serilog for logging in EchoHub.Server. - Refactored database initialization and migration logic into DatabaseSetup class. - Implemented FirstRunSetup to ensure appsettings.json and generate JWT secret if needed. - Updated appsettings files to configure Serilog logging. - Enhanced error handling and logging in ChatHub methods for better traceability.
44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using EchoHub.Client;
|
|
using EchoHub.Client.Config;
|
|
using EchoHub.Client.Themes;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Serilog;
|
|
using Terminal.Gui.App;
|
|
|
|
var configuration = new ConfigurationBuilder()
|
|
.SetBasePath(AppContext.BaseDirectory)
|
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false)
|
|
.Build();
|
|
|
|
Log.Logger = new LoggerConfiguration()
|
|
.ReadFrom.Configuration(configuration)
|
|
.CreateLogger();
|
|
|
|
Log.Information("EchoHub client starting");
|
|
|
|
try
|
|
{
|
|
var config = ConfigManager.Load();
|
|
Log.Information("Configuration loaded, active theme: {Theme}", config.ActiveTheme);
|
|
|
|
var app = Application.Create().Init();
|
|
|
|
var theme = ThemeManager.GetTheme(config.ActiveTheme);
|
|
ThemeManager.ApplyTheme(theme);
|
|
|
|
using var orchestrator = new AppOrchestrator(app, config);
|
|
|
|
app.Run(orchestrator.MainWindow);
|
|
app.Dispose();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Fatal(ex, "EchoHub client crashed");
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
Log.Information("EchoHub client shutting down");
|
|
Log.CloseAndFlush();
|
|
}
|