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
@@ -60,6 +60,9 @@ public sealed class AppSettings
|
||||
/// <summary>The first-run consent of BRIEF §21; offered only by builds with <see cref="ProductFeatures.AdsEnabled"/>.</summary>
|
||||
public bool AnonymousUsageCounts { get; set; }
|
||||
|
||||
/// <summary>Toasts also appear as Windows notifications while the window is minimised or in the background (BRIEF §12.1).</summary>
|
||||
public bool OsNotifications { get; set; } = true;
|
||||
|
||||
public WindowPlacement? Window { get; set; }
|
||||
|
||||
/// <summary>The first-run choice (local archive, adopted folder or server) was made.</summary>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Security;
|
||||
using Microsoft.Win32;
|
||||
using Titano.Core.Diagnostics;
|
||||
|
||||
namespace Titano.App.Infrastructure;
|
||||
|
||||
/// <summary>Settings › General › Startup: Titano starts when the user signs in to Windows.</summary>
|
||||
public interface IStartWithWindows
|
||||
{
|
||||
bool IsEnabled { get; }
|
||||
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
/// <summary>Points an existing entry at the current executable (after an update moved it).</summary>
|
||||
void Refresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <c>HKCU\Software\Microsoft\Windows\CurrentVersion\Run</c> value that starts Titano minimised at sign-in, so inserted
|
||||
/// cards are noticed (BRIEF §12.4) without a window in the way. The registry stays the source of truth because Task
|
||||
/// Manager can turn it off; the uninstaller removes it with the Uploader's.
|
||||
/// </summary>
|
||||
public sealed class RunKeyStartWithWindows : IStartWithWindows
|
||||
{
|
||||
/// <summary>Starts the main window minimised on the taskbar.</summary>
|
||||
public const string MinimizedOption = "--minimized";
|
||||
|
||||
private const string RunKey = @"Software\Microsoft\Windows\CurrentVersion\Run";
|
||||
private const string ValueName = "Titano";
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(RunKey);
|
||||
return key?.GetValue(ValueName) is string { Length: > 0 };
|
||||
}
|
||||
catch (SecurityException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string Command => $"\"{Environment.ProcessPath}\" {MinimizedOption}";
|
||||
|
||||
public void SetEnabled(bool enabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.CreateSubKey(RunKey, writable: true);
|
||||
if (enabled) key.SetValue(ValueName, Command, RegistryValueKind.String);
|
||||
else key.DeleteValue(ValueName, throwOnMissingValue: false);
|
||||
}
|
||||
catch (Exception ex) when (ex is SecurityException or UnauthorizedAccessException)
|
||||
{
|
||||
Log.Warning("startup", "Run key not updated", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
if (IsEnabled) SetEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Screenshots and tests never touch the user's sign-in programs.</summary>
|
||||
public sealed class MemoryStartWithWindows : IStartWithWindows
|
||||
{
|
||||
public bool IsEnabled { get; private set; }
|
||||
|
||||
public void SetEnabled(bool enabled) => IsEnabled = enabled;
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Titano.Core.Model;
|
||||
|
||||
namespace Titano.App.Jobs;
|
||||
|
||||
/// <summary>What the shell says when a job of this PC ends.</summary>
|
||||
public enum JobNotice
|
||||
{
|
||||
None,
|
||||
Done,
|
||||
Failed,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Which job endings raise a toast (BRIEF §12.1 "toasts for job completion"): the long operations the user asked for
|
||||
/// end with one toast, whichever screen started them. Background work (thumbnails, proxies, light analysis, the
|
||||
/// analysis queued after an import) and scans (the archive is rescanned every 10 minutes) end silently; an import
|
||||
/// has its own toast when it ends well, and the Import screen holds its retry. Cancelled jobs were stopped on purpose.
|
||||
/// </summary>
|
||||
public static class JobNotices
|
||||
{
|
||||
/// <summary>
|
||||
/// The notice for <paramref name="job"/> after a change from <paramref name="before"/> (null: not seen before).
|
||||
/// A job already finished before the change (a repeated event, a page read again) says nothing.
|
||||
/// </summary>
|
||||
public static JobNotice For(JobState? before, Job job)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(job);
|
||||
if (before is JobState.Done or JobState.Failed or JobState.Cancelled || job.Priority == JobPriority.Background) return JobNotice.None;
|
||||
return job.State switch
|
||||
{
|
||||
JobState.Done when Announces(job.Kind) => JobNotice.Done,
|
||||
JobState.Failed when Announces(job.Kind) || job.Kind == JobKind.Import => JobNotice.Failed,
|
||||
_ => JobNotice.None,
|
||||
};
|
||||
}
|
||||
|
||||
private static bool Announces(JobKind kind) =>
|
||||
kind is JobKind.Render or JobKind.DeepAnalyse or JobKind.Verify or JobKind.Rebuild or JobKind.Maintenance or JobKind.UploadCommit;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Jobs;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Mvvm;
|
||||
|
||||
namespace Titano.App.Sections;
|
||||
@@ -49,7 +50,8 @@ public sealed class JobFilterChip(JobFilter filter, Action<JobFilter> select) :
|
||||
/// <summary>
|
||||
/// Jobs (BRIEF §12.6, Jobs.html): queue and history with live progress from the engine (batched to about 10
|
||||
/// updates a second), filters, queue order, an expandable log tail per job, and the row actions. Also feeds the
|
||||
/// shell's job bar, the status strip and the rail badge.
|
||||
/// shell's job bar, the status strip and the rail badge (running jobs, and failures not seen on this screen yet), and
|
||||
/// raises the toast of a long operation that ends (<see cref="JobNotices"/>), whichever screen started it.
|
||||
/// </summary>
|
||||
public sealed class JobsViewModel : SectionViewModel
|
||||
{
|
||||
@@ -59,6 +61,7 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
private readonly JobListModel _model = new();
|
||||
private readonly JobUpdateBuffer _buffer = new();
|
||||
private readonly Dictionary<Guid, JobRowViewModel> _rows = [];
|
||||
private readonly HashSet<Guid> _unseenFailures = [];
|
||||
private readonly JobActions _actions;
|
||||
private CoalescingThrottle? _throttle;
|
||||
private IJobQueue? _queue;
|
||||
@@ -217,13 +220,73 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
internal void Flush()
|
||||
{
|
||||
var (jobs, progress) = _buffer.Drain();
|
||||
foreach (var job in jobs) _model.Apply(job);
|
||||
foreach (var job in jobs)
|
||||
{
|
||||
var before = _model[job.Id]?.State;
|
||||
_model.Apply(job);
|
||||
Follow(before, job);
|
||||
}
|
||||
foreach (var p in progress) _model.Apply(p);
|
||||
SyncRows();
|
||||
UpdateShell();
|
||||
}
|
||||
|
||||
private void OnJobChanged(Job job)
|
||||
/// <summary>Failures seen on this screen no longer count on the rail.</summary>
|
||||
protected override void OnActivated()
|
||||
{
|
||||
if (_unseenFailures.Count == 0) return;
|
||||
_unseenFailures.Clear();
|
||||
UpdateShell();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A change the engine reported (these are live, never pages read again): a failure counts on the rail until this
|
||||
/// screen is opened, and a long operation that ends says so in a toast with one action (BRIEF §12.1, §0.2 rule 6).
|
||||
/// </summary>
|
||||
private void Follow(JobState? before, Job job)
|
||||
{
|
||||
if (job.State != JobState.Failed) _unseenFailures.Remove(job.Id);
|
||||
else if (before != JobState.Failed && !IsSelected) _unseenFailures.Add(job.Id);
|
||||
var notice = JobNotices.For(before, job);
|
||||
if (notice == JobNotice.None || (notice == JobNotice.Done && EditorAnnounces(job))) return;
|
||||
Shell.ShowToast(notice == JobNotice.Done
|
||||
? new Toast
|
||||
{
|
||||
Title = Loc.L("Shell.Job.Done"),
|
||||
Message = JobText.Name(job),
|
||||
ActionText = Loc.L("Jobs.Action.Open"),
|
||||
ActionToolTip = Loc.L("Tooltips.Jobs.Open"),
|
||||
ActionCommand = new AsyncRelayCommand(() => OpenTargetAsync(job)),
|
||||
}
|
||||
: job.Kind == JobKind.Import
|
||||
// The Import screen resumes an import with its plan and card; it holds the retry.
|
||||
? new Toast
|
||||
{
|
||||
Title = Loc.L("Shell.Job.Failed"),
|
||||
Message = JobText.Name(job),
|
||||
ActionText = Loc.L("Shell.Nav.Import"),
|
||||
ActionToolTip = Loc.L("Tooltips.Nav.Import"),
|
||||
ActionCommand = new RelayCommand(() => Shell.Navigate(SectionKey.Import)),
|
||||
IsError = true,
|
||||
}
|
||||
: new Toast
|
||||
{
|
||||
Title = Loc.L("Shell.Job.Failed"),
|
||||
Message = JobText.Name(job),
|
||||
ActionText = Loc.L("Jobs.Action.Retry"),
|
||||
ActionToolTip = Loc.L("Tooltips.Jobs.Retry"),
|
||||
ActionCommand = new AsyncRelayCommand(() => _queue?.ResumeAsync(job.Id) ?? Task.CompletedTask),
|
||||
IsError = true,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>A finished render of the sequence open in the editor: the editor says it, with its output file.</summary>
|
||||
private bool EditorAnnounces(Job job) =>
|
||||
job is { Kind: JobKind.Render, State: JobState.Done } && Shell.Sequence.Editor is { IsRemote: false } editor
|
||||
&& job.TargetIds.Contains(editor.Session.Content.Sequence.Id);
|
||||
|
||||
/// <summary>A job changed state (any thread; tests feed it too): buffered until the next flush.</summary>
|
||||
internal void OnJobChanged(Job job)
|
||||
{
|
||||
_buffer.Post(job);
|
||||
_throttle?.Signal();
|
||||
@@ -274,10 +337,12 @@ public sealed class JobsViewModel : SectionViewModel
|
||||
Shell.SetJob(JobText.Bar(current), current.Fraction ?? 0, indeterminate: current.Fraction is null, name: JobText.Name(current.Job));
|
||||
else
|
||||
Shell.SetJob(null, 0);
|
||||
// The rail badge, the status strip and the Running chip count the same jobs: running or paused (Jobs.html).
|
||||
// The status strip and the Running chip count the same jobs: running or paused (Jobs.html). The rail badge adds the
|
||||
// failures not seen here yet, which also turn the taskbar button red while no job runs.
|
||||
var active = _model.CountOf(JobFilter.Running);
|
||||
Shell.SetJobCount(active, _model.QueuedCount);
|
||||
Badge = active;
|
||||
Shell.SetUnseenFailures(_unseenFailures.Count);
|
||||
Badge = active + _unseenFailures.Count;
|
||||
OnPropertyChanged(nameof(WorkersText));
|
||||
OnPropertyChanged(nameof(HasWorkers));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<KeyBinding Key="Z" Modifiers="Control" Command="{Binding UndoCommand}" />
|
||||
<KeyBinding Key="Y" Modifiers="Control" Command="{Binding RedoCommand}" />
|
||||
<KeyBinding Key="D0" Modifiers="Control" Command="{Binding FitCommand}" />
|
||||
<KeyBinding Key="D1" Modifiers="Control" Command="{Binding ActualSizeCommand}" />
|
||||
<KeyBinding Key="D1" Modifiers="Control+Shift" Command="{Binding ActualSizeCommand}" />
|
||||
<KeyBinding Key="R" Modifiers="Control" Command="{Binding RenderCommand}" />
|
||||
<KeyBinding Key="A" Modifiers="Control+Shift" Command="{Binding AnalyseCommand}" />
|
||||
</Grid.InputBindings>
|
||||
@@ -141,7 +141,7 @@
|
||||
IsChecked="{Binding IsCropResult}" ui:ButtonIcon.Glyph="{StaticResource Icon.Eye}" ToolTip="{Binding CropModeToolTip}"
|
||||
AutomationProperties.Name="{l:Loc Editor.Preview.CropResult}" />
|
||||
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}"
|
||||
IsChecked="{Binding IsActualSize}" Content="{l:Loc Editor.Preview.ActualSize}" ToolTip="{l:Loc Tooltips.Editor.Preview.ActualSize}" />
|
||||
IsChecked="{Binding IsActualSize}" Content="{l:Loc Editor.Preview.ActualSize}" ToolTip="{l:Loc Tooltips.Editor.Preview.OneToOne}" />
|
||||
<Button Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource Button.PreviewToolIcon}"
|
||||
ui:ButtonIcon.Glyph="{StaticResource Icon.Fullscreen}" Click="OnFullScreen" ToolTip="{l:Loc Tooltips.Editor.Preview.FullScreen}"
|
||||
AutomationProperties.Name="{l:Loc Editor.Preview.FullScreen}" />
|
||||
|
||||
@@ -15,9 +15,11 @@ namespace Titano.App.Sections;
|
||||
/// Server (BRIEF §12.7, Server.html): address with LAN-discovered servers, connect with trust-on-first-use and login,
|
||||
/// status (name, version, latency, certificate), account and quota, sign out, the options of this PC (render node,
|
||||
/// proxies kept offline, automatic project sync, uploads paused on metered networks) and the sync table (<see cref="Sync"/>).
|
||||
/// The rail badge counts the settings conflicts waiting for a choice.
|
||||
/// </summary>
|
||||
public sealed class ServerViewModel : SectionViewModel
|
||||
{
|
||||
private readonly SyncFilterChip _conflicts;
|
||||
private string _address;
|
||||
private string? _errorText;
|
||||
private ServerSession? _session;
|
||||
@@ -37,6 +39,8 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
});
|
||||
CertificateCommand = new RelayCommand(ShowCertificate, () => Fingerprint is not null);
|
||||
Sync = new SyncTableViewModel(shell);
|
||||
_conflicts = Sync.Chips.Single(c => c.Filter == SyncFilter.Conflicts);
|
||||
_conflicts.PropertyChanged += OnConflictsChanged;
|
||||
}
|
||||
|
||||
/// <summary>Sequences of this PC and of the server, where they stand and what can be done.</summary>
|
||||
@@ -213,6 +217,7 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
_conflicts.PropertyChanged -= OnConflictsChanged;
|
||||
if (_session is not null) _session.PropertyChanged -= OnSessionChanged;
|
||||
Shell.Settings.Encoders.CollectionChanged -= OnEncodersChanged;
|
||||
Sync.Dispose();
|
||||
@@ -225,6 +230,11 @@ public sealed class ServerViewModel : SectionViewModel
|
||||
if (Shell.Settings.Encoders.Count == 0 && !Shell.Settings.IsDetecting) _ = Shell.Settings.DetectEncodersAsync();
|
||||
}
|
||||
|
||||
private void OnConflictsChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName is nameof(SyncFilterChip.Count) or "" or null) Badge = _conflicts.Count;
|
||||
}
|
||||
|
||||
private void SetSyncOption(bool value, bool current, Action<bool> store, [System.Runtime.CompilerServices.CallerMemberName] string? name = null)
|
||||
{
|
||||
if (value == current) return;
|
||||
|
||||
@@ -134,6 +134,12 @@
|
||||
<RadioButton Content="{l:Loc Settings.General.Theme.System}" IsChecked="{Binding IsSystemTheme}" ToolTip="{l:Loc Tooltips.Settings.ThemeSystem}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.General.Startup}">
|
||||
<CheckBox Content="{l:Loc Settings.General.StartWithWindows}" IsChecked="{Binding StartWithWindows}" ToolTip="{l:Loc Tooltips.Settings.StartWithWindows}" Margin="0,4,0,0" />
|
||||
</HeaderedContentControl>
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.General.Notifications}">
|
||||
<CheckBox Content="{l:Loc Settings.General.OsNotifications}" IsChecked="{Binding OsNotifications}" ToolTip="{l:Loc Tooltips.Settings.OsNotifications}" Margin="0,4,0,0" />
|
||||
</HeaderedContentControl>
|
||||
<!-- Monetization consent (BRIEF §21): only in builds made with TitanoAdsEnabled=true. -->
|
||||
<HeaderedContentControl Style="{StaticResource Setting.Row}" Header="{l:Loc Settings.General.Usage}"
|
||||
Visibility="{Binding ShowsUsageCounts, Converter={StaticResource BoolToVisibility}}">
|
||||
|
||||
@@ -41,9 +41,11 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
{
|
||||
Shell = shell;
|
||||
_s = shell.Services.Settings;
|
||||
Startup = shell.Services.Environment.IsCapture ? new MemoryStartWithWindows() : new RunKeyStartWithWindows();
|
||||
AllPages =
|
||||
[
|
||||
new(SettingsPage.General, ["Settings.General.Language", "Settings.General.Theme", .. ProductFeatures.AdsEnabled ? (string[])["Settings.General.Usage"] : []]),
|
||||
new(SettingsPage.General, ["Settings.General.Language", "Settings.General.Theme", "Settings.General.Startup", "Settings.General.Notifications",
|
||||
.. ProductFeatures.AdsEnabled ? (string[])["Settings.General.Usage"] : []]),
|
||||
new(SettingsPage.Archive, ["Settings.Archive.Root", "Settings.Archive.Folders", "Settings.Archive.Files", "Settings.Archive.Proxies"]),
|
||||
new(SettingsPage.Rendering, ["Settings.Rendering.Quality", "Settings.Rendering.Memory", "Settings.Rendering.Parallelism", "Settings.Rendering.Hardware", "Settings.Rendering.Encoders"]),
|
||||
new(SettingsPage.Storage, ["Settings.Storage.Folder", "Settings.Storage.Thumbnails", "Settings.Storage.Limit"]),
|
||||
@@ -247,6 +249,34 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Where "Start with Windows" is kept (the Run key); screenshots and tests keep it in memory.</summary>
|
||||
internal IStartWithWindows Startup { get; set; }
|
||||
|
||||
/// <summary>Titano starts minimised when the user signs in to Windows.</summary>
|
||||
public bool StartWithWindows
|
||||
{
|
||||
get => Startup.IsEnabled;
|
||||
set
|
||||
{
|
||||
if (Startup.IsEnabled == value) return;
|
||||
Startup.SetEnabled(value);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Toasts also appear as Windows notifications while the window is minimised or in the background.</summary>
|
||||
public bool OsNotifications
|
||||
{
|
||||
get => _s.OsNotifications;
|
||||
set
|
||||
{
|
||||
if (_s.OsNotifications == value) return;
|
||||
_s.OsNotifications = value;
|
||||
Save();
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The usage counts consent belongs to monetization (BRIEF §21): only builds with it enabled offer it.</summary>
|
||||
public bool ShowsUsageCounts => ProductFeatures.AdsEnabled;
|
||||
|
||||
@@ -503,6 +533,7 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
}
|
||||
LoadCertificates();
|
||||
Shell.Services.Server.PropertyChanged += OnServerChanged;
|
||||
Startup.Refresh();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
@@ -709,6 +740,8 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
{
|
||||
case SettingsPage.General:
|
||||
_s.AnonymousUsageCounts = defaults.AnonymousUsageCounts;
|
||||
_s.OsNotifications = defaults.OsNotifications;
|
||||
Startup.SetEnabled(false);
|
||||
ApplyTheme(defaults.Theme);
|
||||
_s.Language = null;
|
||||
UiLanguage.Apply(null);
|
||||
|
||||
@@ -9,6 +9,26 @@
|
||||
Title="{Binding WindowTitle}"
|
||||
Width="1440" Height="900" MinWidth="1200" MinHeight="760"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
<!-- The taskbar button mirrors the job bar (BRIEF §11.5); red while a failure waits on the Jobs screen. -->
|
||||
<ui:TitanoWindow.TaskbarItemInfo>
|
||||
<TaskbarItemInfo ProgressState="{Binding TaskbarState}" ProgressValue="{Binding TaskbarProgress}" />
|
||||
</ui:TitanoWindow.TaskbarItemInfo>
|
||||
<!-- Sections by keyboard, as the rail tooltips list them (BRIEF §12.1): Ctrl+1…6 down the rail, Ctrl+, for Settings. -->
|
||||
<ui:TitanoWindow.InputBindings>
|
||||
<KeyBinding Key="D1" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Library}" />
|
||||
<KeyBinding Key="D2" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Import}" />
|
||||
<KeyBinding Key="D3" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Sequence}" />
|
||||
<KeyBinding Key="D4" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Archive}" />
|
||||
<KeyBinding Key="D5" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Jobs}" />
|
||||
<KeyBinding Key="D6" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Server}" />
|
||||
<KeyBinding Key="NumPad1" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Library}" />
|
||||
<KeyBinding Key="NumPad2" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Import}" />
|
||||
<KeyBinding Key="NumPad3" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Sequence}" />
|
||||
<KeyBinding Key="NumPad4" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Archive}" />
|
||||
<KeyBinding Key="NumPad5" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Jobs}" />
|
||||
<KeyBinding Key="NumPad6" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Server}" />
|
||||
<KeyBinding Key="OemComma" Modifiers="Control" Command="{Binding NavigateCommand}" CommandParameter="{x:Static shell:SectionKey.Settings}" />
|
||||
</ui:TitanoWindow.InputBindings>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using System.Windows;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Interop;
|
||||
|
||||
namespace Titano.App.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Windows notifications for the toasts nobody would see (BRIEF §12.1 "optional OS toast when minimised", §12.4 "Card
|
||||
/// X detected — Import"): while the main window is minimised, hidden or behind another program, every toast also goes
|
||||
/// to a tray balloon, which Windows 10/11 shows as a notification, when Settings › General allows it. Clicking it
|
||||
/// brings the window back and runs the toast's action. The tray icon exists only while such a notification can be
|
||||
/// clicked: it goes once a window of Titano is active again. Create, use and dispose it on the UI thread.
|
||||
/// </summary>
|
||||
public sealed class OsNotifications : IDisposable
|
||||
{
|
||||
private const int MenuShow = 1;
|
||||
|
||||
private readonly Window _window;
|
||||
private readonly Func<bool> _enabled;
|
||||
private readonly Action<Toast> _dismiss;
|
||||
private TrayIcon? _tray;
|
||||
private Toast? _latest;
|
||||
private bool _disposed;
|
||||
|
||||
/// <param name="window">The main window, restored by a click.</param>
|
||||
/// <param name="enabled">Settings › General › Notifications (never during screenshots and tests).</param>
|
||||
/// <param name="dismiss">Closes the in-window toast whose action a click ran.</param>
|
||||
public OsNotifications(Window window, Func<bool> enabled, Action<Toast> dismiss)
|
||||
{
|
||||
_window = window;
|
||||
_enabled = enabled;
|
||||
_dismiss = dismiss;
|
||||
_window.Activated += OnActivated;
|
||||
}
|
||||
|
||||
/// <summary>The tray icon is in the notification area (tests).</summary>
|
||||
internal bool HasTrayIcon => _tray is not null;
|
||||
|
||||
/// <summary>Mirrors <paramref name="toast"/> as a Windows notification when nobody sees the window; true when it did.</summary>
|
||||
public bool Show(Toast toast)
|
||||
{
|
||||
// A toast raised while the app closes (the window is hidden by then) needs no icon that would outlive it.
|
||||
if (_disposed || !_enabled() || !IsUnseen(_window.WindowState, _window.IsVisible, AnyWindowActive())) return false;
|
||||
_tray ??= new TrayIcon(Loc.L("Shell.AppName"), Menu, OnMenu, Restore, OnBalloonClicked);
|
||||
_latest = toast;
|
||||
_tray.ShowBalloon(toast.Title, BalloonText(toast), toast.IsError);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_disposed = true;
|
||||
_window.Activated -= OnActivated;
|
||||
RemoveIcon();
|
||||
}
|
||||
|
||||
/// <summary>Nobody sees the main window: minimised, hidden, or no window of Titano has the foreground.</summary>
|
||||
public static bool IsUnseen(WindowState state, bool isVisible, bool anyWindowActive) =>
|
||||
state == WindowState.Minimized || !isVisible || !anyWindowActive;
|
||||
|
||||
/// <summary>
|
||||
/// The notification's text: the toast's message, then its action ("Import"), which a click on it runs; the title
|
||||
/// alone when there is neither (Windows needs a text to show a notification at all).
|
||||
/// </summary>
|
||||
public static string BalloonText(Toast toast)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(toast);
|
||||
var lines = new[] { toast.Message, toast.ActionText }.Where(l => !string.IsNullOrWhiteSpace(l));
|
||||
return string.Join(Environment.NewLine, lines) is { Length: > 0 } text ? text : toast.Title;
|
||||
}
|
||||
|
||||
private static bool AnyWindowActive() => Application.Current?.Windows.OfType<Window>().Any(w => w.IsActive) ?? false;
|
||||
|
||||
private IReadOnlyList<TrayMenuItem> Menu() => [new(MenuShow, Loc.L("Shell.Tray.Show"))];
|
||||
|
||||
private void OnMenu(int id)
|
||||
{
|
||||
if (id == MenuShow) Restore();
|
||||
}
|
||||
|
||||
/// <summary>The window as it was before it was minimised (maximised stays maximised), in front.</summary>
|
||||
private void Restore()
|
||||
{
|
||||
_window.Show();
|
||||
if (_window.WindowState == WindowState.Minimized) SystemCommands.RestoreWindow(_window);
|
||||
_window.Activate();
|
||||
}
|
||||
|
||||
private void OnBalloonClicked()
|
||||
{
|
||||
var toast = _latest;
|
||||
_latest = null;
|
||||
Restore();
|
||||
if (toast?.ActionCommand is not { } command || !command.CanExecute(null)) return;
|
||||
command.Execute(null);
|
||||
_dismiss(toast);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Back in front: the notifications have done their job. The icon goes after the current message, since activation
|
||||
/// may come from a click the icon's own window is still handling, unless the window went to the background again.
|
||||
/// </summary>
|
||||
private void OnActivated(object? sender, EventArgs e)
|
||||
{
|
||||
if (_tray is null) return;
|
||||
_window.Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (!IsUnseen(_window.WindowState, _window.IsVisible, AnyWindowActive())) RemoveIcon();
|
||||
});
|
||||
}
|
||||
|
||||
private void RemoveIcon()
|
||||
{
|
||||
_latest = null;
|
||||
_tray?.Dispose();
|
||||
_tray = null;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Shell;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Sections;
|
||||
using Titano.Core.Diagnostics;
|
||||
@@ -26,6 +27,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
private string? _serverName;
|
||||
private int _jobCount;
|
||||
private int _queuedCount;
|
||||
private int _unseenFailures;
|
||||
private WelcomeViewModel? _welcome;
|
||||
private Guid? _currentSequenceId;
|
||||
|
||||
@@ -48,12 +50,13 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
Library.IsSelected = true;
|
||||
Library.PropertyChanged += OnCurrentChanged;
|
||||
|
||||
// The rail and its shortcuts (Ctrl+1…6, Ctrl+,) navigate only while no first-run dialog covers the shell.
|
||||
NavigateCommand = new RelayCommand(p =>
|
||||
{
|
||||
if (p is SectionViewModel s) Navigate(s.Key);
|
||||
else if (p is SectionKey k) Navigate(k);
|
||||
else if (p is string name && Enum.TryParse<SectionKey>(name, out var key)) Navigate(key);
|
||||
});
|
||||
}, _ => IsShellEnabled);
|
||||
ToggleRailCommand = new RelayCommand(() => IsRailCollapsed = !IsRailCollapsed);
|
||||
services.Server.PropertyChanged += (_, _) => SetConnection(services.Server.ServerName);
|
||||
if (!_settings.FirstRunCompleted) _welcome = new WelcomeViewModel(this);
|
||||
@@ -89,6 +92,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
if (!Set(ref _welcome, value)) return;
|
||||
OnPropertyChanged(nameof(IsWelcomeOpen));
|
||||
OnPropertyChanged(nameof(IsShellEnabled));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,8 +200,20 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
public string JobAnnouncement => _jobActive && _jobName is not null ? _jobName : JobText;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the global job bar (and the taskbar progress through the window). <paramref name="name"/> says which job
|
||||
/// it is without its progress ("Render: Harbour sunset"); null reads <paramref name="text"/>.
|
||||
/// The taskbar button mirrors the job bar (BRIEF §11.5): the running job's progress, sliding while its total is
|
||||
/// unknown; red while no job runs and a failure waits on the Jobs screen; nothing otherwise.
|
||||
/// </summary>
|
||||
public TaskbarItemProgressState TaskbarState =>
|
||||
_jobActive ? _jobIndeterminate ? TaskbarItemProgressState.Indeterminate : TaskbarItemProgressState.Normal
|
||||
: _unseenFailures > 0 ? TaskbarItemProgressState.Error
|
||||
: TaskbarItemProgressState.None;
|
||||
|
||||
/// <summary>0…1 for <see cref="TaskbarState"/>; a waiting failure fills the button.</summary>
|
||||
public double TaskbarProgress => _jobActive ? _jobProgress : _unseenFailures > 0 ? 1 : 0;
|
||||
|
||||
/// <summary>
|
||||
/// Updates the global job bar and the taskbar button. <paramref name="name"/> says which job it is without its
|
||||
/// progress ("Render: Harbour sunset"); null reads <paramref name="text"/>.
|
||||
/// </summary>
|
||||
public void SetJob(string? text, double progress, bool indeterminate = false, string? name = null)
|
||||
{
|
||||
@@ -208,6 +224,17 @@ public sealed class ShellViewModel : LocalizedViewModel
|
||||
IsJobIndeterminate = indeterminate;
|
||||
OnPropertyChanged(nameof(JobText));
|
||||
OnPropertyChanged(nameof(JobAnnouncement));
|
||||
OnPropertyChanged(nameof(TaskbarState));
|
||||
OnPropertyChanged(nameof(TaskbarProgress));
|
||||
}
|
||||
|
||||
/// <summary>Failed jobs not seen on the Jobs screen yet (the taskbar button turns red while no job runs).</summary>
|
||||
public void SetUnseenFailures(int count)
|
||||
{
|
||||
if (_unseenFailures == count) return;
|
||||
_unseenFailures = count;
|
||||
OnPropertyChanged(nameof(TaskbarState));
|
||||
OnPropertyChanged(nameof(TaskbarProgress));
|
||||
}
|
||||
|
||||
// ---- Status strip ----
|
||||
|
||||
@@ -3,14 +3,16 @@ using System.Windows.Interop;
|
||||
using Titano.Core.Diagnostics;
|
||||
using Titano.Core.Localization;
|
||||
|
||||
namespace Titano.Uploader.Interop;
|
||||
namespace Titano.Ui.Interop;
|
||||
|
||||
/// <summary>One entry of the tray menu; an id of 0 is a separator.</summary>
|
||||
public readonly record struct TrayMenuItem(int Id, string? Text);
|
||||
|
||||
/// <summary>
|
||||
/// Notification-area icon through <c>Shell_NotifyIconW</c>: the program icon from the executable's resources, a tooltip,
|
||||
/// a native context menu and balloons. A hidden window receives the callbacks and re-adds the icon after Explorer restarts.
|
||||
/// a native context menu and balloons (Windows notifications on Windows 10/11). A hidden window receives the callbacks
|
||||
/// and re-adds the icon after Explorer restarts. Used by the Uploader (tray) and the client (notifications while
|
||||
/// minimised); create, use and dispose it on the UI thread.
|
||||
/// </summary>
|
||||
public sealed unsafe partial class TrayIcon : IDisposable
|
||||
{
|
||||
@@ -21,6 +23,7 @@ public sealed unsafe partial class TrayIcon : IDisposable
|
||||
private const uint NifIcon = 0x2;
|
||||
private const uint NifTip = 0x4;
|
||||
private const uint NifInfo = 0x10;
|
||||
private const uint NiifError = 0x3;
|
||||
private const uint NiifUser = 0x4;
|
||||
private const int CallbackMessage = 0x8000 + 1; // WM_APP + 1
|
||||
private const int WmContextMenu = 0x007B;
|
||||
@@ -42,21 +45,24 @@ public sealed unsafe partial class TrayIcon : IDisposable
|
||||
private readonly Func<IReadOnlyList<TrayMenuItem>> _menu;
|
||||
private readonly Action<int> _command;
|
||||
private readonly Action _show;
|
||||
private readonly Action? _balloonClicked;
|
||||
private string _toolTip;
|
||||
private bool _added;
|
||||
|
||||
/// <param name="toolTip">Hover text (up to 127 characters).</param>
|
||||
/// <param name="menu">Builds the context menu when it opens.</param>
|
||||
/// <param name="command">Runs a chosen menu id.</param>
|
||||
/// <param name="show">Left click or balloon click.</param>
|
||||
public TrayIcon(string toolTip, Func<IReadOnlyList<TrayMenuItem>> menu, Action<int> command, Action show)
|
||||
/// <param name="show">Left click, and balloon click when <paramref name="balloonClicked"/> is null.</param>
|
||||
/// <param name="balloonClicked">Click on the last balloon (or its Windows notification).</param>
|
||||
public TrayIcon(string toolTip, Func<IReadOnlyList<TrayMenuItem>> menu, Action<int> command, Action show, Action? balloonClicked = null)
|
||||
{
|
||||
_toolTip = toolTip;
|
||||
_menu = menu;
|
||||
_command = command;
|
||||
_show = show;
|
||||
_balloonClicked = balloonClicked;
|
||||
// A hidden top-level window: message-only windows miss the TaskbarCreated broadcast.
|
||||
_window = new HwndSource(new HwndSourceParameters("TitanoUploaderTray") { Width = 0, Height = 0, WindowStyle = 0 });
|
||||
_window = new HwndSource(new HwndSourceParameters("TitanoTray") { Width = 0, Height = 0, WindowStyle = 0 });
|
||||
_window.AddHook(WndProc);
|
||||
_taskbarCreated = RegisterWindowMessageW("TaskbarCreated");
|
||||
(_icon, _ownsIcon) = LoadProgramIcon();
|
||||
@@ -71,13 +77,16 @@ public sealed unsafe partial class TrayIcon : IDisposable
|
||||
Notify(NimModify, &data);
|
||||
}
|
||||
|
||||
/// <summary>Shows a balloon (a toast on Windows 10/11) with the program icon.</summary>
|
||||
public void ShowBalloon(string title, string text)
|
||||
/// <summary>
|
||||
/// Shows a balloon (a Windows notification on Windows 10/11) with the program icon, or the error icon when
|
||||
/// <paramref name="isError"/>. <paramref name="text"/> must not be empty: an empty text removes the balloon.
|
||||
/// </summary>
|
||||
public void ShowBalloon(string title, string text, bool isError = false)
|
||||
{
|
||||
var data = NewData(NifInfo);
|
||||
Copy(title, data.InfoTitle, 64);
|
||||
Copy(text, data.Info, 256);
|
||||
data.InfoFlags = NiifUser;
|
||||
data.InfoFlags = isError ? NiifError : NiifUser;
|
||||
Notify(NimModify, &data);
|
||||
}
|
||||
|
||||
@@ -108,9 +117,12 @@ public sealed unsafe partial class TrayIcon : IDisposable
|
||||
{
|
||||
switch ((int)(lParam.ToInt64() & 0xFFFF))
|
||||
{
|
||||
case WmLButtonUp or WmLButtonDblClk or NinBalloonUserClick:
|
||||
case WmLButtonUp or WmLButtonDblClk:
|
||||
_show();
|
||||
break;
|
||||
case NinBalloonUserClick:
|
||||
(_balloonClicked ?? _show)();
|
||||
break;
|
||||
case WmRButtonUp or WmContextMenu:
|
||||
ShowMenu();
|
||||
break;
|
||||
@@ -172,7 +184,7 @@ public sealed unsafe partial class TrayIcon : IDisposable
|
||||
destination[length] = '\0';
|
||||
}
|
||||
|
||||
/// <summary>The generated titano-uploader icon embedded in the executable; the stock icon if it cannot be read.</summary>
|
||||
/// <summary>The program's generated icon embedded in its executable; the stock icon if it cannot be read.</summary>
|
||||
private static (IntPtr Icon, bool Owned) LoadProgramIcon()
|
||||
{
|
||||
if (Environment.ProcessPath is { } exe)
|
||||
@@ -42,8 +42,9 @@ public readonly record struct MotionVector(float X, float Y, float Dx, float Dy)
|
||||
/// polyline) and a crop mask (normalised <see cref="CropRect"/>; dims or hides what the output loses). Tools go
|
||||
/// bottom-left (<see cref="ToolsContent"/>), the shot data pill bottom-right (<see cref="InfoText"/>). Images and
|
||||
/// overlays are retained visuals under one shared transform, so panning re-renders nothing. Double-click toggles
|
||||
/// Fit and 1:1; Ctrl+0 fits, Ctrl+1 shows 1:1. Screen readers see an image (named by AutomationProperties.Name)
|
||||
/// whose status is the zoom and whose help text is the shot data, holding the tools.
|
||||
/// Fit and 1:1; Ctrl+0 fits, Ctrl+Shift+1 shows 1:1 (Ctrl+1 to Ctrl+6 switch the client's sections). Screen readers
|
||||
/// see an image (named by AutomationProperties.Name) whose status is the zoom and whose help text is the shot data,
|
||||
/// holding the tools.
|
||||
/// </summary>
|
||||
[TemplatePart(Name = PartSurface, Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = PartTools, Type = typeof(FrameworkElement))]
|
||||
@@ -55,7 +56,7 @@ public class PreviewViewport : Control
|
||||
public const string PartInfo = "PART_Info";
|
||||
|
||||
public static readonly RoutedCommand FitCommand = new(nameof(FitCommand), typeof(PreviewViewport), [new KeyGesture(Key.D0, ModifierKeys.Control)]);
|
||||
public static readonly RoutedCommand ActualSizeCommand = new(nameof(ActualSizeCommand), typeof(PreviewViewport), [new KeyGesture(Key.D1, ModifierKeys.Control)]);
|
||||
public static readonly RoutedCommand ActualSizeCommand = new(nameof(ActualSizeCommand), typeof(PreviewViewport), [new KeyGesture(Key.D1, ModifierKeys.Control | ModifierKeys.Shift)]);
|
||||
|
||||
public static readonly DependencyProperty SourceProperty = DependencyProperty.Register(
|
||||
nameof(Source), typeof(ImageSource), typeof(PreviewViewport), new PropertyMetadata(null, OnImagesChanged));
|
||||
|
||||
@@ -5,10 +5,10 @@ using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Titano.Core.Diagnostics;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Ui.Interop;
|
||||
using Titano.Ui.Mvvm;
|
||||
using Titano.Ui.Theming;
|
||||
using Titano.Uploader.Infrastructure;
|
||||
using Titano.Uploader.Interop;
|
||||
using Titano.Uploader.Server;
|
||||
using Titano.Uploader.Shell;
|
||||
using Titano.Uploader.Uploads;
|
||||
|
||||
Reference in new issue
Block a user