feat(app): taskbar progress, Windows notifications, job toasts, rail badges and section shortcuts
UI-05: the main window's TaskbarItemInfo mirrors the job bar (progress, sliding while the total is unknown) and turns red while a failure waits on the Jobs screen. UI-06: the Uploader's tray icon moves to Titano.Ui (Interop/TrayIcon, with a balloon click callback and error balloons) and the Uploader keeps using it. While the main window is minimised, hidden or behind another program, every toast (card inserted, auto-import, job ended, server messages) also becomes a Windows notification; clicking it restores the window and runs the toast's action. The icon exists only while such a notification can be clicked. Settings › General gains Notifications (on by default) and Startup: Start with Windows writes the HKCU Run value "Titano" with --minimized, and the window then waits minimised on the taskbar. UI-07: Ctrl+1…6 and Ctrl+, navigate from anywhere in the window, as the rail tooltips say (not behind the first-run dialog). The editor's 1:1 view moves to Ctrl+Shift+1; its tooltip key is renamed so no translation keeps the old shortcut. UI-08: the Jobs screen raises one toast when a long operation ends (render, deep analysis, verify, rebuild, maintenance, upload: Open; failures: Retry, or Import for a failed import), whichever screen started it. Background work and scans end silently, and a finished render of the sequence open in the editor is left to the editor's own toast with its output file. UI-10: the Jobs badge adds failures not seen on the Jobs screen yet; the Server badge counts settings conflicts waiting for a choice. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
60 files changed
+836
-108
No files matched your search
@@ -9,9 +9,15 @@ using Titano.Ui.Controls;
|
||||
|
||||
namespace Titano.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// The client's window (BRIEF §12.1): rail, job bar, section, status strip, the first-run dialog and the toasts, which
|
||||
/// also become Windows notifications while nobody sees the window (<see cref="OsNotifications"/>).
|
||||
/// </summary>
|
||||
public partial class MainWindow : TitanoWindow
|
||||
{
|
||||
private readonly ShellViewModel _shell;
|
||||
private readonly OsNotifications _notifications;
|
||||
private WindowState? _restoreTo;
|
||||
|
||||
public MainWindow(ShellViewModel shell)
|
||||
{
|
||||
@@ -24,10 +30,26 @@ public partial class MainWindow : TitanoWindow
|
||||
if (e.PropertyName is nameof(ShellViewModel.IsConnected) or "") UpdateConnection();
|
||||
if (e.PropertyName is nameof(ShellViewModel.IsWelcomeOpen) or "") FocusWelcome();
|
||||
};
|
||||
// Screenshots and tests run off screen and never activated: they must not reach the notification area.
|
||||
_notifications = new OsNotifications(this, () => shell.Services.Settings.OsNotifications && !shell.Services.Environment.IsCapture, t => Toasts.Dismiss(t));
|
||||
shell.PendingToasts.CollectionChanged += OnToastRequested;
|
||||
Loaded += (_, _) => FocusWelcome();
|
||||
RestorePlacement();
|
||||
Closing += (_, _) => SavePlacement();
|
||||
Closed += (_, _) => _notifications.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>Started at sign-in (Settings › General › Startup): the window waits minimised on the taskbar.</summary>
|
||||
internal static bool StartsMinimized(IReadOnlyList<string> arguments) =>
|
||||
arguments.Any(a => a.Equals(RunKeyStartWithWindows.MinimizedOption, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
/// <summary>The first restore of a window started minimised brings back the saved maximised state.</summary>
|
||||
protected override void OnStateChanged(EventArgs e)
|
||||
{
|
||||
base.OnStateChanged(e);
|
||||
if (_restoreTo is not { } state || WindowState == WindowState.Minimized) return;
|
||||
_restoreTo = null;
|
||||
if (WindowState != state) WindowState = state;
|
||||
}
|
||||
|
||||
/// <summary>F6 moves the keyboard to the newest notification (as in Windows apps), Esc there dismisses it.</summary>
|
||||
@@ -66,14 +88,25 @@ public partial class MainWindow : TitanoWindow
|
||||
private void OnToastRequested(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action != NotifyCollectionChangedAction.Add || e.NewItems is null) return;
|
||||
foreach (Toast t in e.NewItems) Toasts.Show(t);
|
||||
foreach (Toast t in e.NewItems)
|
||||
{
|
||||
Toasts.Show(t);
|
||||
_notifications.Show(t);
|
||||
}
|
||||
Dispatcher.BeginInvoke(() => _shell.PendingToasts.Clear());
|
||||
}
|
||||
|
||||
private void RestorePlacement()
|
||||
{
|
||||
if (_shell.Services.Environment.IsCapture) return;
|
||||
var p = _shell.Services.Settings.Window;
|
||||
if (p is null || p.Width < MinWidth || p.Height < MinHeight || _shell.Services.Environment.IsCapture) return;
|
||||
var maximized = p?.Maximized == true;
|
||||
if (StartsMinimized(Environment.GetCommandLineArgs()))
|
||||
{
|
||||
WindowState = WindowState.Minimized;
|
||||
_restoreTo = maximized ? WindowState.Maximized : WindowState.Normal;
|
||||
}
|
||||
if (p is null || p.Width < MinWidth || p.Height < MinHeight) return;
|
||||
var virtualScreen = new Rect(SystemParameters.VirtualScreenLeft, SystemParameters.VirtualScreenTop, SystemParameters.VirtualScreenWidth, SystemParameters.VirtualScreenHeight);
|
||||
var rect = new Rect(p.Left, p.Top, p.Width, p.Height);
|
||||
if (!virtualScreen.IntersectsWith(rect)) return;
|
||||
@@ -82,7 +115,7 @@ public partial class MainWindow : TitanoWindow
|
||||
Top = p.Top;
|
||||
Width = p.Width;
|
||||
Height = p.Height;
|
||||
if (p.Maximized) WindowState = WindowState.Maximized;
|
||||
if (maximized && _restoreTo is null) WindowState = WindowState.Maximized;
|
||||
}
|
||||
|
||||
private void SavePlacement()
|
||||
@@ -95,7 +128,8 @@ public partial class MainWindow : TitanoWindow
|
||||
Top = b.Top,
|
||||
Width = b.Width,
|
||||
Height = b.Height,
|
||||
Maximized = WindowState == WindowState.Maximized,
|
||||
// Started minimised and never opened: the saved state stays the one it would have been restored to.
|
||||
Maximized = WindowState == WindowState.Maximized || (WindowState == WindowState.Minimized && _restoreTo == WindowState.Maximized),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user