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:
15 files changed
+2572
-1
No files matched your search
@@ -0,0 +1,78 @@
|
||||
using System.Windows.Input;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Ui.Mvvm;
|
||||
using Titano.Uploader.Text;
|
||||
|
||||
namespace Titano.Uploader.Shell;
|
||||
|
||||
/// <summary>An entry of a watch folder chip's menu: an interval choice, a separator (no text) or "Remove".</summary>
|
||||
public sealed record WatchMenuOption(string? Text, string? ToolTip, ICommand? Command, bool IsChecked)
|
||||
{
|
||||
public bool IsSeparator => Text is null;
|
||||
}
|
||||
|
||||
/// <summary>One watch folder chip: path, interval, reachability.</summary>
|
||||
public sealed class WatchFolderViewModel : ObservableObject
|
||||
{
|
||||
/// <summary>Intervals offered in the chip menu.</summary>
|
||||
public static readonly int[] IntervalChoices = [30, 60, 300, 900];
|
||||
|
||||
private readonly Action<WatchFolderViewModel, int> _setInterval;
|
||||
private readonly Action<WatchFolderViewModel> _remove;
|
||||
private int _intervalSeconds;
|
||||
private bool? _isAvailable;
|
||||
|
||||
public WatchFolderViewModel(string path, int intervalSeconds, bool isNetwork, Action<WatchFolderViewModel, int> setInterval, Action<WatchFolderViewModel> remove)
|
||||
{
|
||||
Path = path;
|
||||
IsNetwork = isNetwork;
|
||||
_intervalSeconds = intervalSeconds;
|
||||
_setInterval = setInterval;
|
||||
_remove = remove;
|
||||
}
|
||||
|
||||
public string Path { get; }
|
||||
public bool IsNetwork { get; }
|
||||
|
||||
public int IntervalSeconds
|
||||
{
|
||||
get => _intervalSeconds;
|
||||
set
|
||||
{
|
||||
if (!Set(ref _intervalSeconds, value)) return;
|
||||
OnPropertyChanged(nameof(Text));
|
||||
OnPropertyChanged(nameof(ToolTip));
|
||||
OnPropertyChanged(nameof(MenuOptions));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Null until the first check finished.</summary>
|
||||
public bool? IsAvailable
|
||||
{
|
||||
get => _isAvailable;
|
||||
set
|
||||
{
|
||||
if (Set(ref _isAvailable, value)) OnPropertyChanged(nameof(ToolTip));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"D:\Cam\Roof · every 1 min".</summary>
|
||||
public string Text => Loc.L("Uploader.Watch.Chip", Path, Interval(IntervalSeconds));
|
||||
|
||||
public string ToolTip => IsAvailable == false ? Loc.L("Tooltips.Uploader.WatchFolderMissing", Interval(IntervalSeconds))
|
||||
: IsNetwork ? Loc.L("Tooltips.Uploader.WatchFolderNetwork", Interval(IntervalSeconds))
|
||||
: Loc.L("Tooltips.Uploader.WatchFolder", Interval(IntervalSeconds));
|
||||
|
||||
public IReadOnlyList<WatchMenuOption> MenuOptions =>
|
||||
[
|
||||
.. IntervalChoices.Select(s => new WatchMenuOption(
|
||||
Loc.L("Uploader.Watch.Every", Interval(s)),
|
||||
Loc.L("Tooltips.Uploader.WatchInterval"),
|
||||
new RelayCommand(() => _setInterval(this, s)),
|
||||
s == IntervalSeconds)),
|
||||
new WatchMenuOption(null, null, null, false),
|
||||
new WatchMenuOption(Loc.L("Uploader.Watch.Remove"), Loc.L("Tooltips.Uploader.RemoveWatchFolder"), new RelayCommand(() => _remove(this)), false),
|
||||
];
|
||||
|
||||
private static string Interval(int seconds) => UploaderText.Duration(TimeSpan.FromSeconds(seconds), Loc.Culture);
|
||||
}
|
||||
Reference in new issue
Block a user