feat(uploader): uploader window, dialogs, tray icon and screenshot mode

Single 760x560 window after the Uploader mockup: header with server,
user, connection glyph and quota; first-run connect form with LAN
servers and a TOFU fingerprint dialog; drop zone with an IFileOpenDialog
browse menu (files or folder/card); target choice; queue line,
pause/stop and MB/s limit; progress and per-file states with retry;
watch-folder chips; options, with a destructive confirmation before
"Delete after upload"; in-window settings panel. Shell_NotifyIcon tray
icon (program icon, Show/Pause/Exit menu, balloon on completion), app
bootstrap with logging, language, theme, single instance hand-over, and
--capture rendering connect/queue/settings in dark and light from a
design-time sample provider.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 10:28:03 +00:00
1 parent 42d96c962d
commit 192fc7dcb3
15 files changed
+2572 -1

No files matched your search

@@ -0,0 +1,79 @@
using System.IO;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using Titano.Core.Diagnostics;
using Titano.Ui.Theming;
using Titano.Uploader.DesignTime;
namespace Titano.Uploader.Shell;
/// <summary>
/// <c>Titano.Uploader.exe --capture &lt;dir&gt;</c>: renders the window at 760×560 in the dark and light themes —
/// first run (connect), queue running, settings panel — from <see cref="SampleData"/>, then exits.
/// </summary>
public static class ScreenCapture
{
public static void Run(MainWindow window, MainViewModel vm, SampleData sample, string directory)
{
Directory.CreateDirectory(directory);
window.WindowStartupLocation = WindowStartupLocation.Manual;
window.Left = -20000;
window.Top = -20000;
window.Width = 760;
window.Height = 560;
window.ShowActivated = false;
window.ShowInTaskbar = false;
window.Show();
window.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, () =>
{
try
{
foreach (var theme in new[] { AppTheme.Dark, AppTheme.Light })
{
var suffix = theme.ToString().ToLowerInvariant();
ThemeManager.Apply(theme);
sample.ShowConnect();
Save(window, Path.Combine(directory, $"uploader-connect-{suffix}.png"));
sample.ShowQueue();
Save(window, Path.Combine(directory, $"uploader-queue-{suffix}.png"));
vm.IsSettingsOpen = true;
Save(window, Path.Combine(directory, $"uploader-settings-{suffix}.png"));
vm.IsSettingsOpen = false;
}
Log.Info("capture", $"Screenshots written to {Path.GetFullPath(directory)}");
}
catch (Exception ex)
{
Log.Error("capture", "Capture failed", ex);
Environment.ExitCode = 1;
}
finally
{
Application.Current.Shutdown();
}
});
}
private static void Save(Window window, string path)
{
// Let bindings, templates and deferred layout complete.
window.UpdateLayout();
window.Dispatcher.Invoke(DispatcherPriority.ApplicationIdle, () => { });
window.UpdateLayout();
if (VisualTreeHelper.GetChildrenCount(window) == 0) return;
var root = (FrameworkElement)VisualTreeHelper.GetChild(window, 0);
var dpi = VisualTreeHelper.GetDpi(window);
var width = (int)Math.Ceiling(root.ActualWidth * dpi.DpiScaleX);
var height = (int)Math.Ceiling(root.ActualHeight * dpi.DpiScaleY);
if (width <= 0 || height <= 0) return;
var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
bitmap.Render(root);
var encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(bitmap));
using var stream = File.Create(path);
encoder.Save(stream);
}
}