feat: add gui shell with theme, i18n and error pages

This commit is contained in:
yyc12345 committed 2026-10-03 11:22:39 +08:00
1 parent 22a0f61cb5
commit f36561cb7f
33 files changed
+1333 -26

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
using YKanBan.Storage.AppData;
using YKanBan.Storage.Workspace;
namespace YKanBan.Services;
/// <summary>
/// Composition root for the whole process: owns the loaded configuration and
/// the single open workspace session. The configuration is persisted once at
/// shutdown; the session (lock plus connection) lives until disposal.
/// </summary>
public sealed class AppServices : IDisposable
{
/// <summary>
/// Loads the configuration and prepares the service graph.
/// </summary>
public AppServices()
{
ConfigStore = new AppConfigStore(AppDataPaths.AppConfigJsonPath);
Config = ConfigStore.Load();
}
/// <summary>
/// Gets the mutable application configuration, persisted at shutdown.
/// </summary>
public AppConfig Config { get; }
/// <summary>
/// Gets the store backing app.json.
/// </summary>
public AppConfigStore ConfigStore { get; }
/// <summary>
/// Gets the open workspace session, or <see langword="null"/> while no
/// workspace is open (for example on an error page).
/// </summary>
public WorkspaceSession? Session { get; private set; }
/// <summary>
/// Opens a workspace, acquiring its exclusive lock and connection.
/// </summary>
/// <param name="folderPath">The workspace folder to open.</param>
/// <returns>The open session.</returns>
/// <exception cref="YKanBan.Storage.WorkspaceNotInitializedException">The folder has no .ykanban structure.</exception>
/// <exception cref="YKanBan.Storage.WorkspaceLockException">Another instance already holds the lock.</exception>
public WorkspaceSession OpenWorkspace(string folderPath)
{
Session = WorkspaceSession.Open(folderPath);
return Session;
}
/// <summary>
/// Persists the configuration; called once at shutdown.
/// </summary>
public void SaveConfiguration() => ConfigStore.Save(Config);
/// <summary>
/// Releases the workspace session, if any.
/// </summary>
public void Dispose() => Session?.Dispose();
}