feat: Phase 0 shells, design system, server skeleton, Docker and CI
- Titano.Ui: DESIGN.md tokens (dark/light), generated 16-px icon set, styles for all standard controls, custom chrome window with snap layouts, rail, job bar, Auto/manual slider, chips, toasts. - Titano desktop shell with sections, Settings (language, theme), About and a --capture screenshot mode. - Titano Server skeleton: env/server.json configuration, self-signed TLS with fingerprint, /health, /server/info, i18n endpoint and the embedded admin panel; in-process server tests. - Docker image (multi-arch, PUID/PGID, health check), compose file, Unraid template; CI, release and nightly workflows; changelog tool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
122 files changed
+6838
-22
No files matched your search
@@ -1,7 +1,97 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Shell;
|
||||
using Titano.Core.Diagnostics;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Ui.Mvvm;
|
||||
using Titano.Ui.Theming;
|
||||
|
||||
namespace Titano.App;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
private FileLogSink? _log;
|
||||
|
||||
public AppEnvironment Environment { get; private set; } = null!;
|
||||
public AppSettings Settings { get; private set; } = null!;
|
||||
|
||||
public static new App Current => (App)Application.Current;
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
base.OnStartup(e);
|
||||
Environment = AppEnvironment.Detect();
|
||||
_log = new FileLogSink(Environment.LogDirectory, "titano");
|
||||
Log.SetSink(_log);
|
||||
Log.Info("app", $"Titano {typeof(App).Assembly.GetName().Version} starting; data at {Environment.DataDirectory}");
|
||||
|
||||
Settings = AppSettings.Load(Environment.SettingsPath);
|
||||
ApplyLanguage(Settings.Language);
|
||||
ThemeManager.Initialize(this, Settings.Theme);
|
||||
|
||||
DispatcherUnhandledException += OnUnhandledException;
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, args) => Log.Error("app", "Unhandled exception", args.ExceptionObject as Exception);
|
||||
TaskScheduler.UnobservedTaskException += (_, args) =>
|
||||
{
|
||||
Log.Error("app", "Unobserved task exception", args.Exception);
|
||||
args.SetObserved();
|
||||
};
|
||||
|
||||
var shell = new ShellViewModel(Settings);
|
||||
AsyncRelayCommand.Failed += ex => shell.ReportError(ex);
|
||||
var window = new MainWindow(shell);
|
||||
MainWindow = window;
|
||||
|
||||
var captureIndex = Array.IndexOf(e.Args, "--capture");
|
||||
if (captureIndex >= 0)
|
||||
{
|
||||
var dir = captureIndex + 1 < e.Args.Length ? e.Args[captureIndex + 1] : "screenshots";
|
||||
ScreenCapture.Run(window, shell, dir);
|
||||
return;
|
||||
}
|
||||
window.Show();
|
||||
}
|
||||
|
||||
/// <summary>Switches the UI language at run time (BRIEF §16) and remembers the choice.</summary>
|
||||
public void ApplyLanguage(string? code)
|
||||
{
|
||||
var culture = Languages.BestMatch(code is null ? CultureInfo.CurrentUICulture : CultureInfo.GetCultureInfo(code));
|
||||
CultureInfo.DefaultThreadCurrentUICulture = culture;
|
||||
CultureInfo.CurrentUICulture = culture;
|
||||
Loc.SetCulture(culture);
|
||||
foreach (Window w in Windows)
|
||||
w.FlowDirection = Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
|
||||
}
|
||||
|
||||
public void SaveSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
Settings.Save(Environment.SettingsPath);
|
||||
}
|
||||
catch (System.IO.IOException ex)
|
||||
{
|
||||
Log.Warning("app", "Settings not saved", ex);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
SaveSettings();
|
||||
Log.Info("app", "Titano exiting");
|
||||
_log?.Dispose();
|
||||
base.OnExit(e);
|
||||
}
|
||||
|
||||
private void OnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||
{
|
||||
Log.Error("app", "Unhandled UI exception", e.Exception);
|
||||
if (MainWindow?.DataContext is ShellViewModel shell)
|
||||
{
|
||||
shell.ReportError(e.Exception);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user