merge: integration branch claude/keen-knuth-uhxv8w (Archive manager and UI kit review) into the Library workstream
The Archive manager's reviewed dialogs (live status lines, one-sentence errors, growing label columns, left-to-right paths) move into the shared ArchiveDialogs.xaml with their styles, so the Library's Delete and the Trash dialog use them too. Delete, Restore and Rate failures read as one sentence through ArchiveFailures, which now knows a stale delete plan, a newer sidecar and a sequence already back in the library (SequenceInLibraryException). The confirmation's plan lines in the UI font follow the reading direction; fingerprints stay left to right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
77 files changed
+1966
-468
No files matched your search
@@ -123,6 +123,10 @@ I["Triangle"] = (None, "M8 3 L13.5 12.5 H2.5 Z")
|
|||||||
I["TriangleRight"] = (None, "M5 3 L12 8 L5 13 Z")
|
I["TriangleRight"] = (None, "M5 3 L12 8 L5 13 Z")
|
||||||
I["Cross"] = ("M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5", None)
|
I["Cross"] = ("M4.5 4.5 L11.5 11.5 M11.5 4.5 L4.5 11.5", None)
|
||||||
|
|
||||||
|
# Glyphs that point along the reading direction (arrows, chevrons, start-aligned text lines): mirrored in RTL.
|
||||||
|
# Everything else (clocks, media controls, the ▶ rendered status, symmetric shapes) never mirrors.
|
||||||
|
DIRECTIONAL = {"Back", "Forward", "ChevronLeft", "ChevronRight", "ExternalLink", "Jobs", "Logs", "ViewList"}
|
||||||
|
|
||||||
out = os.path.join(os.path.dirname(__file__), "..", "..", "src", "Titano.Ui", "Icons", "Icons.xaml")
|
out = os.path.join(os.path.dirname(__file__), "..", "..", "src", "Titano.Ui", "Icons", "Icons.xaml")
|
||||||
with open(out, "w") as f:
|
with open(out, "w") as f:
|
||||||
f.write('<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\n')
|
f.write('<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"\n')
|
||||||
@@ -133,6 +137,7 @@ with open(out, "w") as f:
|
|||||||
attrs = ''
|
attrs = ''
|
||||||
if stroke: attrs += f' Stroke="{stroke}"'
|
if stroke: attrs += f' Stroke="{stroke}"'
|
||||||
if fill: attrs += f' Fill="{fill}"'
|
if fill: attrs += f' Fill="{fill}"'
|
||||||
|
if name in DIRECTIONAL: attrs += ' IsDirectional="True"'
|
||||||
f.write(f' <ui:IconData x:Key="Icon.{name}"{attrs} />\n')
|
f.write(f' <ui:IconData x:Key="Icon.{name}"{attrs} />\n')
|
||||||
f.write('</ResourceDictionary>\n')
|
f.write('</ResourceDictionary>\n')
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -84,7 +84,12 @@ Label column left of controls: 116 px in panels, 180 px in Settings.
|
|||||||
16 px, 1.5 px strokes, round caps and joins, `currentColor`, drawn as `PathGeometry` /
|
16 px, 1.5 px strokes, round caps and joins, `currentColor`, drawn as `PathGeometry` /
|
||||||
`DrawingImage` resources in `Titano.App/Icons/Icons.xaml` (source SVGs in `branding/ui-icons/`
|
`DrawingImage` resources in `Titano.App/Icons/Icons.xaml` (source SVGs in `branding/ui-icons/`
|
||||||
if generated by a tool). No icon fonts, no emoji in shipped UI (the mockups use a few glyphs
|
if generated by a tool). No icon fonts, no emoji in shipped UI (the mockups use a few glyphs
|
||||||
only as placeholders: replace ⟳ ▾ ✕ ■ ❚❚ ≡ with drawn icons). Directional icons mirror in RTL.
|
only as placeholders: replace ⟳ ▾ ✕ ■ ❚❚ ≡ with drawn icons). Directional icons mirror in RTL:
|
||||||
|
`IconData.IsDirectional` marks the glyphs that point along the reading direction (back/forward, chevrons
|
||||||
|
left/right, external link, start-aligned lines); `ui:Bidi.IsDirectional` overrides it for a subtree (a ▶ used
|
||||||
|
as "next", a chevron on a left-to-right time axis). Every other glyph (clocks, media controls, the ▶ rendered
|
||||||
|
status) and the brand mark keep their drawn orientation. Photos, previews, charts, numbers, paths and
|
||||||
|
templates are left-to-right islands (`FlowDirection="LeftToRight"` on the smallest element holding them).
|
||||||
|
|
||||||
## 6. App icon (`branding/`)
|
## 6. App icon (`branding/`)
|
||||||
|
|
||||||
|
|||||||
+12
-1
@@ -4,7 +4,7 @@
|
|||||||
<resheader name="version"><value>2.0</value></resheader>
|
<resheader name="version"><value>2.0</value></resheader>
|
||||||
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Copy into the layout…</value></data>
|
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Copy into archive…</value></data>
|
||||||
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Index in place…</value></data>
|
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Index in place…</value></data>
|
||||||
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} sequence changed</value></data>
|
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} sequence changed</value></data>
|
||||||
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} sequences changed</value></data>
|
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} sequences changed</value></data>
|
||||||
@@ -68,6 +68,7 @@
|
|||||||
<data name="Archive.Dialog.Close" xml:space="preserve"><value>Close</value></data>
|
<data name="Archive.Dialog.Close" xml:space="preserve"><value>Close</value></data>
|
||||||
<data name="Archive.Duplicates.Copies.one" xml:space="preserve"><value>{0:N0} copy</value></data>
|
<data name="Archive.Duplicates.Copies.one" xml:space="preserve"><value>{0:N0} copy</value></data>
|
||||||
<data name="Archive.Duplicates.Copies.other" xml:space="preserve"><value>{0:N0} copies</value></data>
|
<data name="Archive.Duplicates.Copies.other" xml:space="preserve"><value>{0:N0} copies</value></data>
|
||||||
|
<data name="Archive.Duplicates.Failed" xml:space="preserve"><value>The duplicate search stopped</value><comment>long</comment></data>
|
||||||
<data name="Archive.Duplicates.Folder" xml:space="preserve"><value>Folder</value></data>
|
<data name="Archive.Duplicates.Folder" xml:space="preserve"><value>Folder</value></data>
|
||||||
<data name="Archive.Duplicates.Groups.one" xml:space="preserve"><value>{0:N0} group</value></data>
|
<data name="Archive.Duplicates.Groups.one" xml:space="preserve"><value>{0:N0} group</value></data>
|
||||||
<data name="Archive.Duplicates.Groups.other" xml:space="preserve"><value>{0:N0} groups</value></data>
|
<data name="Archive.Duplicates.Groups.other" xml:space="preserve"><value>{0:N0} groups</value></data>
|
||||||
@@ -86,6 +87,11 @@
|
|||||||
<data name="Archive.Error.SourceChanged" xml:space="preserve"><value>{0} changed after the plan was made.</value><comment>long: error sentence</comment></data>
|
<data name="Archive.Error.SourceChanged" xml:space="preserve"><value>{0} changed after the plan was made.</value><comment>long: error sentence</comment></data>
|
||||||
<data name="Archive.Error.SourceGone" xml:space="preserve"><value>The card or folder {0} is no longer available.</value><comment>long: error sentence</comment></data>
|
<data name="Archive.Error.SourceGone" xml:space="preserve"><value>The card or folder {0} is no longer available.</value><comment>long: error sentence</comment></data>
|
||||||
<data name="Archive.Error.StalePlan" xml:space="preserve"><value>The archive changed after this plan was made.</value><comment>long: error sentence</comment></data>
|
<data name="Archive.Error.StalePlan" xml:space="preserve"><value>The archive changed after this plan was made.</value><comment>long: error sentence</comment></data>
|
||||||
|
<data name="Archive.Failed.Access" xml:space="preserve"><value>Titano was denied access to the archive.</value><comment>long</comment></data>
|
||||||
|
<data name="Archive.Failed.Files" xml:space="preserve"><value>A file of the archive could not be read or written.</value><comment>long</comment></data>
|
||||||
|
<data name="Archive.Failed.Gone" xml:space="preserve"><value>The sequence is no longer in the index.</value><comment>long</comment></data>
|
||||||
|
<data name="Archive.Failed.Index" xml:space="preserve"><value>The index could not be read or written.</value><comment>long</comment></data>
|
||||||
|
<data name="Archive.Failed.Retry" xml:space="preserve"><value>Retry</value></data>
|
||||||
<data name="Archive.Find.Cancel" xml:space="preserve"><value>Cancel</value></data>
|
<data name="Archive.Find.Cancel" xml:space="preserve"><value>Cancel</value></data>
|
||||||
<data name="Archive.Find.None" xml:space="preserve"><value>None found</value></data>
|
<data name="Archive.Find.None" xml:space="preserve"><value>None found</value></data>
|
||||||
<data name="Archive.Find.Run" xml:space="preserve"><value>Find</value></data>
|
<data name="Archive.Find.Run" xml:space="preserve"><value>Find</value></data>
|
||||||
@@ -93,10 +99,13 @@
|
|||||||
<data name="Archive.Health.AllVerified" xml:space="preserve"><value>Every sequence verified</value></data>
|
<data name="Archive.Health.AllVerified" xml:space="preserve"><value>Every sequence verified</value></data>
|
||||||
<data name="Archive.Health.AnalysedOk" xml:space="preserve"><value>Every sequence analysed</value></data>
|
<data name="Archive.Health.AnalysedOk" xml:space="preserve"><value>Every sequence analysed</value></data>
|
||||||
<data name="Archive.Health.Damaged" xml:space="preserve"><value>{0} missing · {1} damaged</value></data>
|
<data name="Archive.Health.Damaged" xml:space="preserve"><value>{0} missing · {1} damaged</value></data>
|
||||||
|
<data name="Archive.Health.DuplicateGroups.one" xml:space="preserve"><value>{0:N0} duplicate group</value></data>
|
||||||
|
<data name="Archive.Health.DuplicateGroups.other" xml:space="preserve"><value>{0:N0} duplicate groups</value></data>
|
||||||
<data name="Archive.Health.Duplicates.one" xml:space="preserve"><value>{0:N0} duplicate frame</value></data>
|
<data name="Archive.Health.Duplicates.one" xml:space="preserve"><value>{0:N0} duplicate frame</value></data>
|
||||||
<data name="Archive.Health.Duplicates.other" xml:space="preserve"><value>{0:N0} duplicate frames</value></data>
|
<data name="Archive.Health.Duplicates.other" xml:space="preserve"><value>{0:N0} duplicate frames</value></data>
|
||||||
<data name="Archive.Health.Fix.Analyse" xml:space="preserve"><value>Analyse</value></data>
|
<data name="Archive.Health.Fix.Analyse" xml:space="preserve"><value>Analyse</value></data>
|
||||||
<data name="Archive.Health.Fix.Duplicates" xml:space="preserve"><value>Show</value></data>
|
<data name="Archive.Health.Fix.Duplicates" xml:space="preserve"><value>Show</value></data>
|
||||||
|
<data name="Archive.Health.Fix.MarkDuplicates" xml:space="preserve"><value>Mark copies</value></data>
|
||||||
<data name="Archive.Health.Fix.Orphans" xml:space="preserve"><value>Find</value></data>
|
<data name="Archive.Health.Fix.Orphans" xml:space="preserve"><value>Find</value></data>
|
||||||
<data name="Archive.Health.Fix.Proxies" xml:space="preserve"><value>Build</value></data>
|
<data name="Archive.Health.Fix.Proxies" xml:space="preserve"><value>Build</value></data>
|
||||||
<data name="Archive.Health.Fix.Verify" xml:space="preserve"><value>Verify</value></data>
|
<data name="Archive.Health.Fix.Verify" xml:space="preserve"><value>Verify</value></data>
|
||||||
@@ -104,6 +113,7 @@
|
|||||||
<data name="Archive.Health.NoDuplicates" xml:space="preserve"><value>No duplicate frames</value></data>
|
<data name="Archive.Health.NoDuplicates" xml:space="preserve"><value>No duplicate frames</value></data>
|
||||||
<data name="Archive.Health.NoProxies.one" xml:space="preserve"><value>{0:N0} sequence lacks proxies</value></data>
|
<data name="Archive.Health.NoProxies.one" xml:space="preserve"><value>{0:N0} sequence lacks proxies</value></data>
|
||||||
<data name="Archive.Health.NoProxies.other" xml:space="preserve"><value>{0:N0} sequences lack proxies</value></data>
|
<data name="Archive.Health.NoProxies.other" xml:space="preserve"><value>{0:N0} sequences lack proxies</value></data>
|
||||||
|
<data name="Archive.Health.NoneFlagged" xml:space="preserve"><value>No copies flagged</value></data>
|
||||||
<data name="Archive.Health.NotAnalysed.one" xml:space="preserve"><value>{0:N0} sequence not analysed</value></data>
|
<data name="Archive.Health.NotAnalysed.one" xml:space="preserve"><value>{0:N0} sequence not analysed</value></data>
|
||||||
<data name="Archive.Health.NotAnalysed.other" xml:space="preserve"><value>{0:N0} sequences not analysed</value></data>
|
<data name="Archive.Health.NotAnalysed.other" xml:space="preserve"><value>{0:N0} sequences not analysed</value></data>
|
||||||
<data name="Archive.Health.ProxiesOk" xml:space="preserve"><value>Every sequence has proxies</value></data>
|
<data name="Archive.Health.ProxiesOk" xml:space="preserve"><value>Every sequence has proxies</value></data>
|
||||||
@@ -227,6 +237,7 @@
|
|||||||
<data name="Archive.Trash.Restoring" xml:space="preserve"><value>Restoring {0}…</value><comment>long</comment></data>
|
<data name="Archive.Trash.Restoring" xml:space="preserve"><value>Restoring {0}…</value><comment>long</comment></data>
|
||||||
<data name="Archive.Tree.Name" xml:space="preserve"><value>Archive tree</value></data>
|
<data name="Archive.Tree.Name" xml:space="preserve"><value>Archive tree</value></data>
|
||||||
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Undated</value></data>
|
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Undated</value></data>
|
||||||
|
<data name="Archive.View.Health" xml:space="preserve"><value>Health</value></data>
|
||||||
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Maintenance</value></data>
|
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Maintenance</value></data>
|
||||||
<data name="Archive.View.Name" xml:space="preserve"><value>View</value></data>
|
<data name="Archive.View.Name" xml:space="preserve"><value>View</value></data>
|
||||||
<data name="Archive.View.Overview" xml:space="preserve"><value>Overview</value></data>
|
<data name="Archive.View.Overview" xml:space="preserve"><value>Overview</value></data>
|
||||||
|
|||||||
@@ -5,14 +5,21 @@
|
|||||||
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<data name="Common.Auto" xml:space="preserve"><value>Auto</value></data>
|
<data name="Common.Auto" xml:space="preserve"><value>Auto</value></data>
|
||||||
|
<data name="Common.AutoValue" xml:space="preserve"><value>Auto · {0}</value><comment>{0} advisor value</comment></data>
|
||||||
|
<data name="Common.Curve" xml:space="preserve"><value>curve</value><comment>control type read by screen readers, lower case</comment></data>
|
||||||
|
<data name="Common.CurvePoint" xml:space="preserve"><value>Point {0} of {1}: {2}</value><comment>{0} position; {1} point count; {2} coordinates (Common.CurveReadout)</comment></data>
|
||||||
|
<data name="Common.CurveReadout" xml:space="preserve"><value>{0} → {1}</value><comment>invariant; drawn left to right in every language; {0} horizontal value; {1} vertical value</comment></data>
|
||||||
<data name="Common.Duration.Days" xml:space="preserve"><value>{0} d {1} h</value></data>
|
<data name="Common.Duration.Days" xml:space="preserve"><value>{0} d {1} h</value></data>
|
||||||
<data name="Common.Duration.Hours" xml:space="preserve"><value>{0} h {1} m</value></data>
|
<data name="Common.Duration.Hours" xml:space="preserve"><value>{0} h {1} m</value></data>
|
||||||
<data name="Common.Duration.Minutes" xml:space="preserve"><value>{0} min</value></data>
|
<data name="Common.Duration.Minutes" xml:space="preserve"><value>{0} min</value></data>
|
||||||
<data name="Common.Duration.Seconds" xml:space="preserve"><value>{0} s</value></data>
|
<data name="Common.Duration.Seconds" xml:space="preserve"><value>{0} s</value></data>
|
||||||
|
<data name="Common.MoreChoices" xml:space="preserve"><value>More choices</value></data>
|
||||||
<data name="Common.NotApplicable" xml:space="preserve"><value>n/a</value></data>
|
<data name="Common.NotApplicable" xml:space="preserve"><value>n/a</value></data>
|
||||||
<data name="Common.Open" xml:space="preserve"><value>Open</value></data>
|
<data name="Common.Open" xml:space="preserve"><value>Open</value></data>
|
||||||
<data name="Common.OpenLogs" xml:space="preserve"><value>Open logs</value></data>
|
<data name="Common.OpenLogs" xml:space="preserve"><value>Open logs</value></data>
|
||||||
<data name="Common.Percent" xml:space="preserve"><value>{0} %</value></data>
|
<data name="Common.Percent" xml:space="preserve"><value>{0} %</value></data>
|
||||||
|
<data name="Common.Remove" xml:space="preserve"><value>Remove</value></data>
|
||||||
|
<data name="Common.ResetToAuto" xml:space="preserve"><value>Back to Auto</value></data>
|
||||||
<data name="Common.Size.B" xml:space="preserve"><value>{0} B</value></data>
|
<data name="Common.Size.B" xml:space="preserve"><value>{0} B</value></data>
|
||||||
<data name="Common.Size.GB" xml:space="preserve"><value>{0} GB</value></data>
|
<data name="Common.Size.GB" xml:space="preserve"><value>{0} GB</value></data>
|
||||||
<data name="Common.Size.KB" xml:space="preserve"><value>{0} KB</value></data>
|
<data name="Common.Size.KB" xml:space="preserve"><value>{0} KB</value></data>
|
||||||
|
|||||||
@@ -67,6 +67,8 @@
|
|||||||
<data name="Jobs.State.Queued" xml:space="preserve"><value>queued</value></data>
|
<data name="Jobs.State.Queued" xml:space="preserve"><value>queued</value></data>
|
||||||
<data name="Jobs.State.Running" xml:space="preserve"><value>running</value></data>
|
<data name="Jobs.State.Running" xml:space="preserve"><value>running</value></data>
|
||||||
<data name="Jobs.State.WithDetail" xml:space="preserve"><value>{0} · {1}</value></data>
|
<data name="Jobs.State.WithDetail" xml:space="preserve"><value>{0} · {1}</value></data>
|
||||||
|
<data name="Jobs.Target.Render" xml:space="preserve"><value>{0} → {1}</value><comment>invariant; {0} sequence title; {1} export preset</comment></data>
|
||||||
|
<data name="Jobs.Target.RenderRtl" xml:space="preserve"><value>{0} ← {1}</value><comment>invariant; right-to-left languages: the arrow points from the sequence to the preset</comment></data>
|
||||||
<data name="Jobs.Where.ThisPc" xml:space="preserve"><value>this PC</value></data>
|
<data name="Jobs.Where.ThisPc" xml:space="preserve"><value>this PC</value></data>
|
||||||
<data name="Jobs.Workers" xml:space="preserve"><value>Workers {0} / {1}</value></data>
|
<data name="Jobs.Workers" xml:space="preserve"><value>Workers {0} / {1}</value></data>
|
||||||
</root>
|
</root>
|
||||||
@@ -6,7 +6,10 @@
|
|||||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<data name="Shell.AppName" xml:space="preserve"><value>Titano</value><comment>invariant</comment></data>
|
<data name="Shell.AppName" xml:space="preserve"><value>Titano</value><comment>invariant</comment></data>
|
||||||
<data name="Shell.JobBar.Idle" xml:space="preserve"><value>Ready</value></data>
|
<data name="Shell.JobBar.Idle" xml:space="preserve"><value>Ready</value></data>
|
||||||
|
<data name="Shell.JobBar.Pause" xml:space="preserve"><value>Pause job</value></data>
|
||||||
<data name="Shell.JobBar.Ready" xml:space="preserve"><value>Ready · {0} jobs queued</value></data>
|
<data name="Shell.JobBar.Ready" xml:space="preserve"><value>Ready · {0} jobs queued</value></data>
|
||||||
|
<data name="Shell.JobBar.Ready.one" xml:space="preserve"><value>Ready · {0} job queued</value><comment>{0} count</comment></data>
|
||||||
|
<data name="Shell.JobBar.Ready.other" xml:space="preserve"><value>Ready · {0} jobs queued</value><comment>{0} count</comment></data>
|
||||||
<data name="Shell.Nav.About" xml:space="preserve"><value>About</value></data>
|
<data name="Shell.Nav.About" xml:space="preserve"><value>About</value></data>
|
||||||
<data name="Shell.Nav.Archive" xml:space="preserve"><value>Archive</value></data>
|
<data name="Shell.Nav.Archive" xml:space="preserve"><value>Archive</value></data>
|
||||||
<data name="Shell.Nav.Import" xml:space="preserve"><value>Import</value></data>
|
<data name="Shell.Nav.Import" xml:space="preserve"><value>Import</value></data>
|
||||||
@@ -37,4 +40,5 @@
|
|||||||
<data name="Shell.Welcome.Server" xml:space="preserve"><value>Connect to a server</value></data>
|
<data name="Shell.Welcome.Server" xml:space="preserve"><value>Connect to a server</value></data>
|
||||||
<data name="Shell.Welcome.Server.Found" xml:space="preserve"><value>{0} on this network · {1}</value></data>
|
<data name="Shell.Welcome.Server.Found" xml:space="preserve"><value>{0} on this network · {1}</value></data>
|
||||||
<data name="Shell.Welcome.Title" xml:space="preserve"><value>Welcome to Titano</value></data>
|
<data name="Shell.Welcome.Title" xml:space="preserve"><value>Welcome to Titano</value></data>
|
||||||
|
<data name="Shell.WindowTitle" xml:space="preserve"><value>{0} — {1}</value><comment>{0} program name; {1} screen title</comment></data>
|
||||||
</root>
|
</root>
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
<data name="Tooltips.Archive.FilterTag" xml:space="preserve"><value>Keep only the sequences with one tag</value></data>
|
<data name="Tooltips.Archive.FilterTag" xml:space="preserve"><value>Keep only the sequences with one tag</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Analyse" xml:space="preserve"><value>Queue the light analysis of these sequences</value></data>
|
<data name="Tooltips.Archive.Fix.Analyse" xml:space="preserve"><value>Queue the light analysis of these sequences</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Duplicates" xml:space="preserve"><value>Find the duplicate groups</value></data>
|
<data name="Tooltips.Archive.Fix.Duplicates" xml:space="preserve"><value>Find the duplicate groups</value></data>
|
||||||
|
<data name="Tooltips.Archive.Fix.MarkDuplicates" xml:space="preserve"><value>Flag every copy after the first so renders skip it · runs maintenance</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Orphans" xml:space="preserve"><value>Find files and rows that do not match</value></data>
|
<data name="Tooltips.Archive.Fix.Orphans" xml:space="preserve"><value>Find files and rows that do not match</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Proxies" xml:space="preserve"><value>Queue proxy generation for these sequences</value></data>
|
<data name="Tooltips.Archive.Fix.Proxies" xml:space="preserve"><value>Queue proxy generation for these sequences</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Verify" xml:space="preserve"><value>Re-hash the originals of these sequences</value></data>
|
<data name="Tooltips.Archive.Fix.Verify" xml:space="preserve"><value>Re-hash the originals of these sequences</value></data>
|
||||||
@@ -74,6 +75,7 @@
|
|||||||
<data name="Tooltips.Archive.Relink" xml:space="preserve"><value>Choose the new folder of an archive you moved; its sequences follow</value></data>
|
<data name="Tooltips.Archive.Relink" xml:space="preserve"><value>Choose the new folder of an archive you moved; its sequences follow</value></data>
|
||||||
<data name="Tooltips.Archive.RenameApply" xml:space="preserve"><value>Make exactly these changes to folders, sidecars and index · resumes after a crash</value></data>
|
<data name="Tooltips.Archive.RenameApply" xml:space="preserve"><value>Make exactly these changes to folders, sidecars and index · resumes after a crash</value></data>
|
||||||
<data name="Tooltips.Archive.RetagApply" xml:space="preserve"><value>Change the tags of these sequences in sidecars and index</value></data>
|
<data name="Tooltips.Archive.RetagApply" xml:space="preserve"><value>Change the tags of these sequences in sidecars and index</value></data>
|
||||||
|
<data name="Tooltips.Archive.Retry" xml:space="preserve"><value>Run the same action again</value></data>
|
||||||
<data name="Tooltips.Archive.Scan" xml:space="preserve"><value>Incremental scan: new, changed and removed files by modification time and size</value></data>
|
<data name="Tooltips.Archive.Scan" xml:space="preserve"><value>Incremental scan: new, changed and removed files by modification time and size</value></data>
|
||||||
<data name="Tooltips.Archive.Set" xml:space="preserve"><value>The selected years and sequences (all when nothing is selected), narrowed by camera, status or tag</value></data>
|
<data name="Tooltips.Archive.Set" xml:space="preserve"><value>The selected years and sequences (all when nothing is selected), narrowed by camera, status or tag</value></data>
|
||||||
<data name="Tooltips.Archive.SetAnalyse" xml:space="preserve"><value>Run the deep analysis on every sequence in the set</value></data>
|
<data name="Tooltips.Archive.SetAnalyse" xml:space="preserve"><value>Run the deep analysis on every sequence in the set</value></data>
|
||||||
@@ -94,7 +96,9 @@
|
|||||||
<data name="Tooltips.Archive.TrashRestore" xml:space="preserve"><value>Move this sequence back into its folder and the library, with its settings and renders</value></data>
|
<data name="Tooltips.Archive.TrashRestore" xml:space="preserve"><value>Move this sequence back into its folder and the library, with its settings and renders</value></data>
|
||||||
<data name="Tooltips.Archive.Verify" xml:space="preserve"><value>Re-hash every original and report bit rot · reads the whole archive</value></data>
|
<data name="Tooltips.Archive.Verify" xml:space="preserve"><value>Re-hash every original and report bit rot · reads the whole archive</value></data>
|
||||||
<data name="Tooltips.Archive.YearRow" xml:space="preserve"><value>{0} · Right arrow opens the year, Left arrow closes it</value></data>
|
<data name="Tooltips.Archive.YearRow" xml:space="preserve"><value>{0} · Right arrow opens the year, Left arrow closes it</value></data>
|
||||||
|
<data name="Tooltips.Archive.YearRowRtl" xml:space="preserve"><value>{0} · Left arrow opens the year, Right arrow closes it</value></data>
|
||||||
<data name="Tooltips.Common.Dismiss" xml:space="preserve"><value>Dismiss</value></data>
|
<data name="Tooltips.Common.Dismiss" xml:space="preserve"><value>Dismiss</value></data>
|
||||||
|
<data name="Tooltips.Common.DismissToast" xml:space="preserve"><value>Close this notice · Esc</value></data>
|
||||||
<data name="Tooltips.Common.OpenLogs" xml:space="preserve"><value>Open the folder with the log files</value></data>
|
<data name="Tooltips.Common.OpenLogs" xml:space="preserve"><value>Open the folder with the log files</value></data>
|
||||||
<data name="Tooltips.Common.ResetToAuto" xml:space="preserve"><value>Return to the advisor's value</value></data>
|
<data name="Tooltips.Common.ResetToAuto" xml:space="preserve"><value>Return to the advisor's value</value></data>
|
||||||
<data name="Tooltips.Editor.Analyse" xml:space="preserve"><value>Read every frame again and refresh the analysis · Ctrl+Shift+A</value></data>
|
<data name="Tooltips.Editor.Analyse" xml:space="preserve"><value>Read every frame again and refresh the analysis · Ctrl+Shift+A</value></data>
|
||||||
|
|||||||
+12
-1
@@ -4,7 +4,7 @@
|
|||||||
<resheader name="version"><value>2.0</value></resheader>
|
<resheader name="version"><value>2.0</value></resheader>
|
||||||
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Copia nella struttura…</value></data>
|
<data name="Archive.Adopt.Copy" xml:space="preserve"><value>Copia nell'archivio…</value></data>
|
||||||
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indicizza sul posto…</value></data>
|
<data name="Archive.Adopt.InPlace" xml:space="preserve"><value>Indicizza sul posto…</value></data>
|
||||||
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} sequenza modificata</value></data>
|
<data name="Archive.Applied.one" xml:space="preserve"><value>{0:N0} sequenza modificata</value></data>
|
||||||
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} sequenze modificate</value></data>
|
<data name="Archive.Applied.other" xml:space="preserve"><value>{0:N0} sequenze modificate</value></data>
|
||||||
@@ -64,6 +64,7 @@
|
|||||||
<data name="Archive.Dialog.Close" xml:space="preserve"><value>Chiudi</value></data>
|
<data name="Archive.Dialog.Close" xml:space="preserve"><value>Chiudi</value></data>
|
||||||
<data name="Archive.Duplicates.Copies.one" xml:space="preserve"><value>{0:N0} copia</value></data>
|
<data name="Archive.Duplicates.Copies.one" xml:space="preserve"><value>{0:N0} copia</value></data>
|
||||||
<data name="Archive.Duplicates.Copies.other" xml:space="preserve"><value>{0:N0} copie</value></data>
|
<data name="Archive.Duplicates.Copies.other" xml:space="preserve"><value>{0:N0} copie</value></data>
|
||||||
|
<data name="Archive.Duplicates.Failed" xml:space="preserve"><value>Ricerca dei doppioni interrotta</value></data>
|
||||||
<data name="Archive.Duplicates.Folder" xml:space="preserve"><value>Cartella</value></data>
|
<data name="Archive.Duplicates.Folder" xml:space="preserve"><value>Cartella</value></data>
|
||||||
<data name="Archive.Duplicates.Groups.one" xml:space="preserve"><value>{0:N0} gruppo</value></data>
|
<data name="Archive.Duplicates.Groups.one" xml:space="preserve"><value>{0:N0} gruppo</value></data>
|
||||||
<data name="Archive.Duplicates.Groups.other" xml:space="preserve"><value>{0:N0} gruppi</value></data>
|
<data name="Archive.Duplicates.Groups.other" xml:space="preserve"><value>{0:N0} gruppi</value></data>
|
||||||
@@ -81,6 +82,11 @@
|
|||||||
<data name="Archive.Error.SourceChanged" xml:space="preserve"><value>{0} è cambiato dopo la creazione del piano.</value></data>
|
<data name="Archive.Error.SourceChanged" xml:space="preserve"><value>{0} è cambiato dopo la creazione del piano.</value></data>
|
||||||
<data name="Archive.Error.SourceGone" xml:space="preserve"><value>La scheda o cartella {0} non è più disponibile.</value></data>
|
<data name="Archive.Error.SourceGone" xml:space="preserve"><value>La scheda o cartella {0} non è più disponibile.</value></data>
|
||||||
<data name="Archive.Error.StalePlan" xml:space="preserve"><value>L'archivio è cambiato dopo la creazione del piano.</value></data>
|
<data name="Archive.Error.StalePlan" xml:space="preserve"><value>L'archivio è cambiato dopo la creazione del piano.</value></data>
|
||||||
|
<data name="Archive.Failed.Access" xml:space="preserve"><value>Titano non ha accesso all'archivio.</value></data>
|
||||||
|
<data name="Archive.Failed.Files" xml:space="preserve"><value>Non è stato possibile leggere o scrivere un file dell'archivio.</value></data>
|
||||||
|
<data name="Archive.Failed.Gone" xml:space="preserve"><value>La sequenza non è più nell'indice.</value></data>
|
||||||
|
<data name="Archive.Failed.Index" xml:space="preserve"><value>Non è stato possibile leggere o scrivere l'indice.</value></data>
|
||||||
|
<data name="Archive.Failed.Retry" xml:space="preserve"><value>Riprova</value></data>
|
||||||
<data name="Archive.Find.Cancel" xml:space="preserve"><value>Annulla</value></data>
|
<data name="Archive.Find.Cancel" xml:space="preserve"><value>Annulla</value></data>
|
||||||
<data name="Archive.Find.None" xml:space="preserve"><value>Nessuno trovato</value></data>
|
<data name="Archive.Find.None" xml:space="preserve"><value>Nessuno trovato</value></data>
|
||||||
<data name="Archive.Find.Run" xml:space="preserve"><value>Cerca</value></data>
|
<data name="Archive.Find.Run" xml:space="preserve"><value>Cerca</value></data>
|
||||||
@@ -88,10 +94,13 @@
|
|||||||
<data name="Archive.Health.AllVerified" xml:space="preserve"><value>Tutte le sequenze verificate</value></data>
|
<data name="Archive.Health.AllVerified" xml:space="preserve"><value>Tutte le sequenze verificate</value></data>
|
||||||
<data name="Archive.Health.AnalysedOk" xml:space="preserve"><value>Tutte le sequenze analizzate</value></data>
|
<data name="Archive.Health.AnalysedOk" xml:space="preserve"><value>Tutte le sequenze analizzate</value></data>
|
||||||
<data name="Archive.Health.Damaged" xml:space="preserve"><value>{0} mancanti · {1} danneggiati</value></data>
|
<data name="Archive.Health.Damaged" xml:space="preserve"><value>{0} mancanti · {1} danneggiati</value></data>
|
||||||
|
<data name="Archive.Health.DuplicateGroups.one" xml:space="preserve"><value>{0:N0} gruppo di doppioni</value></data>
|
||||||
|
<data name="Archive.Health.DuplicateGroups.other" xml:space="preserve"><value>{0:N0} gruppi di doppioni</value></data>
|
||||||
<data name="Archive.Health.Duplicates.one" xml:space="preserve"><value>{0:N0} fotogramma doppio</value></data>
|
<data name="Archive.Health.Duplicates.one" xml:space="preserve"><value>{0:N0} fotogramma doppio</value></data>
|
||||||
<data name="Archive.Health.Duplicates.other" xml:space="preserve"><value>{0:N0} fotogrammi doppi</value></data>
|
<data name="Archive.Health.Duplicates.other" xml:space="preserve"><value>{0:N0} fotogrammi doppi</value></data>
|
||||||
<data name="Archive.Health.Fix.Analyse" xml:space="preserve"><value>Analizza</value></data>
|
<data name="Archive.Health.Fix.Analyse" xml:space="preserve"><value>Analizza</value></data>
|
||||||
<data name="Archive.Health.Fix.Duplicates" xml:space="preserve"><value>Mostra</value></data>
|
<data name="Archive.Health.Fix.Duplicates" xml:space="preserve"><value>Mostra</value></data>
|
||||||
|
<data name="Archive.Health.Fix.MarkDuplicates" xml:space="preserve"><value>Segna copie</value></data>
|
||||||
<data name="Archive.Health.Fix.Orphans" xml:space="preserve"><value>Cerca</value></data>
|
<data name="Archive.Health.Fix.Orphans" xml:space="preserve"><value>Cerca</value></data>
|
||||||
<data name="Archive.Health.Fix.Proxies" xml:space="preserve"><value>Crea</value></data>
|
<data name="Archive.Health.Fix.Proxies" xml:space="preserve"><value>Crea</value></data>
|
||||||
<data name="Archive.Health.Fix.Verify" xml:space="preserve"><value>Verifica</value></data>
|
<data name="Archive.Health.Fix.Verify" xml:space="preserve"><value>Verifica</value></data>
|
||||||
@@ -99,6 +108,7 @@
|
|||||||
<data name="Archive.Health.NoDuplicates" xml:space="preserve"><value>Nessun fotogramma doppio</value></data>
|
<data name="Archive.Health.NoDuplicates" xml:space="preserve"><value>Nessun fotogramma doppio</value></data>
|
||||||
<data name="Archive.Health.NoProxies.one" xml:space="preserve"><value>{0:N0} sequenza senza proxy</value></data>
|
<data name="Archive.Health.NoProxies.one" xml:space="preserve"><value>{0:N0} sequenza senza proxy</value></data>
|
||||||
<data name="Archive.Health.NoProxies.other" xml:space="preserve"><value>{0:N0} sequenze senza proxy</value></data>
|
<data name="Archive.Health.NoProxies.other" xml:space="preserve"><value>{0:N0} sequenze senza proxy</value></data>
|
||||||
|
<data name="Archive.Health.NoneFlagged" xml:space="preserve"><value>Nessuna copia segnata</value></data>
|
||||||
<data name="Archive.Health.NotAnalysed.one" xml:space="preserve"><value>{0:N0} sequenza non analizzata</value></data>
|
<data name="Archive.Health.NotAnalysed.one" xml:space="preserve"><value>{0:N0} sequenza non analizzata</value></data>
|
||||||
<data name="Archive.Health.NotAnalysed.other" xml:space="preserve"><value>{0:N0} sequenze non analizzate</value></data>
|
<data name="Archive.Health.NotAnalysed.other" xml:space="preserve"><value>{0:N0} sequenze non analizzate</value></data>
|
||||||
<data name="Archive.Health.ProxiesOk" xml:space="preserve"><value>Ogni sequenza ha i proxy</value></data>
|
<data name="Archive.Health.ProxiesOk" xml:space="preserve"><value>Ogni sequenza ha i proxy</value></data>
|
||||||
@@ -220,6 +230,7 @@
|
|||||||
<data name="Archive.Trash.Restoring" xml:space="preserve"><value>Ripristino di {0}…</value></data>
|
<data name="Archive.Trash.Restoring" xml:space="preserve"><value>Ripristino di {0}…</value></data>
|
||||||
<data name="Archive.Tree.Name" xml:space="preserve"><value>Albero dell'archivio</value></data>
|
<data name="Archive.Tree.Name" xml:space="preserve"><value>Albero dell'archivio</value></data>
|
||||||
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Senza data</value></data>
|
<data name="Archive.Tree.Undated" xml:space="preserve"><value>Senza data</value></data>
|
||||||
|
<data name="Archive.View.Health" xml:space="preserve"><value>Stato</value></data>
|
||||||
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Manutenzione</value></data>
|
<data name="Archive.View.Maintenance" xml:space="preserve"><value>Manutenzione</value></data>
|
||||||
<data name="Archive.View.Name" xml:space="preserve"><value>Vista</value></data>
|
<data name="Archive.View.Name" xml:space="preserve"><value>Vista</value></data>
|
||||||
<data name="Archive.View.Overview" xml:space="preserve"><value>Panoramica</value></data>
|
<data name="Archive.View.Overview" xml:space="preserve"><value>Panoramica</value></data>
|
||||||
|
|||||||
@@ -5,14 +5,21 @@
|
|||||||
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<data name="Common.Auto" xml:space="preserve"><value>Auto</value></data>
|
<data name="Common.Auto" xml:space="preserve"><value>Auto</value></data>
|
||||||
|
<data name="Common.AutoValue" xml:space="preserve"><value>Auto · {0}</value></data>
|
||||||
|
<data name="Common.Curve" xml:space="preserve"><value>curva</value></data>
|
||||||
|
<data name="Common.CurvePoint" xml:space="preserve"><value>Punto {0} di {1}: {2}</value></data>
|
||||||
|
<data name="Common.CurveReadout" xml:space="preserve"><value>{0} → {1}</value></data>
|
||||||
<data name="Common.Duration.Days" xml:space="preserve"><value>{0} g {1} h</value></data>
|
<data name="Common.Duration.Days" xml:space="preserve"><value>{0} g {1} h</value></data>
|
||||||
<data name="Common.Duration.Hours" xml:space="preserve"><value>{0} h {1} m</value></data>
|
<data name="Common.Duration.Hours" xml:space="preserve"><value>{0} h {1} m</value></data>
|
||||||
<data name="Common.Duration.Minutes" xml:space="preserve"><value>{0} min</value></data>
|
<data name="Common.Duration.Minutes" xml:space="preserve"><value>{0} min</value></data>
|
||||||
<data name="Common.Duration.Seconds" xml:space="preserve"><value>{0} s</value></data>
|
<data name="Common.Duration.Seconds" xml:space="preserve"><value>{0} s</value></data>
|
||||||
|
<data name="Common.MoreChoices" xml:space="preserve"><value>Altre scelte</value></data>
|
||||||
<data name="Common.NotApplicable" xml:space="preserve"><value>n/d</value></data>
|
<data name="Common.NotApplicable" xml:space="preserve"><value>n/d</value></data>
|
||||||
<data name="Common.Open" xml:space="preserve"><value>Apri</value></data>
|
<data name="Common.Open" xml:space="preserve"><value>Apri</value></data>
|
||||||
<data name="Common.OpenLogs" xml:space="preserve"><value>Apri log</value></data>
|
<data name="Common.OpenLogs" xml:space="preserve"><value>Apri log</value></data>
|
||||||
<data name="Common.Percent" xml:space="preserve"><value>{0}%</value></data>
|
<data name="Common.Percent" xml:space="preserve"><value>{0}%</value></data>
|
||||||
|
<data name="Common.Remove" xml:space="preserve"><value>Rimuovi</value></data>
|
||||||
|
<data name="Common.ResetToAuto" xml:space="preserve"><value>Torna ad Auto</value></data>
|
||||||
<data name="Common.Size.B" xml:space="preserve"><value>{0} byte</value></data>
|
<data name="Common.Size.B" xml:space="preserve"><value>{0} byte</value></data>
|
||||||
<data name="Common.Size.GB" xml:space="preserve"><value>{0} GB</value></data>
|
<data name="Common.Size.GB" xml:space="preserve"><value>{0} GB</value></data>
|
||||||
<data name="Common.Size.KB" xml:space="preserve"><value>{0} KB</value></data>
|
<data name="Common.Size.KB" xml:space="preserve"><value>{0} KB</value></data>
|
||||||
|
|||||||
@@ -5,7 +5,10 @@
|
|||||||
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="reader"><value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
<resheader name="writer"><value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value></resheader>
|
||||||
<data name="Shell.JobBar.Idle" xml:space="preserve"><value>Pronto</value></data>
|
<data name="Shell.JobBar.Idle" xml:space="preserve"><value>Pronto</value></data>
|
||||||
|
<data name="Shell.JobBar.Pause" xml:space="preserve"><value>Pausa attività</value></data>
|
||||||
<data name="Shell.JobBar.Ready" xml:space="preserve"><value>Pronto · {0} attività in coda</value></data>
|
<data name="Shell.JobBar.Ready" xml:space="preserve"><value>Pronto · {0} attività in coda</value></data>
|
||||||
|
<data name="Shell.JobBar.Ready.one" xml:space="preserve"><value>Pronto · {0} attività in coda</value></data>
|
||||||
|
<data name="Shell.JobBar.Ready.other" xml:space="preserve"><value>Pronto · {0} attività in coda</value></data>
|
||||||
<data name="Shell.Nav.About" xml:space="preserve"><value>Informazioni</value></data>
|
<data name="Shell.Nav.About" xml:space="preserve"><value>Informazioni</value></data>
|
||||||
<data name="Shell.Nav.Archive" xml:space="preserve"><value>Archivio</value></data>
|
<data name="Shell.Nav.Archive" xml:space="preserve"><value>Archivio</value></data>
|
||||||
<data name="Shell.Nav.Import" xml:space="preserve"><value>Importa</value></data>
|
<data name="Shell.Nav.Import" xml:space="preserve"><value>Importa</value></data>
|
||||||
@@ -36,4 +39,5 @@
|
|||||||
<data name="Shell.Welcome.Server" xml:space="preserve"><value>Connettiti a un server</value></data>
|
<data name="Shell.Welcome.Server" xml:space="preserve"><value>Connettiti a un server</value></data>
|
||||||
<data name="Shell.Welcome.Server.Found" xml:space="preserve"><value>{0} in questa rete · {1}</value></data>
|
<data name="Shell.Welcome.Server.Found" xml:space="preserve"><value>{0} in questa rete · {1}</value></data>
|
||||||
<data name="Shell.Welcome.Title" xml:space="preserve"><value>Benvenuto in Titano</value></data>
|
<data name="Shell.Welcome.Title" xml:space="preserve"><value>Benvenuto in Titano</value></data>
|
||||||
|
<data name="Shell.WindowTitle" xml:space="preserve"><value>{0} — {1}</value></data>
|
||||||
</root>
|
</root>
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
<data name="Tooltips.Archive.FilterTag" xml:space="preserve"><value>Tieni solo le sequenze con un tag</value></data>
|
<data name="Tooltips.Archive.FilterTag" xml:space="preserve"><value>Tieni solo le sequenze con un tag</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Analyse" xml:space="preserve"><value>Metti in coda l'analisi rapida di queste sequenze</value></data>
|
<data name="Tooltips.Archive.Fix.Analyse" xml:space="preserve"><value>Metti in coda l'analisi rapida di queste sequenze</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Duplicates" xml:space="preserve"><value>Trova i gruppi di doppioni</value></data>
|
<data name="Tooltips.Archive.Fix.Duplicates" xml:space="preserve"><value>Trova i gruppi di doppioni</value></data>
|
||||||
|
<data name="Tooltips.Archive.Fix.MarkDuplicates" xml:space="preserve"><value>Segna ogni copia dopo la prima perché i render la saltino · esegue la manutenzione</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Orphans" xml:space="preserve"><value>Trova file e righe che non corrispondono</value></data>
|
<data name="Tooltips.Archive.Fix.Orphans" xml:space="preserve"><value>Trova file e righe che non corrispondono</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Proxies" xml:space="preserve"><value>Metti in coda la creazione dei proxy per queste sequenze</value></data>
|
<data name="Tooltips.Archive.Fix.Proxies" xml:space="preserve"><value>Metti in coda la creazione dei proxy per queste sequenze</value></data>
|
||||||
<data name="Tooltips.Archive.Fix.Verify" xml:space="preserve"><value>Ricalcola l'hash degli originali di queste sequenze</value></data>
|
<data name="Tooltips.Archive.Fix.Verify" xml:space="preserve"><value>Ricalcola l'hash degli originali di queste sequenze</value></data>
|
||||||
@@ -74,6 +75,7 @@
|
|||||||
<data name="Tooltips.Archive.Relink" xml:space="preserve"><value>Scegli la nuova cartella di un archivio spostato; le sequenze lo seguono</value></data>
|
<data name="Tooltips.Archive.Relink" xml:space="preserve"><value>Scegli la nuova cartella di un archivio spostato; le sequenze lo seguono</value></data>
|
||||||
<data name="Tooltips.Archive.RenameApply" xml:space="preserve"><value>Applica esattamente queste modifiche a cartelle, sidecar e indice · riprende dopo un arresto</value></data>
|
<data name="Tooltips.Archive.RenameApply" xml:space="preserve"><value>Applica esattamente queste modifiche a cartelle, sidecar e indice · riprende dopo un arresto</value></data>
|
||||||
<data name="Tooltips.Archive.RetagApply" xml:space="preserve"><value>Cambia i tag di queste sequenze in sidecar e indice</value></data>
|
<data name="Tooltips.Archive.RetagApply" xml:space="preserve"><value>Cambia i tag di queste sequenze in sidecar e indice</value></data>
|
||||||
|
<data name="Tooltips.Archive.Retry" xml:space="preserve"><value>Esegui di nuovo la stessa azione</value></data>
|
||||||
<data name="Tooltips.Archive.Scan" xml:space="preserve"><value>Scansione incrementale: file nuovi, modificati e rimossi per data e dimensione</value></data>
|
<data name="Tooltips.Archive.Scan" xml:space="preserve"><value>Scansione incrementale: file nuovi, modificati e rimossi per data e dimensione</value></data>
|
||||||
<data name="Tooltips.Archive.Set" xml:space="preserve"><value>Anni e sequenze selezionati (tutti se nulla è selezionato), ristretti per fotocamera, stato o tag</value></data>
|
<data name="Tooltips.Archive.Set" xml:space="preserve"><value>Anni e sequenze selezionati (tutti se nulla è selezionato), ristretti per fotocamera, stato o tag</value></data>
|
||||||
<data name="Tooltips.Archive.SetAnalyse" xml:space="preserve"><value>Esegui l'analisi profonda su ogni sequenza della selezione</value></data>
|
<data name="Tooltips.Archive.SetAnalyse" xml:space="preserve"><value>Esegui l'analisi profonda su ogni sequenza della selezione</value></data>
|
||||||
@@ -94,7 +96,9 @@
|
|||||||
<data name="Tooltips.Archive.TrashRestore" xml:space="preserve"><value>Riporta questa sequenza nella sua cartella e nella libreria, con impostazioni e render</value></data>
|
<data name="Tooltips.Archive.TrashRestore" xml:space="preserve"><value>Riporta questa sequenza nella sua cartella e nella libreria, con impostazioni e render</value></data>
|
||||||
<data name="Tooltips.Archive.Verify" xml:space="preserve"><value>Ricalcola l'hash di ogni originale e segnala i danni · legge tutto l'archivio</value></data>
|
<data name="Tooltips.Archive.Verify" xml:space="preserve"><value>Ricalcola l'hash di ogni originale e segnala i danni · legge tutto l'archivio</value></data>
|
||||||
<data name="Tooltips.Archive.YearRow" xml:space="preserve"><value>{0} · Freccia destra apre l'anno, freccia sinistra lo chiude</value></data>
|
<data name="Tooltips.Archive.YearRow" xml:space="preserve"><value>{0} · Freccia destra apre l'anno, freccia sinistra lo chiude</value></data>
|
||||||
|
<data name="Tooltips.Archive.YearRowRtl" xml:space="preserve"><value>{0} · Freccia sinistra apre l'anno, freccia destra lo chiude</value></data>
|
||||||
<data name="Tooltips.Common.Dismiss" xml:space="preserve"><value>Chiudi</value></data>
|
<data name="Tooltips.Common.Dismiss" xml:space="preserve"><value>Chiudi</value></data>
|
||||||
|
<data name="Tooltips.Common.DismissToast" xml:space="preserve"><value>Chiudi questo avviso · Esc</value></data>
|
||||||
<data name="Tooltips.Common.OpenLogs" xml:space="preserve"><value>Apri la cartella dei file di log</value></data>
|
<data name="Tooltips.Common.OpenLogs" xml:space="preserve"><value>Apri la cartella dei file di log</value></data>
|
||||||
<data name="Tooltips.Common.ResetToAuto" xml:space="preserve"><value>Torna al valore consigliato</value></data>
|
<data name="Tooltips.Common.ResetToAuto" xml:space="preserve"><value>Torna al valore consigliato</value></data>
|
||||||
<data name="Tooltips.Editor.Analyse" xml:space="preserve"><value>Rilegge ogni fotogramma e aggiorna l’analisi · Ctrl+Maiusc+A</value></data>
|
<data name="Tooltips.Editor.Analyse" xml:space="preserve"><value>Rilegge ogni fotogramma e aggiorna l’analisi · Ctrl+Maiusc+A</value></data>
|
||||||
|
|||||||
@@ -16,13 +16,15 @@ namespace Titano.App.Archiving;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// An in-window dialog of the Archive screen: one primary action, one way out. While its action runs, the way out
|
/// An in-window dialog of the Archive screen: one primary action, one way out. While its action runs, the way out
|
||||||
/// stops it when it can be stopped, and is disabled otherwise; the close callback receives the dialog, so a late close
|
/// stops it when it can be stopped, and is disabled otherwise; the close callback receives the dialog, so a late close
|
||||||
/// never closes another one.
|
/// never closes another one. A failure stays on screen as one sentence until the next attempt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ArchiveDialogViewModel : LocalizedViewModel
|
public abstract class ArchiveDialogViewModel : LocalizedViewModel
|
||||||
{
|
{
|
||||||
private readonly Action<ArchiveDialogViewModel> _close;
|
private readonly Action<ArchiveDialogViewModel> _close;
|
||||||
private bool _isBusy;
|
private bool _isBusy;
|
||||||
private string? _busyText;
|
private string? _busyText;
|
||||||
|
private string? _errorText;
|
||||||
|
private string? _errorToolTip;
|
||||||
|
|
||||||
protected ArchiveDialogViewModel(Action<ArchiveDialogViewModel> close)
|
protected ArchiveDialogViewModel(Action<ArchiveDialogViewModel> close)
|
||||||
{
|
{
|
||||||
@@ -61,11 +63,32 @@ public abstract class ArchiveDialogViewModel : LocalizedViewModel
|
|||||||
|
|
||||||
public string? BusyText { get => _busyText; protected set => Set(ref _busyText, value); }
|
public string? BusyText { get => _busyText; protected set => Set(ref _busyText, value); }
|
||||||
|
|
||||||
|
/// <summary>Why the last dry run or apply stopped (<see cref="ArchiveFailures.Cause"/>); null when nothing failed.</summary>
|
||||||
|
public string? ErrorText { get => _errorText; private set => Set(ref _errorText, value); }
|
||||||
|
|
||||||
|
/// <summary>The failure as the engine reported it, for the tooltip.</summary>
|
||||||
|
public string? ErrorToolTip { get => _errorToolTip; private set => Set(ref _errorToolTip, value); }
|
||||||
|
|
||||||
protected void Close() => _close(this);
|
protected void Close() => _close(this);
|
||||||
|
|
||||||
|
protected void ShowError(Exception ex)
|
||||||
|
{
|
||||||
|
ErrorText = ArchiveFailures.Cause(ex);
|
||||||
|
ErrorToolTip = ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ClearError()
|
||||||
|
{
|
||||||
|
ErrorText = null;
|
||||||
|
ErrorToolTip = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>A fact of the rebuild dialog ("Sidecars · 412").</summary>
|
/// <summary>A fact of the rebuild dialog ("Sidecars · 412"); a path stays left to right, a missing value says why in its tooltip.</summary>
|
||||||
public sealed record DialogFact(string Label, string Value);
|
public sealed record DialogFact(string Label, string Value, bool IsPath = false, string? Reason = null)
|
||||||
|
{
|
||||||
|
public string ToolTip => Reason ?? Value;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Rebuild index" (BRIEF §12.5): what the rebuild reads — the sidecars on disk, then a full metadata scan of folders
|
/// "Rebuild index" (BRIEF §12.5): what the rebuild reads — the sidecars on disk, then a full metadata scan of folders
|
||||||
@@ -84,7 +107,7 @@ public sealed class RebuildDialogViewModel : ArchiveDialogViewModel
|
|||||||
Archive = archive;
|
Archive = archive;
|
||||||
Availability = availability;
|
Availability = availability;
|
||||||
Indexed = indexed;
|
Indexed = indexed;
|
||||||
_facts = Facts(null);
|
_facts = Facts(null, availability == ArchiveAvailability.Offline ? Loc.L("Archive.Error.Offline", Formatting.LeftToRight(archive.RootPath)) : null);
|
||||||
RebuildCommand = new AsyncRelayCommand(RebuildAsync, () => !IsBusy && availability == ArchiveAvailability.Online);
|
RebuildCommand = new AsyncRelayCommand(RebuildAsync, () => !IsBusy && availability == ArchiveAvailability.Online);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +121,10 @@ public sealed class RebuildDialogViewModel : ArchiveDialogViewModel
|
|||||||
|
|
||||||
public string RebuildToolTip => Availability == ArchiveAvailability.Online ? Loc.L("Tooltips.Archive.RebuildStart") : Loc.L("Archive.Blocked.NotOnline");
|
public string RebuildToolTip => Availability == ArchiveAvailability.Online ? Loc.L("Tooltips.Archive.RebuildStart") : Loc.L("Archive.Blocked.NotOnline");
|
||||||
|
|
||||||
/// <summary>Counts sequence folders with and without a sidecar (a walk of the archive tree, off the UI thread).</summary>
|
/// <summary>
|
||||||
|
/// Counts sequence folders with and without a sidecar (a walk of the archive tree, off the UI thread). The counts
|
||||||
|
/// read "Counting…" only while the walk runs; an offline archive or a failed walk leaves "—" with the reason.
|
||||||
|
/// </summary>
|
||||||
public async Task CountAsync()
|
public async Task CountAsync()
|
||||||
{
|
{
|
||||||
if (Availability == ArchiveAvailability.Offline) return;
|
if (Availability == ArchiveAvailability.Offline) return;
|
||||||
@@ -107,11 +133,12 @@ public sealed class RebuildDialogViewModel : ArchiveDialogViewModel
|
|||||||
{
|
{
|
||||||
var root = Archive.RootPath;
|
var root = Archive.RootPath;
|
||||||
var folders = await Task.Run(() => ArchiveScanner.FindSequenceFolders(new ArchivePaths(root)));
|
var folders = await Task.Run(() => ArchiveScanner.FindSequenceFolders(new ArchivePaths(root)));
|
||||||
FactRows = Facts(folders);
|
FactRows = Facts(folders, null);
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Counting sidecars failed", ex);
|
Log.Warning("archive", "Counting sidecars failed", ex);
|
||||||
|
FactRows = Facts(null, ArchiveFailures.Cause(ex));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -120,19 +147,24 @@ public sealed class RebuildDialogViewModel : ArchiveDialogViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Shows counts computed elsewhere (capture).</summary>
|
/// <summary>Shows counts computed elsewhere (capture).</summary>
|
||||||
public void ShowFolders(IReadOnlyList<SequenceFolder> folders) => FactRows = Facts(folders);
|
public void ShowFolders(IReadOnlyList<SequenceFolder> folders) => FactRows = Facts(folders, null);
|
||||||
|
|
||||||
private IReadOnlyList<DialogFact> Facts(IReadOnlyList<SequenceFolder>? folders)
|
/// <param name="folders">The counted folders; null while counting or when they cannot be counted.</param>
|
||||||
|
/// <param name="uncounted">Why the folders cannot be counted; null while counting.</param>
|
||||||
|
private IReadOnlyList<DialogFact> Facts(IReadOnlyList<SequenceFolder>? folders, string? uncounted)
|
||||||
{
|
{
|
||||||
var waiting = Loc.L("Archive.Rebuild.Counting");
|
DialogFact Count(string label, Func<SequenceFolder, bool> counted) =>
|
||||||
|
folders is not null ? new(label, Formatting.Count(folders.Count(counted)))
|
||||||
|
: uncounted is not null ? new(label, "—", Reason: uncounted)
|
||||||
|
: new(label, Loc.L("Archive.Rebuild.Counting"));
|
||||||
return
|
return
|
||||||
[
|
[
|
||||||
new(Loc.L("Archive.Rebuild.Archive"), Archive.Name),
|
new(Loc.L("Archive.Rebuild.Archive"), Archive.Name),
|
||||||
new(Loc.L("Archive.Rebuild.Root"), Archive.RootPath),
|
new(Loc.L("Archive.Rebuild.Root"), Archive.RootPath, IsPath: true),
|
||||||
new(Loc.L("Archive.Rebuild.State"), Loc.L("Archive.Availability." + Availability)),
|
new(Loc.L("Archive.Rebuild.State"), Loc.L("Archive.Availability." + Availability)),
|
||||||
new(Loc.L("Archive.Rebuild.Indexed"), Loc.Plural("Shell.Status.Sequences", Indexed)),
|
new(Loc.L("Archive.Rebuild.Indexed"), Loc.Plural("Shell.Status.Sequences", Indexed)),
|
||||||
new(Loc.L("Archive.Rebuild.Sidecars"), folders is null ? waiting : Formatting.Count(folders.Count(f => f.Sidecar is not null))),
|
Count(Loc.L("Archive.Rebuild.Sidecars"), f => f.Sidecar is not null),
|
||||||
new(Loc.L("Archive.Rebuild.Metadata"), folders is null ? waiting : Formatting.Count(folders.Count(f => f.Sidecar is null))),
|
Count(Loc.L("Archive.Rebuild.Metadata"), f => f.Sidecar is null),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,6 +195,7 @@ public sealed class RenameDialogViewModel : ArchiveDialogViewModel
|
|||||||
private readonly Func<int, Task> _applied;
|
private readonly Func<int, Task> _applied;
|
||||||
private readonly DispatcherTimer _delay = new() { Interval = TimeSpan.FromMilliseconds(400) };
|
private readonly DispatcherTimer _delay = new() { Interval = TimeSpan.FromMilliseconds(400) };
|
||||||
private RenamePlan? _plan;
|
private RenamePlan? _plan;
|
||||||
|
private string? _planError;
|
||||||
private IReadOnlyList<RenameRow> _rows = [];
|
private IReadOnlyList<RenameRow> _rows = [];
|
||||||
private CancellationTokenSource? _planning;
|
private CancellationTokenSource? _planning;
|
||||||
|
|
||||||
@@ -196,7 +229,7 @@ public sealed class RenameDialogViewModel : ArchiveDialogViewModel
|
|||||||
private string? ApplyBlocker =>
|
private string? ApplyBlocker =>
|
||||||
IsBusy ? Loc.L("Archive.Blocked.Applying")
|
IsBusy ? Loc.L("Archive.Blocked.Applying")
|
||||||
: Template.Error is { } error ? error
|
: Template.Error is { } error ? error
|
||||||
: _plan is null ? Loc.L("Archive.Blocked.Planning")
|
: _plan is null ? _planError ?? Loc.L("Archive.Blocked.Planning")
|
||||||
: _plan.Steps.Count == 0 ? Loc.L("Archive.Blocked.NoChanges")
|
: _plan.Steps.Count == 0 ? Loc.L("Archive.Blocked.NoChanges")
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
@@ -221,14 +254,20 @@ public sealed class RenameDialogViewModel : ArchiveDialogViewModel
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The dry run of the current template (the engine's plan; nothing changes on disk).</summary>
|
/// <summary>The dry run of the current template (the engine's plan; nothing changes on disk); it clears the last failure.</summary>
|
||||||
public async Task PlanAsync()
|
public Task PlanAsync()
|
||||||
|
{
|
||||||
|
ClearError();
|
||||||
|
return DryRunAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task DryRunAsync()
|
||||||
{
|
{
|
||||||
_planning?.Cancel();
|
_planning?.Cancel();
|
||||||
_plan = null;
|
_plan = null;
|
||||||
|
_planError = null;
|
||||||
Rows = [];
|
Rows = [];
|
||||||
OnPropertyChanged(nameof(SummaryText));
|
OnPlanChanged();
|
||||||
OnPropertyChanged(nameof(ApplyToolTip));
|
|
||||||
if (Template.HasErrors) return;
|
if (Template.HasErrors) return;
|
||||||
var cts = _planning = new CancellationTokenSource();
|
var cts = _planning = new CancellationTokenSource();
|
||||||
var template = Template.Text;
|
var template = Template.Text;
|
||||||
@@ -240,41 +279,57 @@ public sealed class RenameDialogViewModel : ArchiveDialogViewModel
|
|||||||
if (cts.IsCancellationRequested) return;
|
if (cts.IsCancellationRequested) return;
|
||||||
_plan = plan;
|
_plan = plan;
|
||||||
Rows = MassRename.Rows(plan, Mode);
|
Rows = MassRename.Rows(plan, Mode);
|
||||||
OnPropertyChanged(nameof(SummaryText));
|
|
||||||
OnPropertyChanged(nameof(ApplyToolTip));
|
|
||||||
CommandManager.InvalidateRequerySuggested();
|
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) when (cts.IsCancellationRequested)
|
catch (OperationCanceledException) when (cts.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is ArgumentException or DatabaseException or FormatException)
|
catch (Exception ex) when (ex is ArgumentException or DatabaseException or FormatException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Rename plan failed", ex);
|
Log.Warning("archive", "Rename plan failed", ex);
|
||||||
BusyText = ex.Message;
|
_planError = ArchiveFailures.Cause(ex);
|
||||||
|
ShowError(ex);
|
||||||
}
|
}
|
||||||
|
OnPlanChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnPlanChanged()
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(SummaryText));
|
||||||
|
OnPropertyChanged(nameof(ApplyToolTip));
|
||||||
|
CommandManager.InvalidateRequerySuggested();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ApplyAsync()
|
private async Task ApplyAsync()
|
||||||
{
|
{
|
||||||
if (_plan is not { } plan) return;
|
if (_plan is not { } plan) return;
|
||||||
|
ClearError();
|
||||||
IsBusy = true;
|
IsBusy = true;
|
||||||
var progress = new Progress<int>(n => BusyText = Loc.L("Archive.Rename.Applying", Formatting.Count(n), Formatting.Count(plan.Steps.Count)));
|
// A tick posted before the apply ended must not bring its progress back.
|
||||||
|
var progress = new Progress<int>(n =>
|
||||||
|
{
|
||||||
|
if (IsBusy) BusyText = Loc.L("Archive.Rename.Applying", Formatting.Count(n), Formatting.Count(plan.Steps.Count));
|
||||||
|
});
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Task.Run(() => _archives.ApplyRenameAsync(plan, progress));
|
await Task.Run(() => _archives.ApplyRenameAsync(plan, progress));
|
||||||
Log.Info("archive", $"{Mode} applied to {plan.Steps.Count} sequence(s)");
|
Log.Info("archive", $"{Mode} applied to {plan.Steps.Count} sequence(s)");
|
||||||
await _applied(plan.Steps.Count);
|
await _applied(plan.Steps.Count);
|
||||||
Close();
|
Close();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or StaleRenamePlanException or ArchiveOfflineException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or StaleRenamePlanException or DatabaseException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Rename failed", ex);
|
Log.Warning("archive", "Rename failed", ex);
|
||||||
BusyText = ex.Message;
|
ShowError(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
BusyText = null;
|
||||||
}
|
}
|
||||||
|
// Part of the plan may have been applied, or the archive changed under it: the dry run shows what is left.
|
||||||
|
await DryRunAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,6 +393,7 @@ public sealed class RetagDialogViewModel : ArchiveDialogViewModel
|
|||||||
var changes = Changes();
|
var changes = Changes();
|
||||||
var run = _run = new CancellationTokenSource();
|
var run = _run = new CancellationTokenSource();
|
||||||
var done = 0;
|
var done = 0;
|
||||||
|
ClearError();
|
||||||
IsBusy = true;
|
IsBusy = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -351,16 +407,17 @@ public sealed class RetagDialogViewModel : ArchiveDialogViewModel
|
|||||||
await _applied(done);
|
await _applied(done);
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or DatabaseException or ArchiveOfflineException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or DatabaseException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Retag failed", ex);
|
Log.Warning("archive", "Retag failed", ex);
|
||||||
BusyText = ex.Message;
|
ShowError(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_run = null;
|
_run = null;
|
||||||
run.Dispose();
|
run.Dispose();
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
BusyText = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,42 @@
|
|||||||
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
||||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||||
xmlns:ar="clr-namespace:Titano.App.Archiving"
|
xmlns:ar="clr-namespace:Titano.App.Archiving"
|
||||||
|
xmlns:infra="clr-namespace:Titano.App.Infrastructure"
|
||||||
xmlns:shell="clr-namespace:Titano.App.Shell">
|
xmlns:shell="clr-namespace:Titano.App.Shell">
|
||||||
<!-- In-window dialogs of the archive engine's operations, shared by the Archive manager and the Library. -->
|
<!-- In-window dialogs of the archive engine's operations, shared by the Archive manager and the Library. -->
|
||||||
<!-- Rows that only show text: focusable, so the arrow keys move through a long list. -->
|
<!-- Rows that only show text: focusable, so the arrow keys move through a long list. -->
|
||||||
<Style x:Key="ListBoxItem.Preview" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Row}">
|
<Style x:Key="ListBoxItem.Preview" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.Row}">
|
||||||
<Setter Property="Padding" Value="0" />
|
<Setter Property="Padding" Value="0" />
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||||
<Setter Property="AutomationProperties.Name" Value="{Binding To}" />
|
<Setter Property="AutomationProperties.Name" Value="{Binding To}" />
|
||||||
|
<Setter Property="AutomationProperties.HelpText" Value="{Binding From}" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<!-- Dialog labels: a column at least 116 px wide that grows with the longest label (DESIGN §2: no fixed-width labels). -->
|
||||||
|
<Style x:Key="Text.DialogLabel" TargetType="TextBlock" BasedOn="{StaticResource Text.Label}">
|
||||||
|
<Setter Property="TextTrimming" Value="None" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- A status line screen readers announce when it changes. -->
|
||||||
|
<Style x:Key="Text.Live" TargetType="TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||||
|
<Setter Property="AutomationProperties.LiveSetting" Value="Polite" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- A dialog's failure: one sentence in the error colour with its glyph, the engine's own text in the tooltip, announced at once. -->
|
||||||
|
<Style x:Key="Status.DialogError" TargetType="ui:StatusGlyph" BasedOn="{StaticResource {x:Type ui:StatusGlyph}}">
|
||||||
|
<Setter Property="Kind" Value="Error" />
|
||||||
|
<Setter Property="FontSize" Value="12" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Text" Value="{Binding ErrorText}" />
|
||||||
|
<Setter Property="ToolTip" Value="{Binding ErrorToolTip}" />
|
||||||
|
<Setter Property="AutomationProperties.LiveSetting" Value="Assertive" />
|
||||||
|
<Setter Property="infra:LiveRegion.Text" Value="{Binding ErrorText}" />
|
||||||
|
<Setter Property="Visibility" Value="{Binding ErrorText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<!-- Dialog card (DESIGN §4: Surface, Stroke, radius 12, 24 px shadow, two buttons). -->
|
<!-- Dialog card (DESIGN §4: Surface, Stroke, radius 12, 24 px shadow, two buttons). -->
|
||||||
<Style x:Key="Border.Dialog" TargetType="Border">
|
<Style x:Key="Border.Dialog" TargetType="Border">
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.Surface}" />
|
<Setter Property="Background" Value="{DynamicResource Brush.Surface}" />
|
||||||
@@ -26,21 +55,29 @@
|
|||||||
<Border Style="{StaticResource Border.Dialog}" Width="520">
|
<Border Style="{StaticResource Border.Dialog}" Width="520">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="{l:Loc Archive.Rebuild.Heading}" Style="{StaticResource Text.Title}" />
|
<TextBlock Text="{l:Loc Archive.Rebuild.Heading}" Style="{StaticResource Text.Title}" />
|
||||||
<ItemsControl ItemsSource="{Binding FactRows}" Focusable="False" Margin="0,14,0,0">
|
<ItemsControl ItemsSource="{Binding FactRows}" Focusable="False" Margin="0,14,0,0" Grid.IsSharedSizeScope="True">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type ar:DialogFact}">
|
<DataTemplate DataType="{x:Type ar:DialogFact}">
|
||||||
<Grid Margin="0,0,0,8">
|
<Grid Margin="0,0,0,8">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="{StaticResource Grid.LabelColumn}" />
|
<ColumnDefinition Width="Auto" MinWidth="116" SharedSizeGroup="FactLabel" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Text="{Binding Label}" Style="{StaticResource Text.Label}" />
|
<TextBlock Text="{Binding Label}" Style="{StaticResource Text.DialogLabel}" />
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Value}" TextTrimming="CharacterEllipsis" ToolTip="{Binding Value}" Typography.NumeralAlignment="Tabular" />
|
<TextBlock x:Name="Value" Grid.Column="1" Text="{Binding Value}" TextTrimming="CharacterEllipsis" ToolTip="{Binding ToolTip}"
|
||||||
|
Typography.NumeralAlignment="Tabular" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsPath}" Value="True">
|
||||||
|
<Setter TargetName="Value" Property="FlowDirection" Value="LeftToRight" />
|
||||||
|
<Setter TargetName="Value" Property="HorizontalAlignment" Value="Left" />
|
||||||
|
</DataTrigger>
|
||||||
|
</DataTemplate.Triggers>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" Visibility="{Binding BusyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
<TextBlock Style="{StaticResource Text.Live}" Text="{Binding BusyText}" infra:LiveRegion.Text="{Binding BusyText}"
|
||||||
|
Visibility="{Binding BusyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,18,0,0">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,18,0,0">
|
||||||
<Button Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsDefault="True" IsCancel="True"
|
<Button Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsDefault="True" IsCancel="True"
|
||||||
MinWidth="96" />
|
MinWidth="96" />
|
||||||
@@ -64,12 +101,14 @@
|
|||||||
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" />
|
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" />
|
||||||
<Grid Grid.Row="1" Margin="0,14,0,0">
|
<Grid Grid.Row="1" Margin="0,14,0,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="{StaticResource Grid.LabelColumn}" />
|
<ColumnDefinition Width="Auto" MinWidth="116" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Text="{l:Loc Archive.Rename.Template}" Style="{StaticResource Text.Label}" />
|
<TextBlock Text="{l:Loc Archive.Rename.Template}" Style="{StaticResource Text.DialogLabel}" />
|
||||||
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Mono}" Text="{Binding Template.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
<!-- A naming template keeps its tokens and separators in order in every language. -->
|
||||||
shell:EditBehavior.Field="{Binding Template}" ToolTip="{Binding Template.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Rename.Template}" />
|
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Mono}" FlowDirection="LeftToRight"
|
||||||
|
Text="{Binding Template.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding Template}"
|
||||||
|
ToolTip="{Binding Template.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Rename.Template}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock Grid.Row="2" Text="{Binding SummaryText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,12,0,6" Typography.NumeralAlignment="Tabular" />
|
<TextBlock Grid.Row="2" Text="{Binding SummaryText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,12,0,6" Typography.NumeralAlignment="Tabular" />
|
||||||
<ListBox Grid.Row="3" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.Preview}" MinHeight="120"
|
<ListBox Grid.Row="3" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.Preview}" MinHeight="120"
|
||||||
@@ -82,19 +121,31 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="*" MinWidth="120" />
|
<ColumnDefinition Width="*" MinWidth="120" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding From}" Foreground="{DynamicResource Brush.TextMuted}" ToolTip="{Binding From}" />
|
<TextBlock x:Name="From" Style="{StaticResource Text.Cell}" Text="{Binding From}" Foreground="{DynamicResource Brush.TextMuted}" ToolTip="{Binding From}" />
|
||||||
<ui:Icon Grid.Column="1" Glyph="{StaticResource Icon.Forward}" Margin="10,0" Foreground="{DynamicResource Brush.TextFaint}" />
|
<ui:Icon Grid.Column="1" Glyph="{StaticResource Icon.Forward}" Margin="10,0" VerticalAlignment="Center" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding To}" ToolTip="{Binding To}" />
|
<TextBlock x:Name="To" Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding To}" ToolTip="{Binding To}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<!-- Move lists folders: paths stay left to right; Rename lists titles, which read in the language's direction. -->
|
||||||
|
<DataTrigger Binding="{Binding DataContext.Mode, RelativeSource={RelativeSource AncestorType=ListBox}}" Value="Folders">
|
||||||
|
<Setter TargetName="From" Property="FlowDirection" Value="LeftToRight" />
|
||||||
|
<Setter TargetName="From" Property="HorizontalAlignment" Value="Left" />
|
||||||
|
<Setter TargetName="To" Property="FlowDirection" Value="LeftToRight" />
|
||||||
|
<Setter TargetName="To" Property="HorizontalAlignment" Value="Left" />
|
||||||
|
</DataTrigger>
|
||||||
|
</DataTemplate.Triggers>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
<DockPanel Grid.Row="4" Margin="0,16,0,0">
|
<DockPanel Grid.Row="4" Margin="0,16,0,0">
|
||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Content="{l:Loc Archive.Rename.Apply}" Command="{Binding ApplyCommand}"
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Content="{l:Loc Archive.Rename.Apply}" Command="{Binding ApplyCommand}"
|
||||||
ToolTip="{Binding ApplyToolTip}" MinWidth="96" Margin="8,0,0,0" />
|
ToolTip="{Binding ApplyToolTip}" MinWidth="96" Margin="8,0,0,0" />
|
||||||
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsCancel="True"
|
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsDefault="True"
|
||||||
MinWidth="96" />
|
IsCancel="True" MinWidth="96" />
|
||||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
<Grid Margin="0,0,12,0">
|
||||||
|
<TextBlock Style="{StaticResource Text.Live}" Text="{Binding BusyText}" infra:LiveRegion.Text="{Binding BusyText}" Typography.NumeralAlignment="Tabular" />
|
||||||
|
<ui:StatusGlyph Style="{StaticResource Status.DialogError}" />
|
||||||
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -106,17 +157,17 @@
|
|||||||
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" />
|
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" />
|
||||||
<Grid Margin="0,14,0,0">
|
<Grid Margin="0,14,0,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="{StaticResource Grid.LabelColumn}" />
|
<ColumnDefinition Width="Auto" MinWidth="116" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Text="{l:Loc Archive.Retag.Add}" Style="{StaticResource Text.Label}" />
|
<TextBlock Text="{l:Loc Archive.Retag.Add}" Style="{StaticResource Text.DialogLabel}" />
|
||||||
<TextBox Grid.Column="1" Text="{Binding Add.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding Add}"
|
<TextBox Grid.Column="1" Text="{Binding Add.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding Add}"
|
||||||
ToolTip="{Binding Add.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Retag.Add}" />
|
ToolTip="{Binding Add.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Retag.Add}" />
|
||||||
<TextBlock Grid.Row="1" Text="{l:Loc Archive.Retag.Remove}" Style="{StaticResource Text.Label}" Margin="0,10,14,0" />
|
<TextBlock Grid.Row="1" Text="{l:Loc Archive.Retag.Remove}" Style="{StaticResource Text.DialogLabel}" Margin="0,10,14,0" />
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" Text="{Binding Remove.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
<TextBox Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" Text="{Binding Remove.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||||
shell:EditBehavior.Field="{Binding Remove}" ToolTip="{Binding Remove.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Retag.Remove}" />
|
shell:EditBehavior.Field="{Binding Remove}" ToolTip="{Binding Remove.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Retag.Remove}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -124,9 +175,12 @@
|
|||||||
<DockPanel Margin="0,18,0,0">
|
<DockPanel Margin="0,18,0,0">
|
||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Content="{l:Loc Archive.Retag.Apply}" Command="{Binding ApplyCommand}"
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Content="{l:Loc Archive.Retag.Apply}" Command="{Binding ApplyCommand}"
|
||||||
ToolTip="{Binding ApplyToolTip}" MinWidth="96" Margin="8,0,0,0" />
|
ToolTip="{Binding ApplyToolTip}" MinWidth="96" Margin="8,0,0,0" />
|
||||||
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsCancel="True"
|
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsDefault="True"
|
||||||
MinWidth="96" />
|
IsCancel="True" MinWidth="96" />
|
||||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
<Grid Margin="0,0,12,0">
|
||||||
|
<TextBlock Style="{StaticResource Text.Live}" Text="{Binding BusyText}" infra:LiveRegion.Text="{Binding BusyText}" Typography.NumeralAlignment="Tabular" />
|
||||||
|
<ui:StatusGlyph Style="{StaticResource Status.DialogError}" />
|
||||||
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -142,8 +196,8 @@
|
|||||||
<DockPanel Margin="0,18,0,0">
|
<DockPanel Margin="0,18,0,0">
|
||||||
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsCancel="True"
|
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsCancel="True"
|
||||||
IsDefault="True" MinWidth="96" />
|
IsDefault="True" MinWidth="96" />
|
||||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"
|
<TextBlock Style="{StaticResource Text.Live}" Text="{Binding BusyText}" infra:LiveRegion.Text="{Binding BusyText}" Typography.NumeralAlignment="Tabular"
|
||||||
Typography.NumeralAlignment="Tabular" Margin="0,0,12,0" />
|
Margin="0,0,12,0" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -188,7 +242,10 @@
|
|||||||
<DockPanel Grid.Row="3" Margin="0,16,0,0">
|
<DockPanel Grid.Row="3" Margin="0,16,0,0">
|
||||||
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Close}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsCancel="True"
|
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Close}" Command="{Binding CloseCommand}" ToolTip="{Binding CloseToolTip}" IsCancel="True"
|
||||||
IsDefault="True" MinWidth="96" />
|
IsDefault="True" MinWidth="96" />
|
||||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
<Grid Margin="0,0,12,0">
|
||||||
|
<TextBlock Style="{StaticResource Text.Live}" Text="{Binding BusyText}" infra:LiveRegion.Text="{Binding BusyText}" />
|
||||||
|
<ui:StatusGlyph Style="{StaticResource Status.DialogError}" />
|
||||||
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
using Titano.App.Infrastructure;
|
||||||
|
using Titano.Core.Archiving;
|
||||||
|
using Titano.Core.Localization;
|
||||||
|
using Titano.Data;
|
||||||
|
using Titano.Data.Archiving;
|
||||||
|
|
||||||
|
namespace Titano.App.Archiving;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Why an Archive screen action stopped, as one localized sentence chosen by cause (BRIEF §0.2 rule 6). The
|
||||||
|
/// exception's own text, which may be technical or unlocalized, goes to the tooltip and the log only.
|
||||||
|
/// </summary>
|
||||||
|
public static class ArchiveFailures
|
||||||
|
{
|
||||||
|
public static string Cause(Exception ex) => ex switch
|
||||||
|
{
|
||||||
|
ArchiveOfflineException offline => Loc.L(offline.Availability == ArchiveAvailability.ReadOnly ? "Archive.Error.ReadOnly" : "Archive.Error.Offline",
|
||||||
|
Formatting.LeftToRight(offline.Root)),
|
||||||
|
// Already one localized sentence each.
|
||||||
|
LeaseUnavailableException or NewerFormatException or StaleRenamePlanException or StaleDeletePlanException or SequenceInLibraryException => ex.Message,
|
||||||
|
UnauthorizedAccessException => Loc.L("Archive.Failed.Access"),
|
||||||
|
DatabaseException => Loc.L("Archive.Failed.Index"),
|
||||||
|
ArgumentException => Loc.L("Archive.Failed.Gone"),
|
||||||
|
_ => Loc.L("Archive.Failed.Files"),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ public enum HealthAction
|
|||||||
Proxies,
|
Proxies,
|
||||||
Analyse,
|
Analyse,
|
||||||
Duplicates,
|
Duplicates,
|
||||||
|
MarkDuplicates,
|
||||||
Orphans,
|
Orphans,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ public static class ArchiveFigures
|
|||||||
var years = stats.ByYear.Select(y => y.Year).ToList();
|
var years = stats.ByYear.Select(y => y.Year).ToList();
|
||||||
var range = years.Count == 0 ? "—"
|
var range = years.Count == 0 ? "—"
|
||||||
: years.Min() == years.Max() ? Year(years.Min())
|
: years.Min() == years.Max() ? Year(years.Min())
|
||||||
: Loc.L("Archive.Tile.YearRange", Year(years.Min()), Year(years.Max()));
|
: Formatting.LeftToRight(Loc.L("Archive.Tile.YearRange", Year(years.Min()), Year(years.Max())));
|
||||||
var cameras = stats.ByCamera.Count(c => !string.IsNullOrWhiteSpace(c.Model) || !string.IsNullOrWhiteSpace(c.Make));
|
var cameras = stats.ByCamera.Count(c => !string.IsNullOrWhiteSpace(c.Model) || !string.IsNullOrWhiteSpace(c.Make));
|
||||||
return
|
return
|
||||||
[
|
[
|
||||||
@@ -56,9 +57,22 @@ public static class ArchiveFigures
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Culture month initials for the heatmap columns ("J F M …", "G F M …").</summary>
|
/// <summary>
|
||||||
public static IReadOnlyList<string> MonthLabels() =>
|
/// The heatmap columns: month initials where the culture's month names start with a letter of a cased alphabet
|
||||||
[.. Loc.Culture.DateTimeFormat.AbbreviatedMonthNames.Take(12).Select(m => m.Length == 0 ? string.Empty : char.ToUpper(m[0], Loc.Culture).ToString())];
|
/// ("J F M …", "G F M …"); month numbers in every other language, whose abbreviations are numbered ("1月",
|
||||||
|
/// "Tháng 1"), start alike or do not abbreviate to one letter (Thai, Arabic, Hebrew, Persian).
|
||||||
|
/// </summary>
|
||||||
|
public static IReadOnlyList<string> MonthLabels()
|
||||||
|
{
|
||||||
|
var culture = Loc.Culture;
|
||||||
|
var names = culture.DateTimeFormat.AbbreviatedMonthNames.Take(12).ToList();
|
||||||
|
return names.All(HasInitial)
|
||||||
|
? [.. names.Select(m => char.ToUpper(m[0], culture).ToString())]
|
||||||
|
: [.. Enumerable.Range(1, 12).Select(month => month.ToString("N0", culture))];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool HasInitial(string month) =>
|
||||||
|
month.Length > 0 && char.IsLetter(month[0]) && char.ToUpperInvariant(month[0]) != char.ToLowerInvariant(month[0]) && !month.Any(char.IsDigit);
|
||||||
|
|
||||||
/// <summary>One row per year from the first to the last with photos, oldest first; months after <paramref name="today"/> are NaN.</summary>
|
/// <summary>One row per year from the first to the last with photos, oldest first; months after <paramref name="today"/> are NaN.</summary>
|
||||||
public static IReadOnlyList<HeatRow> PhotosPerMonth(ArchiveStats stats, DateTime today)
|
public static IReadOnlyList<HeatRow> PhotosPerMonth(ArchiveStats stats, DateTime today)
|
||||||
@@ -125,8 +139,11 @@ public static class ArchiveFigures
|
|||||||
_ => format.ToString().ToUpperInvariant(),
|
_ => format.ToString().ToUpperInvariant(),
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>Index health (Archive.html): what needs attention, each with its fix.</summary>
|
/// <summary>
|
||||||
public static IReadOnlyList<HealthLine> Health(ArchiveStats stats, int withoutProxies)
|
/// Index health (Archive.html): what needs attention, each with its fix. Duplicates follow the last duplicates
|
||||||
|
/// search (<paramref name="duplicateGroups"/>, groups found by hash); before one, the copies already flagged.
|
||||||
|
/// </summary>
|
||||||
|
public static IReadOnlyList<HealthLine> Health(ArchiveStats stats, int withoutProxies, int? duplicateGroups = null)
|
||||||
{
|
{
|
||||||
var h = stats.Health;
|
var h = stats.Health;
|
||||||
var damaged = h.MissingFrames + h.CorruptFrames;
|
var damaged = h.MissingFrames + h.CorruptFrames;
|
||||||
@@ -144,12 +161,18 @@ public static class ArchiveFigures
|
|||||||
h.NotAnalyzed == 0
|
h.NotAnalyzed == 0
|
||||||
? new HealthLine(true, Loc.L("Archive.Health.AnalysedOk"), HealthAction.None)
|
? new HealthLine(true, Loc.L("Archive.Health.AnalysedOk"), HealthAction.None)
|
||||||
: new HealthLine(false, Loc.Plural("Archive.Health.NotAnalysed", h.NotAnalyzed), HealthAction.Analyse),
|
: new HealthLine(false, Loc.Plural("Archive.Health.NotAnalysed", h.NotAnalyzed), HealthAction.Analyse),
|
||||||
h.DuplicateFrames == 0
|
Duplicates(h.DuplicateFrames, duplicateGroups),
|
||||||
? new HealthLine(true, Loc.L("Archive.Health.NoDuplicates"), HealthAction.None)
|
|
||||||
: new HealthLine(false, Loc.Plural("Archive.Health.Duplicates", h.DuplicateFrames), HealthAction.Duplicates),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HealthLine Duplicates(long flagged, int? groups) => groups switch
|
||||||
|
{
|
||||||
|
0 => new HealthLine(true, Loc.L("Archive.Health.NoDuplicates"), HealthAction.None),
|
||||||
|
{ } found => new HealthLine(false, Loc.Plural("Archive.Health.DuplicateGroups", found), HealthAction.MarkDuplicates),
|
||||||
|
null when flagged == 0 => new HealthLine(true, Loc.L("Archive.Health.NoneFlagged"), HealthAction.None),
|
||||||
|
null => new HealthLine(false, Loc.Plural("Archive.Health.Duplicates", flagged), HealthAction.Duplicates),
|
||||||
|
};
|
||||||
|
|
||||||
private static IReadOnlyList<BarValue> Shares(List<(string Name, long Photos)> ranked, int top, Func<int, string> restLabel, long total)
|
private static IReadOnlyList<BarValue> Shares(List<(string Name, long Photos)> ranked, int top, Func<int, string> restLabel, long total)
|
||||||
{
|
{
|
||||||
var bars = new List<BarValue>(top + 1);
|
var bars = new List<BarValue>(top + 1);
|
||||||
|
|||||||
@@ -24,8 +24,18 @@ public sealed class ArchiveTreeRowViewModel(ArchiveTreeNode node, ArchiveAvailab
|
|||||||
|
|
||||||
public string ToggleToolTip => Loc.L(Node.IsExpanded ? "Tooltips.Archive.Collapse" : "Tooltips.Archive.Expand");
|
public string ToggleToolTip => Loc.L(Node.IsExpanded ? "Tooltips.Archive.Collapse" : "Tooltips.Archive.Expand");
|
||||||
|
|
||||||
/// <summary>The row's figures; a year also says how the keyboard opens and closes it.</summary>
|
/// <summary>
|
||||||
public string RowToolTip => IsYear ? Loc.L("Tooltips.Archive.YearRow", Detail) : Detail;
|
/// The full title (the tree trims it) and its figures; a year also says how the keyboard opens and closes it, with
|
||||||
|
/// the arrow keys swapped in a right-to-left layout.
|
||||||
|
/// </summary>
|
||||||
|
public string RowToolTip
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var text = Title + " · " + Detail;
|
||||||
|
return IsYear ? Loc.L(Loc.IsRightToLeft ? "Tooltips.Archive.YearRowRtl" : "Tooltips.Archive.YearRow", text) : text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ICommand ToggleCommand { get; } = new RelayCommand(() => toggle(node));
|
public ICommand ToggleCommand { get; } = new RelayCommand(() => toggle(node));
|
||||||
|
|
||||||
@@ -42,12 +52,12 @@ public sealed class ArchiveTreeRowViewModel(ArchiveTreeNode node, ArchiveAvailab
|
|||||||
public string AvailabilityToolTip => Loc.L("Tooltips.Archive.Availability." + availability);
|
public string AvailabilityToolTip => Loc.L("Tooltips.Archive.Availability." + availability);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>A line of "Index health" with its fix.</summary>
|
/// <summary>A line of "Index health" with its fix: ● ok or ▲ needs attention.</summary>
|
||||||
public sealed class HealthLineViewModel(HealthLine line, ICommand? fix) : ObservableObject
|
public sealed class HealthLineViewModel(HealthLine line, ICommand? fix) : ObservableObject
|
||||||
{
|
{
|
||||||
public HealthLine Line { get; } = line;
|
public HealthLine Line { get; } = line;
|
||||||
public string Text => Line.Text;
|
public string Text => Line.Text;
|
||||||
public StatusKind Kind => Line.IsOk ? StatusKind.Done : StatusKind.Warning;
|
public bool IsOk => Line.IsOk;
|
||||||
public string KindToolTip => Loc.L(Line.IsOk ? "Tooltips.Archive.HealthOk" : "Tooltips.Archive.HealthWarning");
|
public string KindToolTip => Loc.L(Line.IsOk ? "Tooltips.Archive.HealthOk" : "Tooltips.Archive.HealthWarning");
|
||||||
public bool HasFix => FixCommand is not null && Line.Action != HealthAction.None;
|
public bool HasFix => FixCommand is not null && Line.Action != HealthAction.None;
|
||||||
public ICommand? FixCommand { get; } = fix;
|
public ICommand? FixCommand { get; } = fix;
|
||||||
@@ -64,11 +74,10 @@ public sealed class DuplicateRowViewModel(DuplicateRow row, ICommand open, IComm
|
|||||||
public ICommand RevealCommand { get; } = reveal;
|
public ICommand RevealCommand { get; } = reveal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>An orphan line with its fix (index, reconcile, remove the row, scan).</summary>
|
/// <summary>An orphan line with its fix (index, reconcile, remove the row, scan); every kind is a ▲ warning the fix resolves.</summary>
|
||||||
public sealed class OrphanRowViewModel(OrphanRow row, ICommand fix) : ObservableObject
|
public sealed class OrphanRowViewModel(OrphanRow row, ICommand fix) : ObservableObject
|
||||||
{
|
{
|
||||||
public OrphanRow Row { get; } = row;
|
public OrphanRow Row { get; } = row;
|
||||||
public StatusKind Kind => Row.Kind is OrphanKind.MissingFiles or OrphanKind.MissingSequence ? StatusKind.Warning : StatusKind.Queued;
|
|
||||||
public string KindText => Loc.L("Archive.Orphans.Kind." + Row.Kind);
|
public string KindText => Loc.L("Archive.Orphans.Kind." + Row.Kind);
|
||||||
public ICommand FixCommand { get; } = fix;
|
public ICommand FixCommand { get; } = fix;
|
||||||
public string FixText => Loc.L("Archive.Orphans.Fix." + Row.Kind);
|
public string FixText => Loc.L("Archive.Orphans.Fix." + Row.Kind);
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public sealed class DeleteDialogViewModel : ArchiveDialogViewModel
|
|||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or DatabaseException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or DatabaseException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Delete dry run failed", ex);
|
Log.Warning("archive", "Delete dry run failed", ex);
|
||||||
_shell.Notify(Loc.L("Archive.Delete.Failed"), ex.Message);
|
_shell.Notify(Loc.L("Archive.Delete.Failed"), ArchiveFailures.Cause(ex));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ public sealed class DeleteDialogViewModel : ArchiveDialogViewModel
|
|||||||
await SequenceDeletion.RefreshAsync(_shell);
|
await SequenceDeletion.RefreshAsync(_shell);
|
||||||
var undo = moved.Count == 0 ? null : new AsyncRelayCommand(() => SequenceDeletion.RestoreAsync(_shell, moved));
|
var undo = moved.Count == 0 ? null : new AsyncRelayCommand(() => SequenceDeletion.RestoreAsync(_shell, moved));
|
||||||
if (failure is not null)
|
if (failure is not null)
|
||||||
_shell.Notify(Loc.L("Archive.Delete.Failed"), failure.Message, undo is null ? null : Loc.L("Archive.Delete.Undo"), Loc.L("Tooltips.Archive.DeleteUndo"),
|
_shell.Notify(Loc.L("Archive.Delete.Failed"), ArchiveFailures.Cause(failure), undo is null ? null : Loc.L("Archive.Delete.Undo"), Loc.L("Tooltips.Archive.DeleteUndo"),
|
||||||
undo is null ? null : () => undo.Execute(null));
|
undo is null ? null : () => undo.Execute(null));
|
||||||
else if (moved.Count > 0)
|
else if (moved.Count > 0)
|
||||||
_shell.Notify(Loc.Plural("Archive.Delete.Done", moved.Count), Loc.L("Archive.Delete.Kept"), Loc.L("Archive.Delete.Undo"),
|
_shell.Notify(Loc.Plural("Archive.Delete.Done", moved.Count), Loc.L("Archive.Delete.Kept"), Loc.L("Archive.Delete.Undo"),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Titano.Core.Localization;
|
|||||||
using Titano.Core.Model;
|
using Titano.Core.Model;
|
||||||
using Titano.Data.Archiving;
|
using Titano.Data.Archiving;
|
||||||
using Titano.Data.Repositories;
|
using Titano.Data.Repositories;
|
||||||
|
using Titano.Ui.Controls;
|
||||||
|
|
||||||
namespace Titano.App.Archiving;
|
namespace Titano.App.Archiving;
|
||||||
|
|
||||||
@@ -30,11 +31,26 @@ public enum OrphanKind
|
|||||||
public sealed record OrphanRow(OrphanKind Kind, string Title, string Detail, Guid? SequenceId);
|
public sealed record OrphanRow(OrphanKind Kind, string Title, string Detail, Guid? SequenceId);
|
||||||
|
|
||||||
/// <summary>A line of "Recent maintenance": date, operation and outcome.</summary>
|
/// <summary>A line of "Recent maintenance": date, operation and outcome.</summary>
|
||||||
public sealed record MaintenanceRow(Guid JobId, string DateText, string Text, string StateText, JobState State);
|
public sealed record MaintenanceRow(Guid JobId, string DateText, string Text, string StateText, JobState State)
|
||||||
|
{
|
||||||
|
/// <summary>The outcome's glyph and colour, as on the Jobs screen (paired with the word, never colour alone).</summary>
|
||||||
|
public StatusKind StateKind => State switch
|
||||||
|
{
|
||||||
|
JobState.Running => StatusKind.Running,
|
||||||
|
JobState.Queued => StatusKind.Queued,
|
||||||
|
JobState.Paused => StatusKind.Paused,
|
||||||
|
JobState.Done => StatusKind.Done,
|
||||||
|
JobState.Failed => StatusKind.Failed,
|
||||||
|
_ => StatusKind.Offline,
|
||||||
|
};
|
||||||
|
|
||||||
|
public string StateToolTip => Loc.L("Tooltips.Jobs.State." + State);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Maintenance view's reports (BRIEF §12.5): duplicates across sequences, orphans with their safe fixes, and the
|
/// The Maintenance view's reports (BRIEF §12.5): duplicates across sequences, orphans with their safe fixes, and the
|
||||||
/// recent archive jobs. Nothing here deletes a file; the only removal is of index rows whose sidecar is gone.
|
/// recent archive jobs. Nothing here deletes a file; the only removal is of index rows whose sidecar is gone. Folders
|
||||||
|
/// and paths are kept left to right inside right-to-left text (BRIEF §16).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class MaintenanceReports
|
public static class MaintenanceReports
|
||||||
{
|
{
|
||||||
@@ -50,7 +66,8 @@ public static class MaintenanceReports
|
|||||||
{
|
{
|
||||||
var first = g.Frames[0];
|
var first = g.Frames[0];
|
||||||
var name = first.RelativePath[(first.RelativePath.LastIndexOf('/') + 1)..];
|
var name = first.RelativePath[(first.RelativePath.LastIndexOf('/') + 1)..];
|
||||||
var places = g.Frames.Select(f => Loc.L("Archive.Duplicates.Place", titles.GetValueOrDefault(f.SequenceId, f.RelativePath), f.RelativePath)).ToList();
|
var places = g.Frames.Select(f => Loc.L("Archive.Duplicates.Place", titles.GetValueOrDefault(f.SequenceId, f.RelativePath),
|
||||||
|
Formatting.LeftToRight(f.RelativePath))).ToList();
|
||||||
return new DuplicateRow(name, Loc.Plural("Archive.Duplicates.Copies", g.Frames.Count), places, first.SequenceId);
|
return new DuplicateRow(name, Loc.Plural("Archive.Duplicates.Copies", g.Frames.Count), places, first.SequenceId);
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
@@ -63,16 +80,19 @@ public static class MaintenanceReports
|
|||||||
foreach (var s in report.Sequences)
|
foreach (var s in report.Sequences)
|
||||||
{
|
{
|
||||||
byFolder.TryGetValue(s.Folder, out var location);
|
byFolder.TryGetValue(s.Folder, out var location);
|
||||||
var title = location?.Title ?? s.Folder;
|
var title = location?.Title ?? Formatting.LeftToRight(s.Folder);
|
||||||
if (s.UnindexedFiles.Count > 0)
|
if (s.UnindexedFiles.Count > 0)
|
||||||
rows.Add(new OrphanRow(OrphanKind.UnlistedFiles, title, Loc.Plural("Archive.Orphans.Unlisted", s.UnindexedFiles.Count), location?.Id));
|
rows.Add(new OrphanRow(OrphanKind.UnlistedFiles, title, Loc.Plural("Archive.Orphans.Unlisted", s.UnindexedFiles.Count), location?.Id));
|
||||||
if (s.MissingFiles.Count > 0)
|
if (s.MissingFiles.Count > 0)
|
||||||
rows.Add(new OrphanRow(OrphanKind.MissingFiles, title, Loc.Plural("Archive.Orphans.Missing", s.MissingFiles.Count), location?.Id));
|
rows.Add(new OrphanRow(OrphanKind.MissingFiles, title, Loc.Plural("Archive.Orphans.Missing", s.MissingFiles.Count), location?.Id));
|
||||||
}
|
}
|
||||||
foreach (var missing in report.MissingSequences)
|
foreach (var missing in report.MissingSequences)
|
||||||
rows.Add(new OrphanRow(OrphanKind.MissingSequence, missing.Title ?? missing.Folder, Loc.L("Archive.Orphans.NoSidecar", missing.Folder), missing.Id));
|
{
|
||||||
|
var folder = Formatting.LeftToRight(missing.Folder);
|
||||||
|
rows.Add(new OrphanRow(OrphanKind.MissingSequence, missing.Title ?? folder, Loc.L("Archive.Orphans.NoSidecar", folder), missing.Id));
|
||||||
|
}
|
||||||
foreach (var folder in report.UnindexedFolders)
|
foreach (var folder in report.UnindexedFolders)
|
||||||
rows.Add(new OrphanRow(OrphanKind.NewFolder, folder.Length == 0 ? "/" : folder, Loc.L("Archive.Orphans.NewFolder"), null));
|
rows.Add(new OrphanRow(OrphanKind.NewFolder, Formatting.LeftToRight(folder.Length == 0 ? "/" : folder), Loc.L("Archive.Orphans.NewFolder"), null));
|
||||||
return rows;
|
return rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using Titano.App.Shell;
|
using Titano.App.Shell;
|
||||||
|
using Titano.Core.Archiving;
|
||||||
using Titano.Core.Diagnostics;
|
using Titano.Core.Diagnostics;
|
||||||
using Titano.Core.Localization;
|
using Titano.Core.Localization;
|
||||||
using Titano.Data;
|
using Titano.Data;
|
||||||
@@ -24,11 +25,11 @@ public static class SequenceDeletion
|
|||||||
}
|
}
|
||||||
shell.Notify(Loc.Plural("Archive.Trash.Restored", restored));
|
shell.Notify(Loc.Plural("Archive.Trash.Restored", restored));
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or InvalidOperationException or ArgumentException
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or SequenceInLibraryException or NewerFormatException
|
||||||
or DatabaseException)
|
or ArgumentException or DatabaseException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Restore from the trash failed", ex);
|
Log.Warning("archive", "Restore from the trash failed", ex);
|
||||||
shell.Notify(Loc.L("Archive.Trash.Failed"), ex.Message);
|
shell.Notify(Loc.L("Archive.Trash.Failed"), ArchiveFailures.Cause(ex));
|
||||||
}
|
}
|
||||||
await RefreshAsync(shell);
|
await RefreshAsync(shell);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Titano.App.Infrastructure;
|
using Titano.App.Infrastructure;
|
||||||
|
using Titano.Core.Archiving;
|
||||||
using Titano.Core.Diagnostics;
|
using Titano.Core.Diagnostics;
|
||||||
using Titano.Core.Localization;
|
using Titano.Core.Localization;
|
||||||
using Titano.Data;
|
using Titano.Data;
|
||||||
@@ -15,8 +16,8 @@ public sealed class TrashRowViewModel(TrashEntry entry, ICommand restore)
|
|||||||
public TrashEntry Entry { get; } = entry;
|
public TrashEntry Entry { get; } = entry;
|
||||||
public string Title => Entry.Title;
|
public string Title => Entry.Title;
|
||||||
|
|
||||||
/// <summary>"3,600 photos · 96.2 GB · 2026/2026-09-28 Canon EOS R5".</summary>
|
/// <summary>"3,600 photos · 96.2 GB · 2026/2026-09-28 Canon EOS R5" (the folder left to right in every language).</summary>
|
||||||
public string Detail => string.Join(" · ", Loc.Plural("Shell.Status.Photos", Entry.Frames), Formatting.Bytes(Entry.Bytes), Entry.Folder);
|
public string Detail => string.Join(" · ", Loc.Plural("Shell.Status.Photos", Entry.Frames), Formatting.Bytes(Entry.Bytes), Formatting.LeftToRight(Entry.Folder));
|
||||||
|
|
||||||
/// <summary>"Deleted 02/10/2026 18:04".</summary>
|
/// <summary>"Deleted 02/10/2026 18:04".</summary>
|
||||||
public string DeletedText => Loc.L("Archive.Trash.Deleted", Formatting.Date(Entry.DeletedAt) + " " + Formatting.TimeOfDay(Entry.DeletedAt));
|
public string DeletedText => Loc.L("Archive.Trash.Deleted", Formatting.Date(Entry.DeletedAt) + " " + Formatting.TimeOfDay(Entry.DeletedAt));
|
||||||
@@ -69,17 +70,21 @@ public sealed class TrashDialogViewModel : ArchiveDialogViewModel
|
|||||||
/// <summary>Reads the trash of the archive (off the UI thread).</summary>
|
/// <summary>Reads the trash of the archive (off the UI thread).</summary>
|
||||||
public async Task LoadAsync()
|
public async Task LoadAsync()
|
||||||
{
|
{
|
||||||
|
ClearError();
|
||||||
BusyText = Loc.L("Archive.Trash.Reading");
|
BusyText = Loc.L("Archive.Trash.Reading");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var entries = await Task.Run(() => _archives.ListTrashAsync(_archive.Id));
|
var entries = await Task.Run(() => _archives.ListTrashAsync(_archive.Id));
|
||||||
Rows = [.. entries.Select(e => new TrashRowViewModel(e, new AsyncRelayCommand(() => RestoreAsync(e), () => !IsBusy)))];
|
Rows = [.. entries.Select(e => new TrashRowViewModel(e, new AsyncRelayCommand(() => RestoreAsync(e), () => !IsBusy)))];
|
||||||
BusyText = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or DatabaseException or ArgumentException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or DatabaseException or ArgumentException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Reading the trash failed", ex);
|
Log.Warning("archive", "Reading the trash failed", ex);
|
||||||
BusyText = ex.Message;
|
ShowError(ex);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
BusyText = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,6 +94,7 @@ public sealed class TrashDialogViewModel : ArchiveDialogViewModel
|
|||||||
|
|
||||||
private async Task RestoreAsync(TrashEntry entry)
|
private async Task RestoreAsync(TrashEntry entry)
|
||||||
{
|
{
|
||||||
|
ClearError();
|
||||||
IsBusy = true;
|
IsBusy = true;
|
||||||
BusyText = Loc.L("Archive.Trash.Restoring", entry.Title);
|
BusyText = Loc.L("Archive.Trash.Restoring", entry.Title);
|
||||||
try
|
try
|
||||||
@@ -99,15 +105,16 @@ public sealed class TrashDialogViewModel : ArchiveDialogViewModel
|
|||||||
BusyText = null;
|
BusyText = null;
|
||||||
await _restored();
|
await _restored();
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or InvalidOperationException or DatabaseException
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or SequenceInLibraryException or NewerFormatException
|
||||||
or ArgumentException)
|
or DatabaseException or ArgumentException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", $"Restoring {entry.Title} failed", ex);
|
Log.Warning("archive", $"Restoring {entry.Title} failed", ex);
|
||||||
BusyText = ex.Message;
|
ShowError(ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
|
BusyText = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,22 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Titano.Core.Localization;
|
using Titano.Core.Localization;
|
||||||
|
using Titano.Ui.Controls;
|
||||||
|
|
||||||
namespace Titano.App.Infrastructure;
|
namespace Titano.App.Infrastructure;
|
||||||
|
|
||||||
/// <summary>Switches the UI language at run time without restart (BRIEF §16), mirroring right-to-left languages.</summary>
|
/// <summary>
|
||||||
|
/// Switches the UI language at run time without restart (BRIEF §16). A <see cref="TitanoWindow"/> takes the
|
||||||
|
/// language's direction when it is created and follows each switch, so right-to-left languages mirror windows opened
|
||||||
|
/// before and after this call alike; plain windows (the full-screen preview) take it when they load.
|
||||||
|
/// </summary>
|
||||||
public static class UiLanguage
|
public static class UiLanguage
|
||||||
{
|
{
|
||||||
static UiLanguage()
|
static UiLanguage()
|
||||||
{
|
{
|
||||||
// Windows created later (the main window at start, every dialog) take the reading direction when they load.
|
EventManager.RegisterClassHandler(typeof(Window), FrameworkElement.LoadedEvent, new RoutedEventHandler((sender, _) => ((Window)sender).FlowDirection = Bidi.UiDirection));
|
||||||
EventManager.RegisterClassHandler(typeof(Window), FrameworkElement.LoadedEvent, new RoutedEventHandler((sender, _) => ((Window)sender).FlowDirection = Direction));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>The reading direction of the current language.</summary>
|
|
||||||
public static FlowDirection Direction => Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
|
|
||||||
|
|
||||||
/// <summary>Applies <paramref name="code"/> (or the OS language when null) and returns the culture in use.</summary>
|
/// <summary>Applies <paramref name="code"/> (or the OS language when null) and returns the culture in use.</summary>
|
||||||
public static CultureInfo Apply(string? code)
|
public static CultureInfo Apply(string? code)
|
||||||
{
|
{
|
||||||
@@ -32,10 +33,6 @@ public static class UiLanguage
|
|||||||
CultureInfo.DefaultThreadCurrentUICulture = culture;
|
CultureInfo.DefaultThreadCurrentUICulture = culture;
|
||||||
CultureInfo.CurrentUICulture = culture;
|
CultureInfo.CurrentUICulture = culture;
|
||||||
Loc.SetCulture(culture);
|
Loc.SetCulture(culture);
|
||||||
if (Application.Current is { } app)
|
|
||||||
{
|
|
||||||
foreach (Window window in app.Windows) window.FlowDirection = Direction;
|
|
||||||
}
|
|
||||||
return culture;
|
return culture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
using Titano.App.Archiving;
|
||||||
using Titano.App.Jobs;
|
using Titano.App.Jobs;
|
||||||
using Titano.App.Server;
|
using Titano.App.Server;
|
||||||
using Titano.App.Shell;
|
using Titano.App.Shell;
|
||||||
@@ -168,7 +169,7 @@ public sealed class LibraryActions(ShellViewModel shell)
|
|||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or DatabaseException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or DatabaseException)
|
||||||
{
|
{
|
||||||
Log.Warning("library", "Rating failed", ex);
|
Log.Warning("library", "Rating failed", ex);
|
||||||
shell.Notify(Loc.L("Library.Rate.Failed"), ex.Message);
|
shell.Notify(Loc.L("Library.Rate.Failed"), ArchiveFailures.Cause(ex));
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,7 @@
|
|||||||
<Border Style="{StaticResource Border.Panel}" Padding="28,24" HorizontalAlignment="Left" VerticalAlignment="Top" MinWidth="600">
|
<Border Style="{StaticResource Border.Panel}" Padding="28,24" HorizontalAlignment="Left" VerticalAlignment="Top" MinWidth="600">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Margin="0,0,0,22">
|
<StackPanel Orientation="Horizontal" Margin="0,0,0,22">
|
||||||
<!-- The mark keeps its clockwise ring and its sun on the right in every reading direction. -->
|
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" />
|
||||||
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" FlowDirection="LeftToRight" />
|
|
||||||
<StackPanel Margin="16,0,0,0" VerticalAlignment="Center">
|
<StackPanel Margin="16,0,0,0" VerticalAlignment="Center">
|
||||||
<TextBlock Text="{l:Loc Shell.AppName}" Style="{StaticResource Text.PageTitle}" FontSize="22" />
|
<TextBlock Text="{l:Loc Shell.AppName}" Style="{StaticResource Text.PageTitle}" FontSize="22" />
|
||||||
<TextBlock Text="{Binding Version}" Style="{StaticResource Text.Secondary}" Margin="0,2,0,0" Typography.NumeralAlignment="Tabular" />
|
<TextBlock Text="{Binding Version}" Style="{StaticResource Text.Secondary}" Margin="0,2,0,0" Typography.NumeralAlignment="Tabular" />
|
||||||
|
|||||||
@@ -5,12 +5,44 @@
|
|||||||
xmlns:v="clr-namespace:Titano.Ui.Visuals;assembly=Titano.Ui"
|
xmlns:v="clr-namespace:Titano.Ui.Visuals;assembly=Titano.Ui"
|
||||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||||
xmlns:ar="clr-namespace:Titano.App.Archiving"
|
xmlns:ar="clr-namespace:Titano.App.Archiving"
|
||||||
|
xmlns:infra="clr-namespace:Titano.App.Infrastructure"
|
||||||
xmlns:shell="clr-namespace:Titano.App.Shell">
|
xmlns:shell="clr-namespace:Titano.App.Shell">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<!-- The dialogs (and their styles) are shared with the Library, which runs Delete… too. -->
|
||||||
<ResourceDictionary Source="pack://application:,,,/Titano;component/Archive/ArchiveDialogs.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/Titano;component/Archive/ArchiveDialogs.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
<!-- Keyboard focus drawn inside the row (DESIGN §4 ring): an outer ring would be clipped by the list's scroll viewer. -->
|
||||||
|
<Style x:Key="Focus.Inset">
|
||||||
|
<Setter Property="Control.Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<Border BorderBrush="{DynamicResource Brush.Accent}" BorderThickness="2" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True" />
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Lists keep their panel's fill while the screen behind a dialog is disabled: the system template would paint them
|
||||||
|
white. Rows and buttons dim themselves.
|
||||||
|
-->
|
||||||
|
<Style TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ListBox">
|
||||||
|
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
Padding="1" SnapsToDevicePixels="True">
|
||||||
|
<ScrollViewer Focusable="False" Padding="{TemplateBinding Padding}">
|
||||||
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="Text.PanelHeading" TargetType="TextBlock" BasedOn="{StaticResource Text.Section}">
|
<Style x:Key="Text.PanelHeading" TargetType="TextBlock" BasedOn="{StaticResource Text.Section}">
|
||||||
<Setter Property="FontSize" Value="13" />
|
<Setter Property="FontSize" Value="13" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
@@ -25,6 +57,7 @@
|
|||||||
<!-- Report rows with their own buttons: Tab reaches every button. -->
|
<!-- Report rows with their own buttons: Tab reaches every button. -->
|
||||||
<Style x:Key="ListBoxItem.Duplicate" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.PlainRow}">
|
<Style x:Key="ListBoxItem.Duplicate" TargetType="ListBoxItem" BasedOn="{StaticResource ListBoxItem.PlainRow}">
|
||||||
<Setter Property="AutomationProperties.Name" Value="{Binding Row.Title}" />
|
<Setter Property="AutomationProperties.Name" Value="{Binding Row.Title}" />
|
||||||
|
<Setter Property="AutomationProperties.HelpText" Value="{Binding Row.Detail}" />
|
||||||
</Style>
|
</Style>
|
||||||
<!-- A filter menu: its values, each checked while chosen. -->
|
<!-- A filter menu: its values, each checked while chosen. -->
|
||||||
<Style x:Key="MenuItem.Choice" TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
|
<Style x:Key="MenuItem.Choice" TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
|
||||||
@@ -58,10 +91,10 @@
|
|||||||
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Duplicates}" Command="{Binding FindDuplicatesCommand}"
|
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Duplicates}" Command="{Binding FindDuplicatesCommand}"
|
||||||
ToolTip="{Binding DuplicatesToolTip}" />
|
ToolTip="{Binding DuplicatesToolTip}" />
|
||||||
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Orphans}" Command="{Binding FindOrphansCommand}" ToolTip="{Binding OrphansToolTip}" />
|
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Orphans}" Command="{Binding FindOrphansCommand}" ToolTip="{Binding OrphansToolTip}" />
|
||||||
<Button Style="{StaticResource Button.Tool}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Adopt}">
|
<Button Style="{StaticResource Button.Tool}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Adopt}" AutomationProperties.Name="{l:Loc Archive.Toolbar.AdoptMenu}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="{l:Loc Archive.Toolbar.AdoptMenu}" />
|
<TextBlock Text="{l:Loc Archive.Toolbar.AdoptMenu}" />
|
||||||
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
|
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" VerticalAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button.ContextMenu>
|
<Button.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
@@ -70,10 +103,11 @@
|
|||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</Button.ContextMenu>
|
</Button.ContextMenu>
|
||||||
</Button>
|
</Button>
|
||||||
<Button x:Name="MaintenanceButton" Style="{StaticResource Button.Tool}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Maintenance}">
|
<Button x:Name="MaintenanceButton" Style="{StaticResource Button.Tool}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Maintenance}"
|
||||||
|
AutomationProperties.Name="{l:Loc Archive.Toolbar.Maintenance}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="{l:Loc Archive.Toolbar.Maintenance}" />
|
<TextBlock Text="{l:Loc Archive.Toolbar.Maintenance}" />
|
||||||
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
|
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" VerticalAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button.ContextMenu>
|
<Button.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
@@ -94,8 +128,7 @@
|
|||||||
<DockPanel Grid.Row="1" Margin="0,0,0,12" Visibility="{Binding HasArchive, Converter={StaticResource BoolToVisibility}}">
|
<DockPanel Grid.Row="1" Margin="0,0,0,12" Visibility="{Binding HasArchive, Converter={StaticResource BoolToVisibility}}">
|
||||||
<v:SegmentedControl DockPanel.Dock="Left" SelectedIndex="{Binding ViewIndex}" AutomationProperties.Name="{l:Loc Archive.View.Name}">
|
<v:SegmentedControl DockPanel.Dock="Left" SelectedIndex="{Binding ViewIndex}" AutomationProperties.Name="{l:Loc Archive.View.Name}">
|
||||||
<v:SegmentedItem Content="{l:Loc Archive.View.Overview}" ToolTip="{l:Loc Tooltips.Archive.Overview}" AutomationProperties.Name="{l:Loc Archive.View.Overview}" />
|
<v:SegmentedItem Content="{l:Loc Archive.View.Overview}" ToolTip="{l:Loc Tooltips.Archive.Overview}" AutomationProperties.Name="{l:Loc Archive.View.Overview}" />
|
||||||
<v:SegmentedItem Content="{l:Loc Archive.View.Maintenance}" ToolTip="{l:Loc Tooltips.Archive.MaintenanceView}"
|
<v:SegmentedItem Content="{l:Loc Archive.View.Health}" ToolTip="{l:Loc Tooltips.Archive.MaintenanceView}" AutomationProperties.Name="{l:Loc Archive.View.Health}" />
|
||||||
AutomationProperties.Name="{l:Loc Archive.View.Maintenance}" />
|
|
||||||
</v:SegmentedControl>
|
</v:SegmentedControl>
|
||||||
<TextBlock Text="{Binding LastScanText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="14,0,0,0"
|
<TextBlock Text="{Binding LastScanText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="14,0,0,0"
|
||||||
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Archive.LastScan}" />
|
TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Archive.LastScan}" />
|
||||||
@@ -115,6 +148,7 @@
|
|||||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
||||||
<Setter Property="MinHeight" Value="32" />
|
<Setter Property="MinHeight" Value="32" />
|
||||||
<Setter Property="Padding" Value="6,0" />
|
<Setter Property="Padding" Value="6,0" />
|
||||||
|
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||||
<Setter Property="ToolTip" Value="{Binding RowToolTip}" />
|
<Setter Property="ToolTip" Value="{Binding RowToolTip}" />
|
||||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||||
<Setter Property="AutomationProperties.HelpText" Value="{Binding Detail}" />
|
<Setter Property="AutomationProperties.HelpText" Value="{Binding Detail}" />
|
||||||
@@ -160,13 +194,28 @@
|
|||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Grid Grid.Column="2">
|
<Grid Grid.Column="2">
|
||||||
|
<!--
|
||||||
|
Chart labels in TextMuted as in Archive.html: the kit's charts draw them in TextFaint, too faint for 11 px data
|
||||||
|
labels (reported to the shared controls; remove this alias once they draw in TextMuted).
|
||||||
|
-->
|
||||||
|
<Grid.Resources>
|
||||||
|
<SolidColorBrush x:Key="Brush.TextFaint" Color="{DynamicResource Color.TextMuted}" />
|
||||||
|
</Grid.Resources>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="14" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="14" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
<!-- One column split for both chart rows, so the gutter lines up; 14 px gaps throughout (Archive.html). -->
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1.2*" />
|
||||||
|
<ColumnDefinition Width="14" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
<!-- Figure tiles (Archive.html). -->
|
<!-- Figure tiles (Archive.html). -->
|
||||||
<ItemsControl ItemsSource="{Binding Tiles}" Focusable="False" Margin="0,0,-10,0">
|
<ItemsControl Grid.ColumnSpan="3" ItemsSource="{Binding Tiles}" Focusable="False" Margin="0,0,-14,0">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<UniformGrid Rows="1" />
|
<UniformGrid Rows="1" />
|
||||||
@@ -174,7 +223,7 @@
|
|||||||
</ItemsControl.ItemsPanel>
|
</ItemsControl.ItemsPanel>
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type ar:ArchiveTile}">
|
<DataTemplate DataType="{x:Type ar:ArchiveTile}">
|
||||||
<Border Style="{StaticResource Border.Panel}" Padding="14,8" Margin="0,0,10,0" ToolTip="{Binding Caption}">
|
<Border Style="{StaticResource Border.Panel}" Padding="14,8" Margin="0,0,14,0" ToolTip="{Binding Caption}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<!-- A narrow tile (the window at its minimum width) shrinks the figure rather than cutting it. -->
|
<!-- A narrow tile (the window at its minimum width) shrinks the figure rather than cutting it. -->
|
||||||
<Viewbox StretchDirection="DownOnly" HorizontalAlignment="Left">
|
<Viewbox StretchDirection="DownOnly" HorizontalAlignment="Left">
|
||||||
@@ -187,49 +236,59 @@
|
|||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
|
|
||||||
<Grid Grid.Row="1" Margin="0,12,0,0">
|
<Border Grid.Row="2" Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||||
<Grid.ColumnDefinitions>
|
<DockPanel>
|
||||||
<ColumnDefinition Width="1.2*" />
|
<!-- The colour scale sits in the header, at the end of the title (Archive.html). -->
|
||||||
<ColumnDefinition Width="12" />
|
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
||||||
<ColumnDefinition Width="*" />
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" FlowDirection="LeftToRight" VerticalAlignment="Center"
|
||||||
</Grid.ColumnDefinitions>
|
Visibility="{Binding HasMonthScale, Converter={StaticResource BoolToVisibility}}">
|
||||||
<Border Style="{StaticResource Border.Panel}" Padding="14,10">
|
<TextBlock Text="{Binding MonthScaleLow}" Style="{StaticResource Text.Chip}" Typography.NumeralAlignment="Tabular" />
|
||||||
<DockPanel>
|
<Grid Width="60" Height="8" Margin="6,0">
|
||||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Months}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
<Border CornerRadius="2" Background="{DynamicResource Brush.Accent}" Opacity="0.08" />
|
||||||
<v:HeatmapStrip Rows="{Binding MonthRows}" ColumnLabels="{Binding MonthLabels}" ValueFormatter="{Binding CountFormatter}" MaxCellSize="18"
|
<Border CornerRadius="2" Background="{DynamicResource Brush.Accent}">
|
||||||
ToolTip="{l:Loc Tooltips.Archive.Months}" AutomationProperties.Name="{l:Loc Archive.Chart.Months}" />
|
<Border.OpacityMask>
|
||||||
|
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||||
|
<GradientStop Color="Transparent" Offset="0" />
|
||||||
|
<GradientStop Color="Black" Offset="1" />
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Border.OpacityMask>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Text="{Binding MonthScaleHigh}" Style="{StaticResource Text.Chip}" Typography.NumeralAlignment="Tabular" />
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Text="{l:Loc Archive.Chart.Months}" Style="{StaticResource Text.PanelHeading}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
<v:HeatmapStrip Rows="{Binding MonthRows}" ColumnLabels="{Binding MonthLabels}" ValueFormatter="{Binding CountFormatter}" MaxCellSize="32" ShowScale="False"
|
||||||
<Border Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="14,10">
|
ToolTip="{l:Loc Tooltips.Archive.Months}" AutomationProperties.Name="{l:Loc Archive.Chart.Months}"
|
||||||
<DockPanel>
|
AutomationProperties.HelpText="{Binding MonthsDescription}">
|
||||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Storage}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
<!-- Months still to come in the Stroke tone: the kit fills them with Card, the panel's own colour in the light theme. -->
|
||||||
<v:BarChart Items="{Binding StorageBars}" MinimumOpacity="0.55" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Storage}"
|
<v:HeatmapStrip.Resources>
|
||||||
AutomationProperties.Name="{l:Loc Archive.Chart.Storage}" />
|
<SolidColorBrush x:Key="Brush.Card" Color="{DynamicResource Color.Stroke}" />
|
||||||
</DockPanel>
|
</v:HeatmapStrip.Resources>
|
||||||
</Border>
|
</v:HeatmapStrip>
|
||||||
</Grid>
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
<Grid Grid.Row="2" Margin="0,12,0,0">
|
<Border Grid.Row="2" Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||||
<Grid.ColumnDefinitions>
|
<DockPanel>
|
||||||
<ColumnDefinition Width="*" />
|
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Storage}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||||
<ColumnDefinition Width="12" />
|
<v:BarChart Items="{Binding StorageBars}" MinimumOpacity="0.55" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Storage}"
|
||||||
<ColumnDefinition Width="*" />
|
AutomationProperties.Name="{l:Loc Archive.Chart.Storage}" AutomationProperties.HelpText="{Binding StorageDescription}" />
|
||||||
</Grid.ColumnDefinitions>
|
</DockPanel>
|
||||||
<Border Style="{StaticResource Border.Panel}" Padding="14,10">
|
</Border>
|
||||||
<DockPanel>
|
<Border Grid.Row="4" Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Cameras}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
<DockPanel>
|
||||||
<v:BarChart Items="{Binding CameraBars}" BrushKey="Brush.Sun" MinimumOpacity="0.45" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Cameras}"
|
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Cameras}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||||
AutomationProperties.Name="{l:Loc Archive.Chart.Cameras}" />
|
<v:BarChart Items="{Binding CameraBars}" BrushKey="Brush.Sun" MinimumOpacity="0.45" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Cameras}"
|
||||||
</DockPanel>
|
AutomationProperties.Name="{l:Loc Archive.Chart.Cameras}" AutomationProperties.HelpText="{Binding CamerasDescription}" />
|
||||||
</Border>
|
</DockPanel>
|
||||||
<Border Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="14,10">
|
</Border>
|
||||||
<DockPanel>
|
<Border Grid.Row="4" Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Formats}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
<DockPanel>
|
||||||
<v:BarChart Items="{Binding FormatBars}" MinimumOpacity="0.35" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Formats}"
|
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Formats}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||||
AutomationProperties.Name="{l:Loc Archive.Chart.Formats}" />
|
<v:BarChart Items="{Binding FormatBars}" MinimumOpacity="0.35" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Formats}"
|
||||||
</DockPanel>
|
AutomationProperties.Name="{l:Loc Archive.Chart.Formats}" AutomationProperties.HelpText="{Binding FormatsDescription}" />
|
||||||
</Border>
|
</DockPanel>
|
||||||
</Grid>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@@ -250,12 +309,21 @@
|
|||||||
<TextBlock Text="{l:Loc Archive.Health.Title}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
<TextBlock Text="{l:Loc Archive.Health.Title}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||||
<ItemsControl ItemsSource="{Binding Health}" Focusable="False">
|
<ItemsControl ItemsSource="{Binding Health}" Focusable="False">
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
|
<!-- Archive.html: a 14 px glyph in the state's colour (● ok, ▲ needs attention), the text in the normal colour. -->
|
||||||
<DataTemplate DataType="{x:Type ar:HealthLineViewModel}">
|
<DataTemplate DataType="{x:Type ar:HealthLineViewModel}">
|
||||||
<DockPanel Height="32">
|
<DockPanel Height="32">
|
||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="8,0,0,0" Content="{Binding FixText}" Command="{Binding FixCommand}"
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="8,0,0,0" Content="{Binding FixText}" Command="{Binding FixCommand}"
|
||||||
ToolTip="{Binding FixToolTip}" Visibility="{Binding HasFix, Converter={StaticResource BoolToVisibility}}" />
|
ToolTip="{Binding FixToolTip}" Visibility="{Binding HasFix, Converter={StaticResource BoolToVisibility}}" />
|
||||||
<ui:StatusGlyph Kind="{Binding Kind}" Text="{Binding Text}" FontSize="13" VerticalAlignment="Center" ToolTip="{Binding KindToolTip}" />
|
<ui:Icon x:Name="Glyph" DockPanel.Dock="Left" Glyph="{StaticResource Icon.Warning}" Size="14" Margin="0,0,10,0" VerticalAlignment="Center"
|
||||||
|
Foreground="{DynamicResource Brush.Warning}" />
|
||||||
|
<TextBlock Text="{Binding Text}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" ToolTip="{Binding KindToolTip}" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
<DataTemplate.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsOk}" Value="True">
|
||||||
|
<Setter TargetName="Glyph" Property="Glyph" Value="{StaticResource Icon.SuccessCircle}" />
|
||||||
|
<Setter TargetName="Glyph" Property="Foreground" Value="{DynamicResource Brush.Success}" />
|
||||||
|
</DataTrigger>
|
||||||
|
</DataTemplate.Triggers>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
@@ -281,7 +349,9 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Text="{Binding DateText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
<TextBlock Text="{Binding DateText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Text}" Margin="12,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" ToolTip="{Binding Text}" />
|
<TextBlock Grid.Column="1" Text="{Binding Text}" Margin="12,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" ToolTip="{Binding Text}" />
|
||||||
<TextBlock Grid.Column="2" Text="{Binding StateText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
<!-- The outcome in its state's colour and glyph (Archive.html: accent while running, green when done). -->
|
||||||
|
<ui:StatusGlyph Grid.Column="2" Kind="{Binding StateKind}" Text="{Binding StateText}" FontSize="12" VerticalAlignment="Center"
|
||||||
|
Typography.NumeralAlignment="Tabular" ToolTip="{Binding StateToolTip}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
@@ -300,12 +370,13 @@
|
|||||||
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="8,0,0,0" Content="{l:Loc Archive.Duplicates.Mark}"
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="8,0,0,0" Content="{l:Loc Archive.Duplicates.Mark}"
|
||||||
Command="{Binding MarkDuplicatesCommand}" ToolTip="{Binding MarkDuplicatesToolTip}" />
|
Command="{Binding MarkDuplicatesCommand}" ToolTip="{Binding MarkDuplicatesToolTip}" />
|
||||||
|
<!-- Cancel only in the card whose search runs; the other card's Find waits, its tooltip says why. -->
|
||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Run}" Command="{Binding FindDuplicatesCommand}"
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Run}" Command="{Binding FindDuplicatesCommand}"
|
||||||
ToolTip="{Binding DuplicatesToolTip}" Visibility="{Binding IsSearching, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
ToolTip="{Binding DuplicatesToolTip}" Visibility="{Binding IsFindingDuplicates, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Cancel}" Command="{Binding CancelSearchCommand}"
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Cancel}" Command="{Binding CancelSearchCommand}"
|
||||||
ToolTip="{l:Loc Tooltips.Archive.CancelSearch}" Visibility="{Binding IsSearching, Converter={StaticResource BoolToVisibility}}" />
|
ToolTip="{l:Loc Tooltips.Archive.CancelSearch}" Visibility="{Binding IsFindingDuplicates, Converter={StaticResource BoolToVisibility}}" />
|
||||||
<TextBlock Text="{l:Loc Archive.Duplicates.Title}" Style="{StaticResource Text.PanelHeading}" />
|
<TextBlock Text="{l:Loc Archive.Duplicates.Title}" Style="{StaticResource Text.PanelHeading}" />
|
||||||
<TextBlock Text="{Binding DuplicatesText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="10,0,0,0" VerticalAlignment="Center" />
|
<TextBlock Style="{StaticResource Text.Live}" Text="{Binding DuplicatesText}" infra:LiveRegion.Text="{Binding DuplicatesText}" Margin="10,0,0,0" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<ListBox ItemsSource="{Binding Duplicates}" ItemContainerStyle="{StaticResource ListBoxItem.Duplicate}" AutomationProperties.Name="{l:Loc Archive.Duplicates.Title}"
|
<ListBox ItemsSource="{Binding Duplicates}" ItemContainerStyle="{StaticResource ListBoxItem.Duplicate}" AutomationProperties.Name="{l:Loc Archive.Duplicates.Title}"
|
||||||
KeyboardNavigation.TabNavigation="Continue">
|
KeyboardNavigation.TabNavigation="Continue">
|
||||||
@@ -333,11 +404,11 @@
|
|||||||
<DockPanel>
|
<DockPanel>
|
||||||
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Run}" Command="{Binding FindOrphansCommand}"
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Run}" Command="{Binding FindOrphansCommand}"
|
||||||
ToolTip="{Binding OrphansToolTip}" Visibility="{Binding IsSearching, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
ToolTip="{Binding OrphansToolTip}" Visibility="{Binding IsFindingOrphans, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Cancel}" Command="{Binding CancelSearchCommand}"
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Cancel}" Command="{Binding CancelSearchCommand}"
|
||||||
ToolTip="{l:Loc Tooltips.Archive.CancelSearch}" Visibility="{Binding IsSearching, Converter={StaticResource BoolToVisibility}}" />
|
ToolTip="{l:Loc Tooltips.Archive.CancelSearch}" Visibility="{Binding IsFindingOrphans, Converter={StaticResource BoolToVisibility}}" />
|
||||||
<TextBlock Text="{l:Loc Archive.Orphans.Title}" Style="{StaticResource Text.PanelHeading}" />
|
<TextBlock Text="{l:Loc Archive.Orphans.Title}" Style="{StaticResource Text.PanelHeading}" />
|
||||||
<TextBlock Text="{Binding OrphansText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="10,0,0,0" VerticalAlignment="Center" />
|
<TextBlock Style="{StaticResource Text.Live}" Text="{Binding OrphansText}" infra:LiveRegion.Text="{Binding OrphansText}" Margin="10,0,0,0" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<ListBox ItemsSource="{Binding Orphans}" ItemContainerStyle="{StaticResource ListBoxItem.Duplicate}" AutomationProperties.Name="{l:Loc Archive.Orphans.Title}"
|
<ListBox ItemsSource="{Binding Orphans}" ItemContainerStyle="{StaticResource ListBoxItem.Duplicate}" AutomationProperties.Name="{l:Loc Archive.Orphans.Title}"
|
||||||
KeyboardNavigation.TabNavigation="Continue">
|
KeyboardNavigation.TabNavigation="Continue">
|
||||||
@@ -347,7 +418,7 @@
|
|||||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Content="{Binding FixText}" Command="{Binding FixCommand}" ToolTip="{Binding FixToolTip}" />
|
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Content="{Binding FixText}" Command="{Binding FixCommand}" ToolTip="{Binding FixToolTip}" />
|
||||||
<StackPanel VerticalAlignment="Center">
|
<StackPanel VerticalAlignment="Center">
|
||||||
<TextBlock Text="{Binding Row.Title}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" ToolTip="{Binding Row.Title}" />
|
<TextBlock Text="{Binding Row.Title}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" ToolTip="{Binding Row.Title}" />
|
||||||
<ui:StatusGlyph Kind="{Binding Kind}" Text="{Binding Row.Detail}" FontSize="12" ToolTip="{Binding KindText}" />
|
<ui:StatusGlyph Kind="Warning" Text="{Binding Row.Detail}" FontSize="12" ToolTip="{Binding KindText}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
@@ -370,10 +441,10 @@
|
|||||||
<WrapPanel VerticalAlignment="Center">
|
<WrapPanel VerticalAlignment="Center">
|
||||||
<TextBlock Text="{l:Loc Archive.Set.Label}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,10,8" />
|
<TextBlock Text="{l:Loc Archive.Set.Label}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,10,8" />
|
||||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" BorderBrush="{DynamicResource Brush.Accent}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Set}"
|
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" BorderBrush="{DynamicResource Brush.Accent}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Set}"
|
||||||
AutomationProperties.Name="{l:Loc Archive.Set.Filter}">
|
AutomationProperties.Name="{Binding SetFilterName}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="{Binding SetText}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" MaxWidth="260" TextTrimming="CharacterEllipsis" />
|
<TextBlock Text="{Binding SetText}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" MaxWidth="260" TextTrimming="CharacterEllipsis" />
|
||||||
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
|
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" VerticalAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button.ContextMenu>
|
<Button.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Windows;
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using Titano.App.Archiving;
|
using Titano.App.Archiving;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ public partial class ArchiveView : UserControl
|
|||||||
{
|
{
|
||||||
private bool _restoring;
|
private bool _restoring;
|
||||||
private string? _focusKey;
|
private string? _focusKey;
|
||||||
|
private IInputElement? _beforeDialog;
|
||||||
|
|
||||||
public ArchiveView()
|
public ArchiveView()
|
||||||
{
|
{
|
||||||
@@ -79,26 +81,48 @@ public partial class ArchiveView : UserControl
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>On a year: Right opens it, Left closes it, Enter toggles it.</summary>
|
|
||||||
private void OnTreeKeyDown(object sender, KeyEventArgs e)
|
private void OnTreeKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (Model is not { } model || Keyboard.FocusedElement is not ListBoxItem { DataContext: ArchiveTreeRowViewModel row } || !row.HasChildren || row.IsArchive) return;
|
if (Model is not { } model || Keyboard.FocusedElement is not ListBoxItem { DataContext: ArchiveTreeRowViewModel row } || !row.HasChildren || row.IsArchive) return;
|
||||||
var toggle = e.Key switch
|
if (!Toggles(e.Key, Tree.FlowDirection, row.IsExpanded)) return;
|
||||||
{
|
|
||||||
Key.Right => !row.IsExpanded,
|
|
||||||
Key.Left => row.IsExpanded,
|
|
||||||
Key.Enter => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
if (!toggle) return;
|
|
||||||
model.Toggle(row);
|
model.Toggle(row);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>A dialog that opens takes the keyboard: its first field or button.</summary>
|
/// <summary>
|
||||||
|
/// Whether <paramref name="key"/> opens or closes a year: the arrow towards the indented side opens it (Right, or
|
||||||
|
/// Left in a right-to-left layout, as a tree view does), the other arrow closes it, Enter toggles it.
|
||||||
|
/// </summary>
|
||||||
|
internal static bool Toggles(Key key, FlowDirection direction, bool isExpanded)
|
||||||
|
{
|
||||||
|
var (open, close) = direction == FlowDirection.RightToLeft ? (Key.Left, Key.Right) : (Key.Right, Key.Left);
|
||||||
|
return key == open ? !isExpanded
|
||||||
|
: key == close ? isExpanded
|
||||||
|
: key == Key.Enter;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A dialog that opens takes the keyboard (its first field or button); when it closes, the keyboard goes back to the
|
||||||
|
/// control that opened it, or to the tree when that control can no longer take it.
|
||||||
|
/// </summary>
|
||||||
private void OnModelChanged(object? sender, PropertyChangedEventArgs e)
|
private void OnModelChanged(object? sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName != nameof(ArchiveViewModel.Dialog) || Model?.Dialog is null || !IsVisible) return;
|
if (e.PropertyName != nameof(ArchiveViewModel.Dialog) || Model is not { } model) return;
|
||||||
Dispatcher.BeginInvoke(DispatcherPriority.Input, () => DialogHost.MoveFocus(new TraversalRequest(FocusNavigationDirection.First)));
|
if (model.Dialog is not null)
|
||||||
|
{
|
||||||
|
if (!IsVisible) return;
|
||||||
|
// Raised before the screen behind the dialog is disabled: the control that opened it still has the keyboard.
|
||||||
|
_beforeDialog ??= Keyboard.FocusedElement is Visual focused && IsAncestorOf(focused) ? Keyboard.FocusedElement : null;
|
||||||
|
Dispatcher.BeginInvoke(DispatcherPriority.Input, () => DialogHost.MoveFocus(new TraversalRequest(FocusNavigationDirection.First)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var back = _beforeDialog;
|
||||||
|
_beforeDialog = null;
|
||||||
|
if (!IsVisible) return;
|
||||||
|
Dispatcher.BeginInvoke(DispatcherPriority.Input, () =>
|
||||||
|
{
|
||||||
|
if (back is UIElement { IsVisible: true, IsEnabled: true, Focusable: true } element && element.Focus()) return;
|
||||||
|
Tree.Focus();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,6 +47,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
private Core.Model.Archive? _archive;
|
private Core.Model.Archive? _archive;
|
||||||
private ArchiveAvailability _availability = ArchiveAvailability.Offline;
|
private ArchiveAvailability _availability = ArchiveAvailability.Offline;
|
||||||
private ArchiveStats? _stats;
|
private ArchiveStats? _stats;
|
||||||
|
private int _withoutProxies;
|
||||||
private ArchiveTree? _tree;
|
private ArchiveTree? _tree;
|
||||||
private int _viewIndex;
|
private int _viewIndex;
|
||||||
private bool _loaded;
|
private bool _loaded;
|
||||||
@@ -129,7 +130,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
|
|
||||||
public bool HasArchive => _archive is not null;
|
public bool HasArchive => _archive is not null;
|
||||||
|
|
||||||
public string ArchiveToolTip => _archive is null ? Loc.L("Tooltips.Archive.Pick") : Loc.L("Tooltips.Archive.PickRoot", _archive.RootPath);
|
public string ArchiveToolTip => _archive is null ? Loc.L("Tooltips.Archive.Pick") : Loc.L("Tooltips.Archive.PickRoot", Formatting.LeftToRight(_archive.RootPath));
|
||||||
|
|
||||||
/// <summary>0 = overview (tree and figures), 1 = maintenance.</summary>
|
/// <summary>0 = overview (tree and figures), 1 = maintenance.</summary>
|
||||||
public int ViewIndex
|
public int ViewIndex
|
||||||
@@ -171,7 +172,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
public ICommand VerifyCommand { get; }
|
public ICommand VerifyCommand { get; }
|
||||||
public ICommand AdoptCommand { get; }
|
public ICommand AdoptCommand { get; }
|
||||||
|
|
||||||
/// <summary>"Adopt folder ▾ › Copy into the layout": the Import screen copies the folder into the archive with its templates.</summary>
|
/// <summary>"Adopt folder ▾ › Copy into archive": the Import screen copies the folder into the archive with its templates.</summary>
|
||||||
public ICommand CopyFolderCommand { get; }
|
public ICommand CopyFolderCommand { get; }
|
||||||
|
|
||||||
public ICommand BackupCommand { get; }
|
public ICommand BackupCommand { get; }
|
||||||
@@ -195,6 +196,20 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
public IReadOnlyList<ChartItem> CameraBars { get => _cameras; private set => Set(ref _cameras, value); }
|
public IReadOnlyList<ChartItem> CameraBars { get => _cameras; private set => Set(ref _cameras, value); }
|
||||||
public IReadOnlyList<ChartItem> FormatBars { get => _formats; private set => Set(ref _formats, value); }
|
public IReadOnlyList<ChartItem> FormatBars { get => _formats; private set => Set(ref _formats, value); }
|
||||||
|
|
||||||
|
/// <summary>The heatmap's scale in the card header (Archive.html: "0 ▭ 21,000"); hidden without photos.</summary>
|
||||||
|
public bool HasMonthScale => MonthScaleMax > 0;
|
||||||
|
|
||||||
|
public string MonthScaleLow => Formatting.Count(0);
|
||||||
|
public string MonthScaleHigh => Formatting.Count((long)MonthScaleMax);
|
||||||
|
|
||||||
|
private double MonthScaleMax => _months.SelectMany(r => r.Values).Where(double.IsFinite).DefaultIfEmpty(0).Max();
|
||||||
|
|
||||||
|
/// <summary>What each chart shows, value by value, for screen readers (the charts themselves are images).</summary>
|
||||||
|
public string MonthsDescription => Describe(_months.SelectMany(r => r.Values.Select((photos, month) => photos > 0 ? r.ToolTips?[month] : null)));
|
||||||
|
public string StorageDescription => Describe(_storage.Select(b => b.ToolTip));
|
||||||
|
public string CamerasDescription => Describe(_cameras.Select(b => b.ToolTip));
|
||||||
|
public string FormatsDescription => Describe(_formats.Select(b => b.ToolTip));
|
||||||
|
|
||||||
/// <summary>Photos per month in the culture's digits.</summary>
|
/// <summary>Photos per month in the culture's digits.</summary>
|
||||||
public Func<double, string> CountFormatter { get; } = v => Formatting.Count((long)v);
|
public Func<double, string> CountFormatter { get; } = v => Formatting.Count((long)v);
|
||||||
|
|
||||||
@@ -212,6 +227,9 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>The set button's accessible name: what it is and the set it shows.</summary>
|
||||||
|
public string SetFilterName => Loc.L("Archive.Set.Filter") + " · " + SetText;
|
||||||
|
|
||||||
/// <summary>Camera, status and tag on top of the tree selection.</summary>
|
/// <summary>Camera, status and tag on top of the tree selection.</summary>
|
||||||
public ArchiveSetFilter Filter
|
public ArchiveSetFilter Filter
|
||||||
{
|
{
|
||||||
@@ -286,7 +304,9 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
get => _duplicates;
|
get => _duplicates;
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
if (Set(ref _duplicates, value)) OnPropertyChanged(nameof(DuplicatesText));
|
if (!Set(ref _duplicates, value)) return;
|
||||||
|
OnPropertyChanged(nameof(DuplicatesText));
|
||||||
|
ShowHealth();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,8 +319,11 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>A duplicates or orphans search runs; it can be cancelled.</summary>
|
/// <summary>The duplicates search runs: its card offers Cancel; the other card's Find waits for it.</summary>
|
||||||
public bool IsSearching => _search is not null;
|
public bool IsFindingDuplicates => _findingDuplicates;
|
||||||
|
|
||||||
|
/// <summary>The orphans search runs: its card offers Cancel; the other card's Find waits for it.</summary>
|
||||||
|
public bool IsFindingOrphans => _findingOrphans;
|
||||||
|
|
||||||
/// <summary>"3 groups", "None found", or empty before the first search.</summary>
|
/// <summary>"3 groups", "None found", or empty before the first search.</summary>
|
||||||
public string DuplicatesText => _findingDuplicates ? Loc.L("Archive.Find.Searching")
|
public string DuplicatesText => _findingDuplicates ? Loc.L("Archive.Find.Searching")
|
||||||
@@ -428,19 +451,28 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
|
|
||||||
private void ShowFigures(ArchiveStats stats, int withoutProxies)
|
private void ShowFigures(ArchiveStats stats, int withoutProxies)
|
||||||
{
|
{
|
||||||
|
_withoutProxies = withoutProxies;
|
||||||
Tiles = ArchiveFigures.Tiles(stats);
|
Tiles = ArchiveFigures.Tiles(stats);
|
||||||
MonthRows = [.. ArchiveFigures.PhotosPerMonth(stats, DateTime.Today).Select(r => new ChartRow(r.Label, r.Values, r.ToolTips))];
|
MonthRows = [.. ArchiveFigures.PhotosPerMonth(stats, DateTime.Today).Select(r => new ChartRow(r.Label, r.Values, r.ToolTips))];
|
||||||
StorageBars = Bars(ArchiveFigures.StorageByYear(stats));
|
StorageBars = Bars(ArchiveFigures.StorageByYear(stats));
|
||||||
CameraBars = Bars(ArchiveFigures.ByCamera(stats));
|
CameraBars = Bars(ArchiveFigures.ByCamera(stats));
|
||||||
FormatBars = Bars(ArchiveFigures.ByFormat(stats));
|
FormatBars = Bars(ArchiveFigures.ByFormat(stats));
|
||||||
|
ShowHealth();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The health lines of the last figures; the duplicates line follows the last duplicates search.</summary>
|
||||||
|
private void ShowHealth()
|
||||||
|
{
|
||||||
|
if (_stats is not { } stats) return;
|
||||||
Health =
|
Health =
|
||||||
[
|
[
|
||||||
.. ArchiveFigures.Health(stats, withoutProxies).Select(line => new HealthLineViewModel(line, line.Action switch
|
.. ArchiveFigures.Health(stats, _withoutProxies, _duplicates?.Count).Select(line => new HealthLineViewModel(line, line.Action switch
|
||||||
{
|
{
|
||||||
HealthAction.Verify => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.Verified, ids => ArchiveJobs.Verify(_archive!, ids))),
|
HealthAction.Verify => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.Verified, ids => ArchiveJobs.Verify(_archive!, ids))),
|
||||||
HealthAction.Proxies => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.ProxiesBuilt, ids => ArchiveJobs.Proxies(ids, CountLabel(ids)))),
|
HealthAction.Proxies => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.ProxiesBuilt, ids => ArchiveJobs.Proxies(ids, CountLabel(ids)))),
|
||||||
HealthAction.Analyse => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.AnalyzedLight, ids => ProcessingJobs.LightAnalysis(ids, CountLabel(ids)))),
|
HealthAction.Analyse => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.AnalyzedLight, ids => ProcessingJobs.LightAnalysis(ids, CountLabel(ids)))),
|
||||||
HealthAction.Duplicates => FindDuplicatesCommand,
|
HealthAction.Duplicates => FindDuplicatesCommand,
|
||||||
|
HealthAction.MarkDuplicates => MarkDuplicatesCommand,
|
||||||
HealthAction.Orphans => FindOrphansCommand,
|
HealthAction.Orphans => FindOrphansCommand,
|
||||||
_ => null,
|
_ => null,
|
||||||
})),
|
})),
|
||||||
@@ -450,6 +482,8 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
private static IReadOnlyList<ChartItem> Bars(IReadOnlyList<BarValue> values) =>
|
private static IReadOnlyList<ChartItem> Bars(IReadOnlyList<BarValue> values) =>
|
||||||
[.. values.Select(v => new ChartItem(v.Label, v.Value, v.ValueText, v.ToolTip))];
|
[.. values.Select(v => new ChartItem(v.Label, v.Value, v.ValueText, v.ToolTip))];
|
||||||
|
|
||||||
|
private static string Describe(IEnumerable<string?> values) => string.Join(Environment.NewLine, values.Where(v => !string.IsNullOrEmpty(v)));
|
||||||
|
|
||||||
/// <summary>A reloaded tree keeps the open years and the selection (nodes that still exist).</summary>
|
/// <summary>A reloaded tree keeps the open years and the selection (nodes that still exist).</summary>
|
||||||
private void ShowTree(ArchiveTree tree)
|
private void ShowTree(ArchiveTree tree)
|
||||||
{
|
{
|
||||||
@@ -498,6 +532,7 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
private void OnSetChanged()
|
private void OnSetChanged()
|
||||||
{
|
{
|
||||||
OnPropertyChanged(nameof(SetText));
|
OnPropertyChanged(nameof(SetText));
|
||||||
|
OnPropertyChanged(nameof(SetFilterName));
|
||||||
OnPropertyChanged(nameof(CameraChoices));
|
OnPropertyChanged(nameof(CameraChoices));
|
||||||
OnPropertyChanged(nameof(StatusChoices));
|
OnPropertyChanged(nameof(StatusChoices));
|
||||||
OnPropertyChanged(nameof(TagChoices));
|
OnPropertyChanged(nameof(TagChoices));
|
||||||
@@ -714,13 +749,13 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var path = await db.BackupAsync(Services.Environment.BackupDirectory);
|
var path = await db.BackupAsync(Services.Environment.BackupDirectory);
|
||||||
Shell.Notify(Loc.L("Settings.Advanced.BackupDone"), Path.GetFileName(path), Loc.L("Library.Export.Show"), Loc.L("Tooltips.Library.ShowExport"),
|
Shell.Notify(Loc.L("Settings.Advanced.BackupDone"), Formatting.LeftToRight(Path.GetFileName(path)), Loc.L("Library.Export.Show"),
|
||||||
() => ShellActions.Reveal(path));
|
Loc.L("Tooltips.Library.ShowExport"), () => ShellActions.Reveal(path));
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or DatabaseException or NotSupportedException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or DatabaseException or NotSupportedException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Database backup failed", ex);
|
Log.Warning("archive", "Database backup failed", ex);
|
||||||
Shell.Notify(Loc.L("Archive.Backup.Failed"), ex.Message);
|
NotifyFailure("Archive.Backup.Failed", ex, BackupCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -737,13 +772,14 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
Services.SaveSettings();
|
Services.SaveSettings();
|
||||||
_archive = archive;
|
_archive = archive;
|
||||||
await Services.QueueScanAsync(archive, full: false);
|
await Services.QueueScanAsync(archive, full: false);
|
||||||
Shell.Notify(Loc.L("Archive.Relink.Done", archive.Name), archive.RootPath);
|
Shell.Notify(Loc.L("Archive.Relink.Done", archive.Name), Formatting.LeftToRight(archive.RootPath));
|
||||||
await LoadAsync();
|
await LoadAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or DatabaseException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or DatabaseException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", $"Relinking {folder} failed", ex);
|
Log.Warning("archive", $"Relinking {folder} failed", ex);
|
||||||
Shell.Notify(Loc.L("Archive.Relink.Failed"), ex.Message);
|
// Retry asks for the folder again: the same one once its drive is back, or the right one.
|
||||||
|
NotifyFailure("Archive.Relink.Failed", ex, RelinkCommand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,7 +813,8 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
}
|
}
|
||||||
catch (DatabaseException ex)
|
catch (DatabaseException ex)
|
||||||
{
|
{
|
||||||
Shell.ReportError(ex);
|
Log.Warning("archive", "Duplicates search failed", ex);
|
||||||
|
NotifyFailure("Archive.Duplicates.Failed", ex, FindDuplicatesCommand);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -803,10 +840,10 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
catch (OperationCanceledException) when (search.IsCancellationRequested)
|
catch (OperationCanceledException) when (search.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or ArchiveOfflineException or DatabaseException)
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or DatabaseException)
|
||||||
{
|
{
|
||||||
Log.Warning("archive", "Orphan search failed", ex);
|
Log.Warning("archive", "Orphan search failed", ex);
|
||||||
Shell.Notify(Loc.L("Archive.Orphans.Failed"), ex.Message);
|
NotifyFailure("Archive.Orphans.Failed", ex, FindOrphansCommand);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -831,7 +868,8 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
|
|
||||||
private void OnSearchChanged()
|
private void OnSearchChanged()
|
||||||
{
|
{
|
||||||
OnPropertyChanged(nameof(IsSearching));
|
OnPropertyChanged(nameof(IsFindingDuplicates));
|
||||||
|
OnPropertyChanged(nameof(IsFindingOrphans));
|
||||||
OnPropertyChanged(nameof(DuplicatesText));
|
OnPropertyChanged(nameof(DuplicatesText));
|
||||||
OnPropertyChanged(nameof(OrphansText));
|
OnPropertyChanged(nameof(OrphansText));
|
||||||
OnPropertyChanged(nameof(DuplicatesToolTip));
|
OnPropertyChanged(nameof(DuplicatesToolTip));
|
||||||
@@ -888,11 +926,14 @@ public sealed class ArchiveViewModel : SectionViewModel
|
|||||||
Orphans = Orphans?.Where(o => o.Row != row).ToList();
|
Orphans = Orphans?.Where(o => o.Row != row).ToList();
|
||||||
await LoadAsync();
|
await LoadAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or ArchiveOfflineException or DatabaseException
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or DatabaseException or ArgumentException)
|
||||||
or ArgumentException)
|
|
||||||
{
|
{
|
||||||
Log.Warning("archive", $"Fixing {row.Title} failed", ex);
|
Log.Warning("archive", $"Fixing {row.Title} failed", ex);
|
||||||
Shell.Notify(Loc.L("Archive.Orphans.FixFailed"), ex.Message);
|
NotifyFailure("Archive.Orphans.FixFailed", ex, new AsyncRelayCommand(() => FixAsync(row)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>An action stopped: what stopped, why in one sentence, and Retry to run it again (BRIEF §0.2 rule 6).</summary>
|
||||||
|
private void NotifyFailure(string titleKey, Exception ex, ICommand retry) =>
|
||||||
|
Shell.Notify(Loc.L(titleKey), ArchiveFailures.Cause(ex), Loc.L("Archive.Failed.Retry"), Loc.L("Tooltips.Archive.Retry"), () => retry.Execute(null));
|
||||||
}
|
}
|
||||||
@@ -102,10 +102,7 @@
|
|||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!--
|
<!-- Up to four digits (gap ≤ 1440) in 56 px: half the usual side padding. -->
|
||||||
Up to four digits (gap ≤ 1440). The kit's text box applies its padding twice (reported to the shared controls),
|
|
||||||
so the side padding is halved here: four digits fit before and after that fix.
|
|
||||||
-->
|
|
||||||
<Style x:Key="TextBox.Small" TargetType="TextBox" BasedOn="{StaticResource TextBox.Number}">
|
<Style x:Key="TextBox.Small" TargetType="TextBox" BasedOn="{StaticResource TextBox.Number}">
|
||||||
<Setter Property="Width" Value="56" />
|
<Setter Property="Width" Value="56" />
|
||||||
<Setter Property="Height" Value="30" />
|
<Setter Property="Height" Value="30" />
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ public sealed class JobsViewModel : SectionViewModel
|
|||||||
private void UpdateShell()
|
private void UpdateShell()
|
||||||
{
|
{
|
||||||
if (_model.Current is { } current)
|
if (_model.Current is { } current)
|
||||||
Shell.SetJob(JobText.Bar(current), current.Fraction ?? 0, indeterminate: current.Fraction is null);
|
Shell.SetJob(JobText.Bar(current), current.Fraction ?? 0, indeterminate: current.Fraction is null, name: JobText.Name(current.Job));
|
||||||
else
|
else
|
||||||
Shell.SetJob(null, 0);
|
Shell.SetJob(null, 0);
|
||||||
// The rail badge, the status strip and the Running chip count the same jobs: running or paused (Jobs.html).
|
// The rail badge, the status strip and the Running chip count the same jobs: running or paused (Jobs.html).
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
<DockPanel LastChildFill="True">
|
<DockPanel LastChildFill="True">
|
||||||
<ComboBox DockPanel.Dock="Right" VerticalAlignment="Top" MinWidth="120" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}"
|
<ComboBox DockPanel.Dock="Right" VerticalAlignment="Top" MinWidth="120" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}"
|
||||||
DisplayMemberPath="Name" ToolTip="{l:Loc Tooltips.Welcome.Language}" AutomationProperties.Name="{l:Loc Settings.General.Language}" />
|
DisplayMemberPath="Name" ToolTip="{l:Loc Tooltips.Welcome.Language}" AutomationProperties.Name="{l:Loc Settings.General.Language}" />
|
||||||
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" FlowDirection="LeftToRight" />
|
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" />
|
||||||
<StackPanel Margin="16,0,16,0" VerticalAlignment="Center">
|
<StackPanel Margin="16,0,16,0" VerticalAlignment="Center">
|
||||||
<TextBlock Text="{l:Loc Shell.Welcome.Title}" FontSize="20" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
|
<TextBlock Text="{l:Loc Shell.Welcome.Title}" FontSize="20" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
|
||||||
<TextBlock Text="{l:Loc Shell.Welcome.Question}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,4,0,0" TextTrimming="CharacterEllipsis" />
|
<TextBlock Text="{l:Loc Shell.Welcome.Question}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,4,0,0" TextTrimming="CharacterEllipsis" />
|
||||||
|
|||||||
@@ -43,8 +43,9 @@
|
|||||||
<Setter Property="TextAlignment" Value="Right" />
|
<Setter Property="TextAlignment" Value="Right" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Log tail: monospaced, muted. -->
|
<!-- Log tail: monospaced, muted, left to right in every language (paths, times, codes). -->
|
||||||
<Style x:Key="Text.Log" TargetType="TextBlock">
|
<Style x:Key="Text.Log" TargetType="TextBlock">
|
||||||
|
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||||
<Setter Property="FontFamily" Value="{StaticResource Font.Mono}" />
|
<Setter Property="FontFamily" Value="{StaticResource Font.Mono}" />
|
||||||
<Setter Property="FontSize" Value="12" />
|
<Setter Property="FontSize" Value="12" />
|
||||||
<Setter Property="LineHeight" Value="18" />
|
<Setter Property="LineHeight" Value="18" />
|
||||||
@@ -89,7 +90,7 @@
|
|||||||
|
|
||||||
<!-- Section list entry of Settings: 34 px, active = Card fill + 3 px accent edge (Settings.html). -->
|
<!-- Section list entry of Settings: 34 px, active = Card fill + 3 px accent edge (Settings.html). -->
|
||||||
<Style x:Key="ListBoxItem.Section" TargetType="ListBoxItem">
|
<Style x:Key="ListBoxItem.Section" TargetType="ListBoxItem">
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||||
<Setter Property="Height" Value="34" />
|
<Setter Property="Height" Value="34" />
|
||||||
<Setter Property="Margin" Value="0,0,0,2" />
|
<Setter Property="Margin" Value="0,0,0,2" />
|
||||||
@@ -145,21 +146,6 @@
|
|||||||
<Setter Property="Margin" Value="0,0,6,0" />
|
<Setter Property="Margin" Value="0,0,6,0" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- "Auto · 8" pill (DESIGN §4 Auto/manual): accent outline, 24 px, 11 px text. -->
|
|
||||||
<Style x:Key="Button.AutoPill" TargetType="Button" BasedOn="{StaticResource Button.Base}">
|
|
||||||
<Setter Property="Height" Value="24" />
|
|
||||||
<Setter Property="MinWidth" Value="0" />
|
|
||||||
<Setter Property="Padding" Value="8,0" />
|
|
||||||
<Setter Property="FontSize" Value="11" />
|
|
||||||
<Setter Property="Background" Value="Transparent" />
|
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
<Setter Property="ui:ControlState.CornerRadius" Value="12" />
|
|
||||||
<Setter Property="ui:ControlState.HoverBackground" Value="{DynamicResource Brush.AccentSubtle}" />
|
|
||||||
<Setter Property="ui:ControlState.HoverBorderBrush" Value="{DynamicResource Brush.Accent}" />
|
|
||||||
<Setter Property="ui:ControlState.PressedBackground" Value="{DynamicResource Brush.AccentSubtle}" />
|
|
||||||
</Style>
|
|
||||||
|
|
||||||
<!-- Toolbar dropdown (Library filters): accent border while a filter is active (bind Tag to the active flag). -->
|
<!-- Toolbar dropdown (Library filters): accent border while a filter is active (bind Tag to the active flag). -->
|
||||||
<Style x:Key="ComboBox.Filter" TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
|
<Style x:Key="ComboBox.Filter" TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
|
||||||
<Setter Property="MinWidth" Value="88" />
|
<Setter Property="MinWidth" Value="88" />
|
||||||
@@ -213,8 +199,8 @@
|
|||||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- Path and template fields in Settings (360 px, DESIGN mockup). -->
|
<!-- Path, address and template fields in Settings (360 px, DESIGN mockup), left to right in every language. -->
|
||||||
<Style x:Key="TextBox.Setting" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
<Style x:Key="TextBox.Setting" TargetType="TextBox" BasedOn="{StaticResource TextBox.Path}">
|
||||||
<Setter Property="Width" Value="360" />
|
<Setter Property="Width" Value="360" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -5,14 +5,17 @@
|
|||||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||||
Title="{l:Loc Shell.AppName}"
|
Title="{l:Loc Shell.AppName}"
|
||||||
IsDialog="True" ResizeMode="NoResize" SizeToContent="Height" Width="460"
|
IsDialog="True" ResizeMode="NoResize" SizeToContent="Height" Width="460"
|
||||||
WindowStartupLocation="CenterOwner" ShowInTaskbar="False">
|
WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
|
||||||
<!-- DESIGN §4 dialog: two buttons, safe action left and default, the action on the right. -->
|
AutomationProperties.Name="{Binding Heading}" AutomationProperties.HelpText="{Binding Message}">
|
||||||
|
<!-- DESIGN §4 dialog: two buttons, safe action left and default, the action on the right. Screen readers hear the
|
||||||
|
heading and the message as the dialog opens on the safe button. -->
|
||||||
<StackPanel Margin="24,18,24,20">
|
<StackPanel Margin="24,18,24,20">
|
||||||
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" TextWrapping="Wrap" TextTrimming="None" />
|
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" TextWrapping="Wrap" TextTrimming="None" />
|
||||||
<TextBlock Text="{Binding Message}" Margin="0,8,0,0" Foreground="{DynamicResource Brush.TextMuted}" TextWrapping="Wrap" TextTrimming="None" LineHeight="18" />
|
<TextBlock Text="{Binding Message}" Margin="0,8,0,0" Foreground="{DynamicResource Brush.TextMuted}" TextWrapping="Wrap" TextTrimming="None" LineHeight="18" />
|
||||||
<Border Style="{StaticResource Border.Card}" Margin="0,16,0,0" Padding="12,10" ToolTip="{Binding DetailToolTip}"
|
<Border Style="{StaticResource Border.Card}" Margin="0,16,0,0" Padding="12,10" ToolTip="{Binding DetailToolTip}"
|
||||||
Visibility="{Binding Detail, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
Visibility="{Binding Detail, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
||||||
<TextBlock x:Name="DetailText" Text="{Binding Detail}" FontFamily="{StaticResource Font.Mono}" FontSize="{StaticResource Size.Secondary}" TextWrapping="Wrap" TextTrimming="None" LineHeight="18" />
|
<TextBlock x:Name="DetailText" Text="{Binding Detail}" FontFamily="{StaticResource Font.Mono}" FontSize="{StaticResource Size.Secondary}" TextWrapping="Wrap" TextTrimming="None" LineHeight="18"
|
||||||
|
FlowDirection="LeftToRight" />
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel x:Name="Typing" Margin="0,16,0,0" Visibility="Collapsed">
|
<StackPanel x:Name="Typing" Margin="0,16,0,0" Visibility="Collapsed">
|
||||||
<TextBlock Text="{Binding TypedPrompt}" Foreground="{DynamicResource Brush.TextMuted}" TextWrapping="Wrap" />
|
<TextBlock Text="{Binding TypedPrompt}" Foreground="{DynamicResource Brush.TextMuted}" TextWrapping="Wrap" />
|
||||||
@@ -20,7 +23,7 @@
|
|||||||
AutomationProperties.Name="{Binding TypedPrompt}" TextChanged="OnTyped" />
|
AutomationProperties.Name="{Binding TypedPrompt}" TextChanged="OnTyped" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,24,0,0">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,24,0,0">
|
||||||
<Button Content="{Binding SafeText}" ToolTip="{Binding SafeToolTip}" IsDefault="True" IsCancel="True" MinWidth="96" Click="OnSafe" />
|
<Button x:Name="Safe" Content="{Binding SafeText}" ToolTip="{Binding SafeToolTip}" IsDefault="True" IsCancel="True" MinWidth="96" Click="OnSafe" />
|
||||||
<Button x:Name="Action" Content="{Binding ActionText}" ToolTip="{Binding ActionToolTip}" MinWidth="96" Margin="8,0,0,0" Click="OnAction" />
|
<Button x:Name="Action" Content="{Binding ActionText}" ToolTip="{Binding ActionToolTip}" MinWidth="96" Margin="8,0,0,0" Click="OnAction" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -12,8 +12,17 @@ public sealed partial class ConfirmDialog : TitanoWindow
|
|||||||
DataContext = request;
|
DataContext = request;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Action.SetResourceReference(StyleProperty, request.IsDestructive ? "Button.Destructive" : "Button.Primary");
|
Action.SetResourceReference(StyleProperty, request.IsDestructive ? "Button.Destructive" : "Button.Primary");
|
||||||
if (!request.IsDetailMonospaced) DetailText.SetResourceReference(FontFamilyProperty, "Font.Ui");
|
if (!request.IsDetailMonospaced)
|
||||||
if (request.TypedConfirmation is null) return;
|
{
|
||||||
|
// Names and sentences follow the reading direction; only fingerprints stay left to right.
|
||||||
|
DetailText.SetResourceReference(FontFamilyProperty, "Font.Ui");
|
||||||
|
DetailText.ClearValue(FlowDirectionProperty);
|
||||||
|
}
|
||||||
|
if (request.TypedConfirmation is null)
|
||||||
|
{
|
||||||
|
Loaded += (_, _) => Safe.Focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
Typing.Visibility = Visibility.Visible;
|
Typing.Visibility = Visibility.Visible;
|
||||||
Loaded += (_, _) => Typed.Focus();
|
Loaded += (_, _) => Typed.Focus();
|
||||||
EnableAction(false);
|
EnableAction(false);
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using Titano.Core.Archiving;
|
||||||
|
using Titano.Core.Import;
|
||||||
|
using Titano.Core.Localization;
|
||||||
|
using Titano.Core.Render;
|
||||||
|
using Titano.Data.Archiving;
|
||||||
|
using Titano.Data.Sync;
|
||||||
|
using Titano.Protocol.Client;
|
||||||
|
|
||||||
|
namespace Titano.App.Shell;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The sentence an error toast shows (BRIEF §0.2: one sentence saying what happened plus one action). Only failures
|
||||||
|
/// that carry a catalog sentence say what happened; anything else (framework and OS messages, often technical
|
||||||
|
/// English) reads "Something went wrong." and stays in the log.
|
||||||
|
/// </summary>
|
||||||
|
public static class ErrorText
|
||||||
|
{
|
||||||
|
public static string For(Exception ex) => Describe(Unwrap(ex)) ?? Loc.L("Errors.Unexpected");
|
||||||
|
|
||||||
|
private static string? Describe(Exception ex) => ex switch
|
||||||
|
{
|
||||||
|
LeaseUnavailableException or ArchiveOfflineException or NewerFormatException or ImportSourceUnavailableException
|
||||||
|
or CopyVerificationException or StaleRenamePlanException or SyncConflictChangedException => ex.Message,
|
||||||
|
// The server words its errors in the client's language (Accept-Language).
|
||||||
|
TitanoApiException api when !string.IsNullOrWhiteSpace(api.Error.Message) => api.Error.Message,
|
||||||
|
RenderException render => Loc.Get(render.ReasonKey, Loc.Culture) is null ? null : Loc.L(render.ReasonKey, [.. render.Args]),
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>Awaited tasks and reflection wrap the real failure in one layer or more.</summary>
|
||||||
|
private static Exception Unwrap(Exception ex)
|
||||||
|
{
|
||||||
|
while (ex is AggregateException { InnerExceptions.Count: 1 } or TargetInvocationException && ex.InnerException is { } inner) ex = inner;
|
||||||
|
return ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,11 +5,11 @@
|
|||||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||||
Title="{l:Loc Shell.AppName}"
|
Title="{l:Loc Shell.AppName}"
|
||||||
IsDialog="True" ResizeMode="NoResize" SizeToContent="Height" Width="440"
|
IsDialog="True" ResizeMode="NoResize" SizeToContent="Height" Width="440"
|
||||||
WindowStartupLocation="CenterOwner" ShowInTaskbar="False">
|
WindowStartupLocation="CenterOwner" ShowInTaskbar="False" AutomationProperties.Name="{l:Loc Server.Login.Title}">
|
||||||
<!-- BRIEF §12.7 login modal: the server is already identified and its certificate trusted. -->
|
<!-- BRIEF §12.7 login modal: the server is already identified and its certificate trusted. -->
|
||||||
<StackPanel Margin="24,18,24,20">
|
<StackPanel Margin="24,18,24,20">
|
||||||
<TextBlock Text="{l:Loc Server.Login.Title}" Style="{StaticResource Text.Title}" />
|
<TextBlock Text="{l:Loc Server.Login.Title}" Style="{StaticResource Text.Title}" />
|
||||||
<TextBlock x:Name="ServerText" Margin="0,4,0,0" Style="{StaticResource Text.Secondary}" />
|
<TextBlock x:Name="ServerText" Margin="0,4,0,0" Style="{StaticResource Text.Secondary}" FlowDirection="LeftToRight" HorizontalAlignment="Left" />
|
||||||
<Grid Margin="0,18,0,0">
|
<Grid Margin="0,18,0,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" MinWidth="92" />
|
<ColumnDefinition Width="Auto" MinWidth="92" />
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
using Titano.Ui.Controls;
|
using Titano.Ui.Controls;
|
||||||
|
|
||||||
namespace Titano.App.Shell;
|
namespace Titano.App.Shell;
|
||||||
@@ -6,7 +8,8 @@ namespace Titano.App.Shell;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The login form (BRIEF §12.7). It calls back the connection with the credentials and stays open with the
|
/// The login form (BRIEF §12.7). It calls back the connection with the credentials and stays open with the
|
||||||
/// error sentence until the sign-in succeeds or the user cancels. The password never leaves the PasswordBox
|
/// error sentence until the sign-in succeeds or the user cancels. The password never leaves the PasswordBox
|
||||||
/// except for that call.
|
/// except for that call. A failed sign-in is announced to screen readers and marks the password box (error border,
|
||||||
|
/// sentence as its help text) until the next attempt.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed partial class LoginDialog : TitanoWindow
|
public sealed partial class LoginDialog : TitanoWindow
|
||||||
{
|
{
|
||||||
@@ -40,6 +43,7 @@ public sealed partial class LoginDialog : TitanoWindow
|
|||||||
{
|
{
|
||||||
SignIn.IsEnabled = false;
|
SignIn.IsEnabled = false;
|
||||||
Error.Visibility = Visibility.Collapsed;
|
Error.Visibility = Visibility.Collapsed;
|
||||||
|
Field.SetError(Password, null);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var error = await _signIn(User.Text, Password.Password);
|
var error = await _signIn(User.Text, Password.Password);
|
||||||
@@ -50,8 +54,11 @@ public sealed partial class LoginDialog : TitanoWindow
|
|||||||
}
|
}
|
||||||
Error.Text = error;
|
Error.Text = error;
|
||||||
Error.Visibility = Visibility.Visible;
|
Error.Visibility = Visibility.Visible;
|
||||||
|
Field.SetError(Password, error);
|
||||||
Password.Clear();
|
Password.Clear();
|
||||||
Password.Focus();
|
Password.Focus();
|
||||||
|
UIElementAutomationPeer.CreatePeerForElement(this)?.RaiseNotificationEvent(
|
||||||
|
AutomationNotificationKind.ActionCompleted, AutomationNotificationProcessing.ImportantMostRecent, error, "Titano.SignIn");
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
|
||||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||||
xmlns:shell="clr-namespace:Titano.App.Shell"
|
xmlns:shell="clr-namespace:Titano.App.Shell"
|
||||||
|
xmlns:infra="clr-namespace:Titano.App.Infrastructure"
|
||||||
xmlns:s="clr-namespace:Titano.App.Sections"
|
xmlns:s="clr-namespace:Titano.App.Sections"
|
||||||
Title="{Binding WindowTitle}"
|
Title="{Binding WindowTitle}"
|
||||||
Width="1440" Height="900" MinWidth="1200" MinHeight="760"
|
Width="1440" Height="900" MinWidth="1200" MinHeight="760"
|
||||||
@@ -14,8 +15,24 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<!-- Navigation rail: full names, collapsible to icons (BRIEF §12.1). -->
|
<!-- Navigation rail: full names, collapsible to icons (BRIEF §12.1). Expanded it is at least 128 px and grows with
|
||||||
<Border x:Name="Rail" Background="{DynamicResource Brush.Chrome}" Width="128" ui:NavRail.IsCollapsed="{Binding IsRailCollapsed}">
|
the longest label of the language (up to 200 px); collapsed it is 48 px of icons. While the first-run dialog is
|
||||||
|
open the shell behind it takes no input. The buttons of both lists form one group (GroupName); their check
|
||||||
|
binds one way, the section the shell navigates to (a GroupName spans every window not yet on screen). -->
|
||||||
|
<Border x:Name="Rail" Background="{DynamicResource Brush.Chrome}" ui:NavRail.IsCollapsed="{Binding IsRailCollapsed}"
|
||||||
|
IsEnabled="{Binding IsShellEnabled}">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="MinWidth" Value="128" />
|
||||||
|
<Setter Property="MaxWidth" Value="200" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsRailCollapsed}" Value="True">
|
||||||
|
<Setter Property="MinWidth" Value="0" />
|
||||||
|
<Setter Property="Width" Value="48" />
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
<DockPanel Margin="8,8,8,8" LastChildFill="False">
|
<DockPanel Margin="8,8,8,8" LastChildFill="False">
|
||||||
<Button DockPanel.Dock="Top" Style="{StaticResource Button.IconSubtle}" HorizontalAlignment="Left" Margin="0,0,0,6"
|
<Button DockPanel.Dock="Top" Style="{StaticResource Button.IconSubtle}" HorizontalAlignment="Left" Margin="0,0,0,6"
|
||||||
ui:ButtonIcon.Glyph="{StaticResource Icon.Menu}" Command="{Binding ToggleRailCommand}"
|
ui:ButtonIcon.Glyph="{StaticResource Icon.Menu}" Command="{Binding ToggleRailCommand}"
|
||||||
@@ -24,7 +41,7 @@
|
|||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type shell:SectionViewModel}">
|
<DataTemplate DataType="{x:Type shell:SectionViewModel}">
|
||||||
<ui:NavRailButton GroupName="Rail" Glyph="{Binding Glyph}" Content="{Binding Label}" Badge="{Binding Badge}"
|
<ui:NavRailButton GroupName="Rail" Glyph="{Binding Glyph}" Content="{Binding Label}" Badge="{Binding Badge}"
|
||||||
IsChecked="{Binding IsSelected}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Label}"
|
IsChecked="{Binding IsSelected, Mode=OneWay}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Label}"
|
||||||
Command="{Binding DataContext.NavigateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding}" />
|
Command="{Binding DataContext.NavigateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
@@ -33,7 +50,7 @@
|
|||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type shell:SectionViewModel}">
|
<DataTemplate DataType="{x:Type shell:SectionViewModel}">
|
||||||
<ui:NavRailButton GroupName="Rail" Glyph="{Binding Glyph}" Content="{Binding Label}" Badge="{Binding Badge}"
|
<ui:NavRailButton GroupName="Rail" Glyph="{Binding Glyph}" Content="{Binding Label}" Badge="{Binding Badge}"
|
||||||
IsChecked="{Binding IsSelected}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Label}"
|
IsChecked="{Binding IsSelected, Mode=OneWay}" ToolTip="{Binding ToolTip}" AutomationProperties.Name="{Binding Label}"
|
||||||
Command="{Binding DataContext.NavigateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding}" />
|
Command="{Binding DataContext.NavigateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}" CommandParameter="{Binding}" />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
@@ -41,17 +58,19 @@
|
|||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Grid Grid.Column="1">
|
<Grid Grid.Column="1" IsEnabled="{Binding IsShellEnabled}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Job bar (DESIGN §4): current job, progress, time left, pause; "Ready" when idle, hidden when idle in the editor. -->
|
<!-- Job bar (DESIGN §4): current job, progress, time left, pause; "Ready" when idle, hidden when idle in the editor.
|
||||||
<ui:JobBar Text="{Binding JobText}" Progress="{Binding JobProgress}" IsActive="{Binding IsJobActive}" IsIndeterminate="{Binding IsJobIndeterminate}"
|
Screen readers hear which job starts and when the queue empties, not its progress ticks. -->
|
||||||
StopCommand="{Binding StopJobCommand}" StopToolTip="{l:Loc Tooltips.Shell.PauseJob}" ActionGlyph="{StaticResource Icon.Pause}"
|
<ui:JobBar x:Name="JobBar" Text="{Binding JobText}" Progress="{Binding JobProgress}" IsActive="{Binding IsJobActive}" IsIndeterminate="{Binding IsJobIndeterminate}"
|
||||||
Visibility="{Binding IsJobBarVisible, Converter={StaticResource BoolToVisibility}}" />
|
StopCommand="{Binding StopJobCommand}" StopToolTip="{l:Loc Tooltips.Shell.PauseJob}" StopName="{l:Loc Shell.JobBar.Pause}" ActionGlyph="{StaticResource Icon.Pause}"
|
||||||
|
Visibility="{Binding IsJobBarVisible, Converter={StaticResource BoolToVisibility}}"
|
||||||
|
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding JobAnnouncement}" />
|
||||||
|
|
||||||
<ContentControl Grid.Row="1" Content="{Binding Current}" Focusable="False" />
|
<ContentControl Grid.Row="1" Content="{Binding Current}" Focusable="False" />
|
||||||
|
|
||||||
@@ -61,18 +80,22 @@
|
|||||||
<TextBlock Text="{Binding SequencesText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
<TextBlock Text="{Binding SequencesText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
||||||
<TextBlock Text="{Binding PhotosText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
<TextBlock Text="{Binding PhotosText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
||||||
<TextBlock Text="{Binding StorageText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
<TextBlock Text="{Binding StorageText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
||||||
<TextBlock x:Name="Connection" Text="{Binding ConnectionText}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
<TextBlock x:Name="Connection" Text="{Binding ConnectionText}" Margin="0,0,18,0" VerticalAlignment="Center"
|
||||||
|
AutomationProperties.LiveSetting="Polite" infra:LiveRegion.Text="{Binding ConnectionText}" />
|
||||||
<TextBlock Text="{Binding JobsText}" VerticalAlignment="Center" />
|
<TextBlock Text="{Binding JobsText}" VerticalAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<ui:ToastHost x:Name="Toasts" Grid.Row="0" Grid.RowSpan="3" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- First run (Welcome.html): the shell dimmed behind one dialog. -->
|
<!-- First run (Welcome.html): the shell dimmed behind one dialog that keeps the keyboard. -->
|
||||||
<Grid Grid.ColumnSpan="2" Visibility="{Binding IsWelcomeOpen, Converter={StaticResource BoolToVisibility}}">
|
<Grid x:Name="WelcomeOverlay" Grid.ColumnSpan="2" Visibility="{Binding IsWelcomeOpen, Converter={StaticResource BoolToVisibility}}"
|
||||||
|
KeyboardNavigation.TabNavigation="Cycle" KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
|
||||||
<Border Background="{DynamicResource Brush.Scrim}" />
|
<Border Background="{DynamicResource Brush.Scrim}" />
|
||||||
<s:WelcomeView DataContext="{Binding Welcome}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,114,0,0" />
|
<s:WelcomeView DataContext="{Binding Welcome}" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,114,0,0"
|
||||||
|
AutomationProperties.Name="{l:Loc Shell.Welcome.Title}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<!-- Above the first-run dialog too, so a card inserted meanwhile can still be acted on (Welcome.html). -->
|
||||||
|
<ui:ToastHost x:Name="Toasts" Grid.ColumnSpan="2" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ui:TitanoWindow>
|
</ui:TitanoWindow>
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Threading;
|
||||||
using Titano.App.Infrastructure;
|
using Titano.App.Infrastructure;
|
||||||
using Titano.Ui.Controls;
|
using Titano.Ui.Controls;
|
||||||
|
|
||||||
@@ -14,21 +18,50 @@ public partial class MainWindow : TitanoWindow
|
|||||||
_shell = shell;
|
_shell = shell;
|
||||||
DataContext = shell;
|
DataContext = shell;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Rail.Width = shell.IsRailCollapsed ? 48 : 128;
|
|
||||||
UpdateConnection();
|
UpdateConnection();
|
||||||
shell.PropertyChanged += (_, e) =>
|
shell.PropertyChanged += (_, e) =>
|
||||||
{
|
{
|
||||||
if (e.PropertyName is nameof(ShellViewModel.IsRailCollapsed) or "")
|
|
||||||
Rail.Width = shell.IsRailCollapsed ? 48 : 128;
|
|
||||||
if (e.PropertyName is nameof(ShellViewModel.IsConnected) or "") UpdateConnection();
|
if (e.PropertyName is nameof(ShellViewModel.IsConnected) or "") UpdateConnection();
|
||||||
|
if (e.PropertyName is nameof(ShellViewModel.IsWelcomeOpen) or "") FocusWelcome();
|
||||||
};
|
};
|
||||||
shell.PendingToasts.CollectionChanged += OnToastRequested;
|
shell.PendingToasts.CollectionChanged += OnToastRequested;
|
||||||
|
Loaded += (_, _) => FocusWelcome();
|
||||||
RestorePlacement();
|
RestorePlacement();
|
||||||
Closing += (_, _) => SavePlacement();
|
Closing += (_, _) => SavePlacement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>F6 moves the keyboard to the newest notification (as in Windows apps), Esc there dismisses it.</summary>
|
||||||
|
protected override void OnKeyDown(KeyEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnKeyDown(e);
|
||||||
|
if (!e.Handled && e.Key == Key.F6 && Keyboard.Modifiers == ModifierKeys.None) e.Handled = Toasts.FocusNewest();
|
||||||
|
}
|
||||||
|
|
||||||
private void UpdateConnection() =>
|
private void UpdateConnection() =>
|
||||||
Connection.SetResourceReference(System.Windows.Controls.TextBlock.ForegroundProperty, _shell.IsConnected ? "Brush.Accent" : "Brush.TextMuted");
|
Connection.SetResourceReference(TextBlock.ForegroundProperty, _shell.IsConnected ? "Brush.Accent" : "Brush.TextMuted");
|
||||||
|
|
||||||
|
/// <summary>The first-run dialog takes the keyboard on its chosen option once it is on screen.</summary>
|
||||||
|
private void FocusWelcome()
|
||||||
|
{
|
||||||
|
if (!_shell.IsWelcomeOpen) return;
|
||||||
|
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () =>
|
||||||
|
{
|
||||||
|
if (!_shell.IsWelcomeOpen || !IsLoaded) return;
|
||||||
|
if (FindChecked(WelcomeOverlay) is { } choice) choice.Focus();
|
||||||
|
else WelcomeOverlay.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RadioButton? FindChecked(DependencyObject root)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(root); i++)
|
||||||
|
{
|
||||||
|
var child = VisualTreeHelper.GetChild(root, i);
|
||||||
|
if (child is RadioButton { IsChecked: true } radio) return radio;
|
||||||
|
if (FindChecked(child) is { } nested) return nested;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnToastRequested(object? sender, NotifyCollectionChangedEventArgs e)
|
private void OnToastRequested(object? sender, NotifyCollectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Titano.App.Archiving;
|
|||||||
using Titano.App.DesignTime;
|
using Titano.App.DesignTime;
|
||||||
using Titano.App.Editor;
|
using Titano.App.Editor;
|
||||||
using Titano.App.Import;
|
using Titano.App.Import;
|
||||||
|
using Titano.App.Infrastructure;
|
||||||
using Titano.App.Library;
|
using Titano.App.Library;
|
||||||
using Titano.App.Server;
|
using Titano.App.Server;
|
||||||
using Titano.App.Settings;
|
using Titano.App.Settings;
|
||||||
@@ -18,7 +19,9 @@ namespace Titano.App.Shell;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// <c>Titano.exe --capture <dir></c>: renders every client screen at 1440×900 in the dark and light themes to
|
/// <c>Titano.exe --capture <dir></c>: renders every client screen at 1440×900 in the dark and light themes to
|
||||||
/// <c><screen>-<theme>.png</c> from <see cref="SampleData"/> (first run on an empty index, then a populated
|
/// <c><screen>-<theme>.png</c> from <see cref="SampleData"/> (first run on an empty index, then a populated
|
||||||
/// one, then the sync table with transfers, a conflict and its confirmation), for visual review and phase reports (BRIEF §20.2), then exits.
|
/// one, then the sync table with transfers, a conflict and its confirmation), plus the Library, the editor's Exposure
|
||||||
|
/// tab and the import plan in Arabic (<c>*-rtl-dark.png</c>, right to left), for visual review and phase reports
|
||||||
|
/// (BRIEF §20.2), then exits.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class ScreenCapture
|
public static class ScreenCapture
|
||||||
{
|
{
|
||||||
@@ -82,6 +85,9 @@ public static class ScreenCapture
|
|||||||
written += await SaveAsync(window, directory, "library-list", theme, waitForThumbnails: shell);
|
written += await SaveAsync(window, directory, "library-list", theme, waitForThumbnails: shell);
|
||||||
shell.Library.LayoutIndex = 0;
|
shell.Library.LayoutIndex = 0;
|
||||||
shell.Library.ClearSelectionCommand.Execute(null);
|
shell.Library.ClearSelectionCommand.Execute(null);
|
||||||
|
shell.IsRailCollapsed = true;
|
||||||
|
written += await SaveAsync(window, directory, "library-rail-collapsed", theme, waitForThumbnails: shell);
|
||||||
|
shell.IsRailCollapsed = false;
|
||||||
written += await CaptureLibraryScenesAsync(window, shell, directory, theme);
|
written += await CaptureLibraryScenesAsync(window, shell, directory, theme);
|
||||||
|
|
||||||
shell.Navigate(SectionKey.Jobs);
|
shell.Navigate(SectionKey.Jobs);
|
||||||
@@ -241,6 +247,8 @@ public static class ScreenCapture
|
|||||||
foreach (var toast in window.Toasts.Toasts.ToList()) window.Toasts.Dismiss(toast);
|
foreach (var toast in window.Toasts.Toasts.ToList()) window.Toasts.Dismiss(toast);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
written += await CaptureRightToLeftAsync(window, shell, editor, directory);
|
||||||
|
|
||||||
// Last, as it stays: an analysis of the sequence running (settings disabled, viewing tools live).
|
// Last, as it stays: an analysis of the sequence running (settings disabled, viewing tools live).
|
||||||
await sample.MarkAnalysingAsync(id);
|
await sample.MarkAnalysingAsync(id);
|
||||||
await editor.AttachJobsAsync();
|
await editor.AttachJobsAsync();
|
||||||
@@ -252,6 +260,41 @@ public static class ScreenCapture
|
|||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The Library, the editor's Exposure tab and the import plan in Arabic, dark: the layout mirrors while photos,
|
||||||
|
/// charts, the filmstrip and templates stay left to right. English is restored whatever happens.
|
||||||
|
/// </summary>
|
||||||
|
private static async Task<int> CaptureRightToLeftAsync(MainWindow window, ShellViewModel shell, EditorViewModel editor, string directory)
|
||||||
|
{
|
||||||
|
var written = 0;
|
||||||
|
var frame = editor.CurrentIndex;
|
||||||
|
ThemeManager.Apply(AppTheme.Dark);
|
||||||
|
UiLanguage.Apply("ar");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DismissToasts(window);
|
||||||
|
shell.Navigate(SectionKey.Library);
|
||||||
|
written += await SaveAsync(window, directory, "library-rtl", AppTheme.Dark, waitForThumbnails: shell);
|
||||||
|
|
||||||
|
shell.Navigate(SectionKey.Sequence);
|
||||||
|
editor.SelectedTab = editor.Exposure;
|
||||||
|
editor.IsCompare = true;
|
||||||
|
editor.CurrentIndex = 45;
|
||||||
|
written += await SaveEditorAsync(window, editor, directory, "sequence-exposure-rtl", AppTheme.Dark);
|
||||||
|
|
||||||
|
await ImportScenes.ShowAsync(shell, "plan");
|
||||||
|
DismissToasts(window);
|
||||||
|
written += await SaveAsync(window, directory, "import-plan-rtl", AppTheme.Dark);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
UiLanguage.Apply("en");
|
||||||
|
}
|
||||||
|
shell.Navigate(SectionKey.Sequence);
|
||||||
|
editor.CurrentIndex = frame;
|
||||||
|
return written;
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task<int> SaveEditorAsync(Window window, EditorViewModel editor, string directory, string screen, AppTheme theme)
|
private static async Task<int> SaveEditorAsync(Window window, EditorViewModel editor, string directory, string screen, AppTheme theme)
|
||||||
{
|
{
|
||||||
await Settle(window);
|
await Settle(window);
|
||||||
@@ -306,6 +349,7 @@ public static class ScreenCapture
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
|
var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
|
||||||
|
// A right-to-left window's content already renders mirrored, as on screen.
|
||||||
bitmap.Render(root);
|
bitmap.Render(root);
|
||||||
var encoder = new PngBitmapEncoder();
|
var encoder = new PngBitmapEncoder();
|
||||||
encoder.Frames.Add(BitmapFrame.Create(bitmap));
|
encoder.Frames.Add(BitmapFrame.Create(bitmap));
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
|||||||
private SectionViewModel _current;
|
private SectionViewModel _current;
|
||||||
private bool _isRailCollapsed;
|
private bool _isRailCollapsed;
|
||||||
private string? _jobText;
|
private string? _jobText;
|
||||||
|
private string? _jobName;
|
||||||
private double _jobProgress;
|
private double _jobProgress;
|
||||||
private bool _jobActive;
|
private bool _jobActive;
|
||||||
private bool _jobIndeterminate;
|
private bool _jobIndeterminate;
|
||||||
@@ -85,12 +86,17 @@ public sealed class ShellViewModel : LocalizedViewModel
|
|||||||
get => _welcome;
|
get => _welcome;
|
||||||
private set
|
private set
|
||||||
{
|
{
|
||||||
if (Set(ref _welcome, value)) OnPropertyChanged(nameof(IsWelcomeOpen));
|
if (!Set(ref _welcome, value)) return;
|
||||||
|
OnPropertyChanged(nameof(IsWelcomeOpen));
|
||||||
|
OnPropertyChanged(nameof(IsShellEnabled));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsWelcomeOpen => _welcome is not null;
|
public bool IsWelcomeOpen => _welcome is not null;
|
||||||
|
|
||||||
|
/// <summary>The rail and the sections take input only while no first-run dialog covers them.</summary>
|
||||||
|
public bool IsShellEnabled => _welcome is null;
|
||||||
|
|
||||||
public SectionViewModel Current
|
public SectionViewModel Current
|
||||||
{
|
{
|
||||||
get => _current;
|
get => _current;
|
||||||
@@ -105,7 +111,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string WindowTitle => Current == Library ? "Titano" : "Titano — " + Current.Title;
|
public string WindowTitle => Current == Library ? Loc.L("Shell.AppName") : Loc.L("Shell.WindowTitle", Loc.L("Shell.AppName"), Current.Title);
|
||||||
|
|
||||||
public bool IsRailCollapsed
|
public bool IsRailCollapsed
|
||||||
{
|
{
|
||||||
@@ -160,7 +166,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
|||||||
// ---- Job bar ----
|
// ---- Job bar ----
|
||||||
public string JobText => _jobActive && _jobText is not null
|
public string JobText => _jobActive && _jobText is not null
|
||||||
? _jobText
|
? _jobText
|
||||||
: _queuedCount > 0 ? Loc.L("Shell.JobBar.Ready", _queuedCount) : Loc.L("Shell.JobBar.Idle");
|
: _queuedCount > 0 ? Loc.Plural("Shell.JobBar.Ready", _queuedCount) : Loc.L("Shell.JobBar.Idle");
|
||||||
|
|
||||||
public double JobProgress { get => _jobProgress; private set => Set(ref _jobProgress, value); }
|
public double JobProgress { get => _jobProgress; private set => Set(ref _jobProgress, value); }
|
||||||
public bool IsJobActive
|
public bool IsJobActive
|
||||||
@@ -179,14 +185,25 @@ public sealed class ShellViewModel : LocalizedViewModel
|
|||||||
/// <summary>Pauses the job the bar shows.</summary>
|
/// <summary>Pauses the job the bar shows.</summary>
|
||||||
public ICommand? StopJobCommand => Jobs.PauseCurrentCommand;
|
public ICommand? StopJobCommand => Jobs.PauseCurrentCommand;
|
||||||
|
|
||||||
/// <summary>Updates the global job bar (and the taskbar progress through the window).</summary>
|
/// <summary>
|
||||||
public void SetJob(string? text, double progress, bool indeterminate = false)
|
/// What screen readers hear from the job bar: the job when one starts, the idle line when the last one ends; not its
|
||||||
|
/// progress, speed or time left, which change every second.
|
||||||
|
/// </summary>
|
||||||
|
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"/>.
|
||||||
|
/// </summary>
|
||||||
|
public void SetJob(string? text, double progress, bool indeterminate = false, string? name = null)
|
||||||
{
|
{
|
||||||
_jobText = text;
|
_jobText = text;
|
||||||
|
_jobName = text is null ? null : name ?? text;
|
||||||
IsJobActive = text is not null;
|
IsJobActive = text is not null;
|
||||||
JobProgress = progress;
|
JobProgress = progress;
|
||||||
IsJobIndeterminate = indeterminate;
|
IsJobIndeterminate = indeterminate;
|
||||||
OnPropertyChanged(nameof(JobText));
|
OnPropertyChanged(nameof(JobText));
|
||||||
|
OnPropertyChanged(nameof(JobAnnouncement));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Status strip ----
|
// ---- Status strip ----
|
||||||
@@ -222,6 +239,7 @@ public sealed class ShellViewModel : LocalizedViewModel
|
|||||||
_queuedCount = queued;
|
_queuedCount = queued;
|
||||||
OnPropertyChanged(nameof(JobsText));
|
OnPropertyChanged(nameof(JobsText));
|
||||||
OnPropertyChanged(nameof(JobText));
|
OnPropertyChanged(nameof(JobText));
|
||||||
|
OnPropertyChanged(nameof(JobAnnouncement));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Navigate(SectionKey key)
|
public void Navigate(SectionKey key)
|
||||||
@@ -250,14 +268,14 @@ public sealed class ShellViewModel : LocalizedViewModel
|
|||||||
ActionCommand = action is null ? null : new RelayCommand(action),
|
ActionCommand = action is null ? null : new RelayCommand(action),
|
||||||
});
|
});
|
||||||
|
|
||||||
/// <summary>Errors are one sentence saying what happened plus one action (BRIEF §0.2 rule 6).</summary>
|
/// <summary>Errors are one sentence saying what happened plus one action (BRIEF §0.2 rule 6); the details go to the log.</summary>
|
||||||
public void ReportError(Exception ex)
|
public void ReportError(Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error("ui", "Operation failed", ex);
|
Log.Error("ui", "Operation failed", ex);
|
||||||
ShowToast(new Toast
|
ShowToast(new Toast
|
||||||
{
|
{
|
||||||
Title = Loc.L("Errors.Unexpected"),
|
Title = ErrorText.For(ex),
|
||||||
Message = ex.Message,
|
IsError = true,
|
||||||
ActionText = Loc.L("Common.OpenLogs"),
|
ActionText = Loc.L("Common.OpenLogs"),
|
||||||
ActionToolTip = Loc.L("Tooltips.Common.OpenLogs"),
|
ActionToolTip = Loc.L("Tooltips.Common.OpenLogs"),
|
||||||
ActionCommand = new RelayCommand(() => ShellActions.Reveal(Services.Environment.LogDirectory)),
|
ActionCommand = new RelayCommand(() => ShellActions.Reveal(Services.Environment.LogDirectory)),
|
||||||
|
|||||||
@@ -60,6 +60,12 @@ public sealed class StaleDeletePlanException(Guid sequenceId) : InvalidOperation
|
|||||||
public Guid SequenceId { get; } = sequenceId;
|
public Guid SequenceId { get; } = sequenceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>A trash entry cannot come back: the index already holds its sequence (restored before, or scanned again); nothing moved.</summary>
|
||||||
|
public sealed class SequenceInLibraryException(Guid sequenceId, string title) : InvalidOperationException(Loc.L("Archive.Error.InLibrary", title))
|
||||||
|
{
|
||||||
|
public Guid SequenceId { get; } = sequenceId;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deleting sequences without erasing anything (BRIEF §0.2 rule 8, §12.2, §12.5): <see cref="PlanAsync"/> is the dry
|
/// Deleting sequences without erasing anything (BRIEF §0.2 rule 8, §12.2, §12.5): <see cref="PlanAsync"/> is the dry
|
||||||
/// run; <see cref="DeleteAsync"/> moves each sequence folder whole — originals, proxies, exports and its sidecars — into
|
/// run; <see cref="DeleteAsync"/> moves each sequence folder whole — originals, proxies, exports and its sidecars — into
|
||||||
@@ -188,7 +194,7 @@ public sealed class SequenceTrash
|
|||||||
/// sequence's id, as a scan would adopt it, with the title, tags, rating and notes the record kept. Returns the
|
/// sequence's id, as a scan would adopt it, with the title, tags, rating and notes the record kept. Returns the
|
||||||
/// restored row. When it cannot be indexed, the folder goes back into the trash with its record.
|
/// restored row. When it cannot be indexed, the folder goes back into the trash with its record.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <exception cref="InvalidOperationException">The index already holds that sequence.</exception>
|
/// <exception cref="SequenceInLibraryException">The index already holds that sequence.</exception>
|
||||||
/// <exception cref="DirectoryNotFoundException">The entry is not in the trash.</exception>
|
/// <exception cref="DirectoryNotFoundException">The entry is not in the trash.</exception>
|
||||||
public async Task<Sequence> RestoreAsync(Archive archive, string name, CancellationToken cancellationToken = default)
|
public async Task<Sequence> RestoreAsync(Archive archive, string name, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
@@ -203,7 +209,7 @@ public sealed class SequenceTrash
|
|||||||
throw new DirectoryNotFoundException($"{name} is not in the trash of {archive.Name}.");
|
throw new DirectoryNotFoundException($"{name} is not in the trash of {archive.Name}.");
|
||||||
var id = record.Sequence.Id;
|
var id = record.Sequence.Id;
|
||||||
if (await _db.Sequences.GetAsync(id, cancellationToken).ConfigureAwait(false) is not null)
|
if (await _db.Sequences.GetAsync(id, cancellationToken).ConfigureAwait(false) is not null)
|
||||||
throw new InvalidOperationException(Loc.L("Archive.Error.InLibrary", record.Sequence.DisplayTitle));
|
throw new SequenceInLibraryException(id, record.Sequence.DisplayTitle);
|
||||||
|
|
||||||
var locations = (await _db.Sequences.ListLocationsAsync(archive.Id, cancellationToken).ConfigureAwait(false)).Select(l => l.Folder)
|
var locations = (await _db.Sequences.ListLocationsAsync(archive.Id, cancellationToken).ConfigureAwait(false)).Select(l => l.Folder)
|
||||||
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
.ToHashSet(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ public static class ProcessingJobs
|
|||||||
ArgumentNullException.ThrowIfNull(sequence);
|
ArgumentNullException.ThrowIfNull(sequence);
|
||||||
ArgumentNullException.ThrowIfNull(export);
|
ArgumentNullException.ThrowIfNull(export);
|
||||||
var parameters = Parameters(export, sourceWidth, sourceHeight, project?.ToJson(), useProxies);
|
var parameters = Parameters(export, sourceWidth, sourceHeight, project?.ToJson(), useProxies);
|
||||||
return new ArchiveJobRequest(JobKind.Render, [sequence.Id], $"{sequence.DisplayTitle} → {parameters.PresetName}",
|
// The label is stored as written, in the language of the moment like the preset name: its arrow points from the
|
||||||
|
// sequence to the preset in that language's reading direction.
|
||||||
|
var label = Loc.L(Loc.IsRightToLeft ? "Jobs.Target.RenderRtl" : "Jobs.Target.Render", sequence.DisplayTitle, parameters.PresetName);
|
||||||
|
return new ArchiveJobRequest(JobKind.Render, [sequence.Id], label,
|
||||||
JsonSerializer.Serialize(parameters, ProtocolJson.Default.RenderJobParameters), JobPriority.User);
|
JsonSerializer.Serialize(parameters, ProtocolJson.Default.RenderJobParameters), JobPriority.User);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,7 @@
|
|||||||
<DockPanel>
|
<DockPanel>
|
||||||
<ComboBox DockPanel.Dock="Right" MinWidth="180" VerticalAlignment="Center" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}"
|
<ComboBox DockPanel.Dock="Right" MinWidth="180" VerticalAlignment="Center" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}"
|
||||||
DisplayMemberPath="Name" IsEnabled="{Binding IsOptions}" ToolTip="{l:Loc Tooltips.Setup.Language}" AutomationProperties.Name="{l:Loc Setup.Field.Language}" />
|
DisplayMemberPath="Name" IsEnabled="{Binding IsOptions}" ToolTip="{l:Loc Tooltips.Setup.Language}" AutomationProperties.Name="{l:Loc Setup.Field.Language}" />
|
||||||
<!-- The mark is artwork: its off-centre sun must not flip in right-to-left languages. -->
|
<ui:BrandMarkIcon ShowPlate="True" Width="40" Height="40" Margin="0,0,14,0" VerticalAlignment="Center" />
|
||||||
<ui:BrandMarkIcon ShowPlate="True" Width="40" Height="40" Margin="0,0,14,0" VerticalAlignment="Center" FlowDirection="LeftToRight" />
|
|
||||||
<StackPanel VerticalAlignment="Center">
|
<StackPanel VerticalAlignment="Center">
|
||||||
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.PageTitle}" />
|
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.PageTitle}" />
|
||||||
<TextBlock Text="{Binding SubHeading}" Style="{StaticResource Text.Secondary}" />
|
<TextBlock Text="{Binding SubHeading}" Style="{StaticResource Text.Secondary}" />
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ internal sealed partial class SetupWindow : TitanoWindow
|
|||||||
_shownStage = model.Stage;
|
_shownStage = model.Stage;
|
||||||
DataContext = model;
|
DataContext = model;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ApplyFlowDirection();
|
|
||||||
Loc.CultureChanged += OnCultureChanged;
|
|
||||||
// Ahead of the chrome's own Close binding, which is always enabled.
|
// Ahead of the chrome's own Close binding, which is always enabled.
|
||||||
CommandBindings.Insert(0, new CommandBinding(SystemCommands.CloseWindowCommand, null, OnCanClose));
|
CommandBindings.Insert(0, new CommandBinding(SystemCommands.CloseWindowCommand, null, OnCanClose));
|
||||||
model.PickFolder = initial => FolderPicker.Pick(new WindowInteropHelper(this).Handle, Loc.L("Setup.Field.Folder"), initial);
|
model.PickFolder = initial => FolderPicker.Pick(new WindowInteropHelper(this).Handle, Loc.L("Setup.Field.Folder"), initial);
|
||||||
@@ -46,12 +44,6 @@ internal sealed partial class SetupWindow : TitanoWindow
|
|||||||
base.OnClosing(e);
|
base.OnClosing(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnClosed(EventArgs e)
|
|
||||||
{
|
|
||||||
Loc.CultureChanged -= OnCultureChanged;
|
|
||||||
base.OnClosed(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCanClose(object sender, CanExecuteRoutedEventArgs e)
|
private void OnCanClose(object sender, CanExecuteRoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!_model.IsWorking) return;
|
if (!_model.IsWorking) return;
|
||||||
@@ -97,8 +89,4 @@ internal sealed partial class SetupWindow : TitanoWindow
|
|||||||
var buttons = Footer.Children.OfType<Button>().Where(b => b.IsVisible).ToList();
|
var buttons = Footer.Children.OfType<Button>().Where(b => b.IsVisible).ToList();
|
||||||
(buttons.FirstOrDefault(b => b.IsDefault) ?? buttons.FirstOrDefault())?.Focus();
|
(buttons.FirstOrDefault(b => b.IsDefault) ?? buttons.FirstOrDefault())?.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCultureChanged(object? sender, EventArgs e) => ApplyFlowDirection();
|
|
||||||
|
|
||||||
private void ApplyFlowDirection() => FlowDirection = Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,17 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using Titano.Core.Localization;
|
||||||
|
|
||||||
namespace Titano.Ui.Controls;
|
namespace Titano.Ui.Controls;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Advisor-aware slider (BRIEF §10.4, DESIGN §4): in Auto the track is accent with an "Auto · value" pill whose
|
/// Advisor-aware slider (BRIEF §10.4, DESIGN §4): in Auto the track is accent with an "Auto · value" pill whose
|
||||||
/// tooltip carries the advisor's reason; touching the slider switches to manual (sun track, value shown, reset
|
/// tooltip carries the advisor's reason; touching the slider switches to manual (sun track, value shown, reset
|
||||||
/// button returns to Auto). When not applicable the value reads "n/a" with the reason in the tooltip.
|
/// button returns to Auto). When not applicable the value reads "n/a" with the reason in the tooltip. Screen readers
|
||||||
|
/// see a group named after <see cref="Header"/> holding the named slider, the Auto pill and the reset button.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TemplatePart(Name = PartSlider, Type = typeof(Slider))]
|
[TemplatePart(Name = PartSlider, Type = typeof(Slider))]
|
||||||
public class AutoSlider : Control
|
public class AutoSlider : Control
|
||||||
@@ -47,6 +50,14 @@ public class AutoSlider : Control
|
|||||||
public AutoSlider()
|
public AutoSlider()
|
||||||
{
|
{
|
||||||
CommandBindings.Add(new CommandBinding(ResetCommand, (_, _) => ResetToAuto()));
|
CommandBindings.Add(new CommandBinding(ResetCommand, (_, _) => ResetToAuto()));
|
||||||
|
// The pill and the value follow a language switch; the static event is held only while the slider is shown.
|
||||||
|
Loaded += (_, _) =>
|
||||||
|
{
|
||||||
|
Loc.CultureChanged -= OnCultureChanged;
|
||||||
|
Loc.CultureChanged += OnCultureChanged;
|
||||||
|
UpdateTexts();
|
||||||
|
};
|
||||||
|
Unloaded += (_, _) => Loc.CultureChanged -= OnCultureChanged;
|
||||||
UpdateTexts();
|
UpdateTexts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +78,7 @@ public class AutoSlider : Control
|
|||||||
/// <summary>Formatted current value (read by the template).</summary>
|
/// <summary>Formatted current value (read by the template).</summary>
|
||||||
public string DisplayValue { get => (string)GetValue(DisplayValueProperty); private set => SetValue(DisplayValueProperty, value); }
|
public string DisplayValue { get => (string)GetValue(DisplayValueProperty); private set => SetValue(DisplayValueProperty, value); }
|
||||||
|
|
||||||
/// <summary>"Auto · 41" pill text; the "Auto" word comes from the catalog (Common.Auto).</summary>
|
/// <summary>"Auto · 41" pill text (Common.AutoValue).</summary>
|
||||||
public string AutoText { get => (string)GetValue(AutoTextProperty); private set => SetValue(AutoTextProperty, value); }
|
public string AutoText { get => (string)GetValue(AutoTextProperty); private set => SetValue(AutoTextProperty, value); }
|
||||||
|
|
||||||
/// <summary>Tooltip of the slider track: what moving it does.</summary>
|
/// <summary>Tooltip of the slider track: what moving it does.</summary>
|
||||||
@@ -131,12 +142,30 @@ public class AutoSlider : Control
|
|||||||
s.UpdateTexts();
|
s.UpdateTexts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override AutomationPeer OnCreateAutomationPeer() => new AutoSliderAutomationPeer(this);
|
||||||
|
|
||||||
private static void OnFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((AutoSlider)d).UpdateTexts();
|
private static void OnFormatChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((AutoSlider)d).UpdateTexts();
|
||||||
|
|
||||||
|
private void OnCultureChanged(object? sender, EventArgs e) => UpdateTexts();
|
||||||
|
|
||||||
private void UpdateTexts()
|
private void UpdateTexts()
|
||||||
{
|
{
|
||||||
var culture = Core.Localization.Loc.Culture;
|
var culture = Loc.Culture;
|
||||||
DisplayValue = Value.ToString(ValueFormat, culture);
|
DisplayValue = Value.ToString(ValueFormat, culture);
|
||||||
AutoText = Core.Localization.Loc.L("Common.Auto") + " · " + AutoValue.ToString(ValueFormat, culture);
|
AutoText = Loc.L("Common.AutoValue", AutoValue.ToString(ValueFormat, culture));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>A named group around the slider, the Auto pill and the reset button.</summary>
|
||||||
|
public sealed class AutoSliderAutomationPeer(AutoSlider owner) : FrameworkElementAutomationPeer(owner)
|
||||||
|
{
|
||||||
|
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Group;
|
||||||
|
|
||||||
|
protected override string GetClassNameCore() => nameof(AutoSlider);
|
||||||
|
|
||||||
|
protected override string GetNameCore()
|
||||||
|
{
|
||||||
|
var name = base.GetNameCore();
|
||||||
|
return string.IsNullOrEmpty(name) ? ((AutoSlider)Owner).Header ?? string.Empty : name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Titano.Ui.Controls;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Right-to-left rules of the kit (BRIEF §16, DESIGN §5). Windows take their direction from the UI language, so
|
||||||
|
/// layout mirrors by itself; an <see cref="Icon"/> mirrors with it only when its glyph is directional
|
||||||
|
/// (<see cref="IconData.IsDirectional"/>). <see cref="IsDirectionalProperty"/> overrides that per subtree, e.g. a
|
||||||
|
/// play triangle used as a "next" arrow (true) or a chevron that points along a left-to-right time axis (false).
|
||||||
|
/// Media, charts, numbers, paths and templates are left-to-right islands: set <c>FlowDirection="LeftToRight"</c>
|
||||||
|
/// on the smallest element that holds them, and a directional icon inside an island keeps its drawn orientation.
|
||||||
|
/// </summary>
|
||||||
|
public static class Bidi
|
||||||
|
{
|
||||||
|
/// <summary>Inherited override of <see cref="IconData.IsDirectional"/>; null keeps each glyph's own flag.</summary>
|
||||||
|
public static readonly DependencyProperty IsDirectionalProperty = DependencyProperty.RegisterAttached(
|
||||||
|
"IsDirectional", typeof(bool?), typeof(Bidi), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits, OnIsDirectionalChanged));
|
||||||
|
|
||||||
|
public static bool? GetIsDirectional(DependencyObject d) => (bool?)d.GetValue(IsDirectionalProperty);
|
||||||
|
|
||||||
|
public static void SetIsDirectional(DependencyObject d, bool? value) => d.SetValue(IsDirectionalProperty, value);
|
||||||
|
|
||||||
|
/// <summary>The flow direction of the current UI language.</summary>
|
||||||
|
public static FlowDirection UiDirection => Core.Localization.Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
|
||||||
|
|
||||||
|
private static void OnIsDirectionalChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (d is Icon icon) icon.UpdateDirection();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ using Titano.Core.Branding;
|
|||||||
|
|
||||||
namespace Titano.Ui.Controls;
|
namespace Titano.Ui.Controls;
|
||||||
|
|
||||||
/// <summary>The Titano mark drawn as vectors from <see cref="BrandMark"/> geometry (plate optional).</summary>
|
/// <summary>The Titano mark drawn as vectors from <see cref="BrandMark"/> geometry (plate optional); it never mirrors.</summary>
|
||||||
public sealed class BrandMarkIcon : FrameworkElement
|
public sealed class BrandMarkIcon : FrameworkElement
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty ShowPlateProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty ShowPlateProperty = DependencyProperty.Register(
|
||||||
@@ -14,6 +14,9 @@ public sealed class BrandMarkIcon : FrameworkElement
|
|||||||
private static readonly Brush Sun = Frozen(new SolidColorBrush(Color.FromRgb(BrandMark.Sun.R, BrandMark.Sun.G, BrandMark.Sun.B)));
|
private static readonly Brush Sun = Frozen(new SolidColorBrush(Color.FromRgb(BrandMark.Sun.R, BrandMark.Sun.G, BrandMark.Sun.B)));
|
||||||
private static readonly Brush Plate = Frozen(new SolidColorBrush(Color.FromRgb(BrandMark.Plate.R, BrandMark.Plate.G, BrandMark.Plate.B)));
|
private static readonly Brush Plate = Frozen(new SolidColorBrush(Color.FromRgb(BrandMark.Plate.R, BrandMark.Plate.G, BrandMark.Plate.B)));
|
||||||
|
|
||||||
|
// A logo keeps its orientation in right-to-left layouts: the sun stays north-east, the ticks clockwise.
|
||||||
|
public BrandMarkIcon() => FlowDirection = FlowDirection.LeftToRight;
|
||||||
|
|
||||||
public bool ShowPlate
|
public bool ShowPlate
|
||||||
{
|
{
|
||||||
get => (bool)GetValue(ShowPlateProperty);
|
get => (bool)GetValue(ShowPlateProperty);
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ using System.Windows;
|
|||||||
|
|
||||||
namespace Titano.Ui.Controls;
|
namespace Titano.Ui.Controls;
|
||||||
|
|
||||||
/// <summary>Attached field helpers: placeholder text and an inline leading icon for text inputs.</summary>
|
/// <summary>
|
||||||
|
/// Attached field helpers: placeholder text and an inline leading icon for text inputs, and the error of an input that
|
||||||
|
/// has no validating binding (a password box): the error border, with the message as help text for screen readers.
|
||||||
|
/// </summary>
|
||||||
public static class Field
|
public static class Field
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty PlaceholderProperty = DependencyProperty.RegisterAttached(
|
public static readonly DependencyProperty PlaceholderProperty = DependencyProperty.RegisterAttached(
|
||||||
@@ -11,6 +14,16 @@ public static class Field
|
|||||||
public static readonly DependencyProperty GlyphProperty = DependencyProperty.RegisterAttached(
|
public static readonly DependencyProperty GlyphProperty = DependencyProperty.RegisterAttached(
|
||||||
"Glyph", typeof(IconData), typeof(Field), new FrameworkPropertyMetadata(null));
|
"Glyph", typeof(IconData), typeof(Field), new FrameworkPropertyMetadata(null));
|
||||||
|
|
||||||
|
/// <summary>One sentence saying what is wrong with the value; null when it is fine.</summary>
|
||||||
|
public static readonly DependencyProperty ErrorProperty = DependencyProperty.RegisterAttached(
|
||||||
|
"Error", typeof(string), typeof(Field), new FrameworkPropertyMetadata(null, OnErrorChanged));
|
||||||
|
|
||||||
|
private static readonly DependencyPropertyKey HasErrorKey = DependencyProperty.RegisterAttachedReadOnly(
|
||||||
|
"HasError", typeof(bool), typeof(Field), new FrameworkPropertyMetadata(false));
|
||||||
|
|
||||||
|
/// <summary>True while <see cref="ErrorProperty"/> holds a message; the input templates trigger on it.</summary>
|
||||||
|
public static readonly DependencyProperty HasErrorProperty = HasErrorKey.DependencyProperty;
|
||||||
|
|
||||||
public static string? GetPlaceholder(DependencyObject d) => (string?)d.GetValue(PlaceholderProperty);
|
public static string? GetPlaceholder(DependencyObject d) => (string?)d.GetValue(PlaceholderProperty);
|
||||||
|
|
||||||
public static void SetPlaceholder(DependencyObject d, string? value) => d.SetValue(PlaceholderProperty, value);
|
public static void SetPlaceholder(DependencyObject d, string? value) => d.SetValue(PlaceholderProperty, value);
|
||||||
@@ -18,6 +31,15 @@ public static class Field
|
|||||||
public static IconData? GetGlyph(DependencyObject d) => (IconData?)d.GetValue(GlyphProperty);
|
public static IconData? GetGlyph(DependencyObject d) => (IconData?)d.GetValue(GlyphProperty);
|
||||||
|
|
||||||
public static void SetGlyph(DependencyObject d, IconData? value) => d.SetValue(GlyphProperty, value);
|
public static void SetGlyph(DependencyObject d, IconData? value) => d.SetValue(GlyphProperty, value);
|
||||||
|
|
||||||
|
public static string? GetError(DependencyObject d) => (string?)d.GetValue(ErrorProperty);
|
||||||
|
|
||||||
|
public static void SetError(DependencyObject d, string? value) => d.SetValue(ErrorProperty, value);
|
||||||
|
|
||||||
|
public static bool GetHasError(DependencyObject d) => (bool)d.GetValue(HasErrorProperty);
|
||||||
|
|
||||||
|
private static void OnErrorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) =>
|
||||||
|
d.SetValue(HasErrorKey, !string.IsNullOrEmpty((string?)e.NewValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Attached glyph for buttons: renders an <see cref="IconData"/> before (or instead of) the content.</summary>
|
/// <summary>Attached glyph for buttons: renders an <see cref="IconData"/> before (or instead of) the content.</summary>
|
||||||
|
|||||||
@@ -4,12 +4,16 @@ using System.Windows.Media;
|
|||||||
|
|
||||||
namespace Titano.Ui.Controls;
|
namespace Titano.Ui.Controls;
|
||||||
|
|
||||||
/// <summary>Renders an <see cref="IconData"/> on the 16-unit grid, scaled to the element size, in the inherited foreground.</summary>
|
/// <summary>
|
||||||
|
/// Renders an <see cref="IconData"/> on the 16-unit grid, scaled to the element size, in the inherited foreground,
|
||||||
|
/// centred in its slot. Only directional glyphs follow a right-to-left layout (<see cref="Bidi"/>); the others keep
|
||||||
|
/// their drawn orientation.
|
||||||
|
/// </summary>
|
||||||
public sealed class Icon : FrameworkElement
|
public sealed class Icon : FrameworkElement
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty GlyphProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty GlyphProperty = DependencyProperty.Register(
|
||||||
nameof(Glyph), typeof(IconData), typeof(Icon),
|
nameof(Glyph), typeof(IconData), typeof(Icon),
|
||||||
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
|
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender, (d, _) => ((Icon)d).UpdateDirection()));
|
||||||
|
|
||||||
public static readonly DependencyProperty ForegroundProperty = TextElement.ForegroundProperty.AddOwner(
|
public static readonly DependencyProperty ForegroundProperty = TextElement.ForegroundProperty.AddOwner(
|
||||||
typeof(Icon), new FrameworkPropertyMetadata(Brushes.Gray, FrameworkPropertyMetadataOptions.Inherits | FrameworkPropertyMetadataOptions.AffectsRender));
|
typeof(Icon), new FrameworkPropertyMetadata(Brushes.Gray, FrameworkPropertyMetadataOptions.Inherits | FrameworkPropertyMetadataOptions.AffectsRender));
|
||||||
@@ -26,8 +30,13 @@ public sealed class Icon : FrameworkElement
|
|||||||
{
|
{
|
||||||
SnapsToDevicePixelsProperty.OverrideMetadata(typeof(Icon), new FrameworkPropertyMetadata(true));
|
SnapsToDevicePixelsProperty.OverrideMetadata(typeof(Icon), new FrameworkPropertyMetadata(true));
|
||||||
FocusableProperty.OverrideMetadata(typeof(Icon), new FrameworkPropertyMetadata(false));
|
FocusableProperty.OverrideMetadata(typeof(Icon), new FrameworkPropertyMetadata(false));
|
||||||
|
// The glyph is drawn from the top-left of the element: a stretched slot would pull it off centre.
|
||||||
|
HorizontalAlignmentProperty.OverrideMetadata(typeof(Icon), new FrameworkPropertyMetadata(HorizontalAlignment.Center));
|
||||||
|
VerticalAlignmentProperty.OverrideMetadata(typeof(Icon), new FrameworkPropertyMetadata(VerticalAlignment.Center));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Icon() => UpdateDirection();
|
||||||
|
|
||||||
public IconData? Glyph
|
public IconData? Glyph
|
||||||
{
|
{
|
||||||
get => (IconData?)GetValue(GlyphProperty);
|
get => (IconData?)GetValue(GlyphProperty);
|
||||||
@@ -56,6 +65,13 @@ public sealed class Icon : FrameworkElement
|
|||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize) => new(Size, Size);
|
protected override Size MeasureOverride(Size availableSize) => new(Size, Size);
|
||||||
|
|
||||||
|
/// <summary>A directional glyph inherits the layout direction (and mirrors with it); any other glyph is pinned left-to-right.</summary>
|
||||||
|
internal void UpdateDirection()
|
||||||
|
{
|
||||||
|
if (Bidi.GetIsDirectional(this) ?? Glyph?.IsDirectional ?? false) ClearValue(FlowDirectionProperty);
|
||||||
|
else SetValue(FlowDirectionProperty, FlowDirection.LeftToRight);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnRender(DrawingContext dc)
|
protected override void OnRender(DrawingContext dc)
|
||||||
{
|
{
|
||||||
var glyph = Glyph;
|
var glyph = Glyph;
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ public sealed class IconData
|
|||||||
set => _fill = Freeze(value);
|
set => _fill = Freeze(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The glyph points along the reading direction (back/forward arrows, chevrons, start-aligned lines), so it
|
||||||
|
/// mirrors in right-to-left layouts (DESIGN §5); every other glyph keeps its drawn orientation.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDirectional { get; set; }
|
||||||
|
|
||||||
private static Geometry? Freeze(Geometry? g)
|
private static Geometry? Freeze(Geometry? g)
|
||||||
{
|
{
|
||||||
if (g is { CanFreeze: true, IsFrozen: false }) g.Freeze();
|
if (g is { CanFreeze: true, IsFrozen: false }) g.Freeze();
|
||||||
|
|||||||
@@ -1,10 +1,15 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace Titano.Ui.Controls;
|
namespace Titano.Ui.Controls;
|
||||||
|
|
||||||
/// <summary>40-px strip under the title bar: current job, progress, time left and a stop (or pause) button (DESIGN §4).</summary>
|
/// <summary>
|
||||||
|
/// 40-px strip under the title bar: current job, progress, time left and a stop (or pause) button (DESIGN §4). Screen
|
||||||
|
/// readers see a status bar; its name is <c>AutomationProperties.Name</c> (the owner keeps it to the job's state, so
|
||||||
|
/// it can be a live region that does not speak every progress tick), else <see cref="Text"/>.
|
||||||
|
/// </summary>
|
||||||
public class JobBar : Control
|
public class JobBar : Control
|
||||||
{
|
{
|
||||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(JobBar));
|
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(nameof(Text), typeof(string), typeof(JobBar));
|
||||||
@@ -13,6 +18,7 @@ public class JobBar : Control
|
|||||||
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register(nameof(IsActive), typeof(bool), typeof(JobBar));
|
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.Register(nameof(IsActive), typeof(bool), typeof(JobBar));
|
||||||
public static readonly DependencyProperty StopCommandProperty = DependencyProperty.Register(nameof(StopCommand), typeof(ICommand), typeof(JobBar));
|
public static readonly DependencyProperty StopCommandProperty = DependencyProperty.Register(nameof(StopCommand), typeof(ICommand), typeof(JobBar));
|
||||||
public static readonly DependencyProperty StopToolTipProperty = DependencyProperty.Register(nameof(StopToolTip), typeof(object), typeof(JobBar));
|
public static readonly DependencyProperty StopToolTipProperty = DependencyProperty.Register(nameof(StopToolTip), typeof(object), typeof(JobBar));
|
||||||
|
public static readonly DependencyProperty StopNameProperty = DependencyProperty.Register(nameof(StopName), typeof(string), typeof(JobBar));
|
||||||
public static readonly DependencyProperty ActionGlyphProperty = DependencyProperty.Register(nameof(ActionGlyph), typeof(IconData), typeof(JobBar));
|
public static readonly DependencyProperty ActionGlyphProperty = DependencyProperty.Register(nameof(ActionGlyph), typeof(IconData), typeof(JobBar));
|
||||||
|
|
||||||
static JobBar()
|
static JobBar()
|
||||||
@@ -33,6 +39,25 @@ public class JobBar : Control
|
|||||||
public ICommand? StopCommand { get => (ICommand?)GetValue(StopCommandProperty); set => SetValue(StopCommandProperty, value); }
|
public ICommand? StopCommand { get => (ICommand?)GetValue(StopCommandProperty); set => SetValue(StopCommandProperty, value); }
|
||||||
public object? StopToolTip { get => GetValue(StopToolTipProperty); set => SetValue(StopToolTipProperty, value); }
|
public object? StopToolTip { get => GetValue(StopToolTipProperty); set => SetValue(StopToolTipProperty, value); }
|
||||||
|
|
||||||
|
/// <summary>Short accessible name of the stop (or pause) button; the tooltip sentence becomes its help text.</summary>
|
||||||
|
public string? StopName { get => (string?)GetValue(StopNameProperty); set => SetValue(StopNameProperty, value); }
|
||||||
|
|
||||||
/// <summary>Glyph of the action button: stop by default; the client shows pause (DESIGN §4 job bar).</summary>
|
/// <summary>Glyph of the action button: stop by default; the client shows pause (DESIGN §4 job bar).</summary>
|
||||||
public IconData? ActionGlyph { get => (IconData?)GetValue(ActionGlyphProperty); set => SetValue(ActionGlyphProperty, value); }
|
public IconData? ActionGlyph { get => (IconData?)GetValue(ActionGlyphProperty); set => SetValue(ActionGlyphProperty, value); }
|
||||||
|
|
||||||
|
protected override AutomationPeer OnCreateAutomationPeer() => new JobBarAutomationPeer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The job bar seen by UI Automation: a status bar holding the progress bar and the pause button.</summary>
|
||||||
|
public sealed class JobBarAutomationPeer(JobBar owner) : FrameworkElementAutomationPeer(owner)
|
||||||
|
{
|
||||||
|
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.StatusBar;
|
||||||
|
|
||||||
|
protected override string GetClassNameCore() => nameof(JobBar);
|
||||||
|
|
||||||
|
protected override string GetNameCore()
|
||||||
|
{
|
||||||
|
var name = base.GetNameCore();
|
||||||
|
return string.IsNullOrEmpty(name) ? ((JobBar)Owner).Text ?? string.Empty : name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Shell;
|
using System.Windows.Shell;
|
||||||
|
using Titano.Core.Localization;
|
||||||
using Titano.Ui.Interop;
|
using Titano.Ui.Interop;
|
||||||
using Titano.Ui.Theming;
|
using Titano.Ui.Theming;
|
||||||
|
|
||||||
@@ -12,7 +13,8 @@ namespace Titano.Ui.Controls;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Window with Titano's custom chrome: 34-px title bar in the Chrome colour, brand mark, title, optional
|
/// Window with Titano's custom chrome: 34-px title bar in the Chrome colour, brand mark, title, optional
|
||||||
/// title-bar content and drawn caption buttons. The maximise button answers HTMAXBUTTON so Windows 11
|
/// title-bar content and drawn caption buttons. The maximise button answers HTMAXBUTTON so Windows 11
|
||||||
/// snap layouts appear on hover.
|
/// snap layouts appear on hover. The window lays out in the direction of the UI language from its creation on and
|
||||||
|
/// follows every language switch while it is shown (BRIEF §16).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TemplatePart(Name = PartMaximize, Type = typeof(Button))]
|
[TemplatePart(Name = PartMaximize, Type = typeof(Button))]
|
||||||
public class TitanoWindow : Window
|
public class TitanoWindow : Window
|
||||||
@@ -54,6 +56,7 @@ public class TitanoWindow : Window
|
|||||||
CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (_, _) => ToggleMaximize()));
|
CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (_, _) => ToggleMaximize()));
|
||||||
UseLayoutRounding = true;
|
UseLayoutRounding = true;
|
||||||
TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
|
TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
|
||||||
|
FlowDirection = Bidi.UiDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Extra content placed in the title bar between the title and the caption buttons.</summary>
|
/// <summary>Extra content placed in the title bar between the title and the caption buttons.</summary>
|
||||||
@@ -88,8 +91,18 @@ public class TitanoWindow : Window
|
|||||||
base.OnSourceInitialized(e);
|
base.OnSourceInitialized(e);
|
||||||
ThemeManager.ApplyChrome(this);
|
ThemeManager.ApplyChrome(this);
|
||||||
if (PresentationSource.FromVisual(this) is HwndSource source) source.AddHook(WndProc);
|
if (PresentationSource.FromVisual(this) is HwndSource source) source.AddHook(WndProc);
|
||||||
|
// Subscribed only while shown: the static event must not keep a closed (or never shown) window alive.
|
||||||
|
Loc.CultureChanged += OnCultureChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnClosed(EventArgs e)
|
||||||
|
{
|
||||||
|
Loc.CultureChanged -= OnCultureChanged;
|
||||||
|
base.OnClosed(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCultureChanged(object? sender, EventArgs e) => Dispatcher.Invoke(() => FlowDirection = Bidi.UiDirection);
|
||||||
|
|
||||||
private void ToggleMaximize()
|
private void ToggleMaximize()
|
||||||
{
|
{
|
||||||
if (WindowState == WindowState.Maximized) SystemCommands.RestoreWindow(this);
|
if (WindowState == WindowState.Maximized) SystemCommands.RestoreWindow(this);
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using Titano.Ui.Mvvm;
|
using Titano.Ui.Mvvm;
|
||||||
@@ -16,12 +19,21 @@ public sealed class Toast : ObservableObject
|
|||||||
public ICommand? ActionCommand { get; init; }
|
public ICommand? ActionCommand { get; init; }
|
||||||
public string? ActionToolTip { get; init; }
|
public string? ActionToolTip { get; init; }
|
||||||
public TimeSpan Lifetime { get; init; } = TimeSpan.FromSeconds(8);
|
public TimeSpan Lifetime { get; init; } = TimeSpan.FromSeconds(8);
|
||||||
|
|
||||||
|
/// <summary>Something failed: screen readers say it at once, ahead of other notices (assertive, not polite).</summary>
|
||||||
|
public bool IsError { get; init; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Bottom-right stack of <see cref="Toast"/>s with auto-dismiss.</summary>
|
/// <summary>
|
||||||
|
/// Bottom-right stack of <see cref="Toast"/>s with auto-dismiss. Screen readers hear each toast as it appears; the
|
||||||
|
/// timers pause while the pointer or the keyboard focus is on a toast; <see cref="FocusNewest"/> brings the keyboard
|
||||||
|
/// to the newest one, Esc dismisses the focused one and focus then returns where it came from; running a toast's
|
||||||
|
/// action closes it.
|
||||||
|
/// </summary>
|
||||||
public class ToastHost : ItemsControl
|
public class ToastHost : ItemsControl
|
||||||
{
|
{
|
||||||
private readonly Dictionary<Toast, DispatcherTimer> _timers = [];
|
private readonly Dictionary<Toast, DispatcherTimer> _timers = [];
|
||||||
|
private IInputElement? _returnFocus;
|
||||||
|
|
||||||
static ToastHost()
|
static ToastHost()
|
||||||
{
|
{
|
||||||
@@ -35,12 +47,15 @@ public class ToastHost : ItemsControl
|
|||||||
{
|
{
|
||||||
if (e.Parameter is Toast t) Dismiss(t);
|
if (e.Parameter is Toast t) Dismiss(t);
|
||||||
}));
|
}));
|
||||||
|
AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(OnButtonClick));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RoutedCommand DismissCommand { get; } = new(nameof(DismissCommand), typeof(ToastHost));
|
public static RoutedCommand DismissCommand { get; } = new(nameof(DismissCommand), typeof(ToastHost));
|
||||||
|
|
||||||
public ObservableCollection<Toast> Toasts { get; } = [];
|
public ObservableCollection<Toast> Toasts { get; } = [];
|
||||||
|
|
||||||
|
private bool IsHeld => IsMouseOver || IsKeyboardFocusWithin;
|
||||||
|
|
||||||
public void Show(Toast toast)
|
public void Show(Toast toast)
|
||||||
{
|
{
|
||||||
Toasts.Add(toast);
|
Toasts.Add(toast);
|
||||||
@@ -48,32 +63,86 @@ public class ToastHost : ItemsControl
|
|||||||
var timer = new DispatcherTimer { Interval = toast.Lifetime };
|
var timer = new DispatcherTimer { Interval = toast.Lifetime };
|
||||||
timer.Tick += (_, _) => Dismiss(toast);
|
timer.Tick += (_, _) => Dismiss(toast);
|
||||||
_timers[toast] = timer;
|
_timers[toast] = timer;
|
||||||
timer.Start();
|
timer.IsEnabled = !IsHeld;
|
||||||
}
|
Announce(toast);
|
||||||
|
|
||||||
/// <summary>Pauses or resumes the dismissal timer (hover pauses).</summary>
|
|
||||||
public void SetPaused(Toast toast, bool paused)
|
|
||||||
{
|
|
||||||
if (!_timers.TryGetValue(toast, out var timer)) return;
|
|
||||||
if (paused) timer.Stop();
|
|
||||||
else timer.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dismiss(Toast toast)
|
public void Dismiss(Toast toast)
|
||||||
{
|
{
|
||||||
if (_timers.Remove(toast, out var timer)) timer.Stop();
|
if (_timers.Remove(toast, out var timer)) timer.Stop();
|
||||||
|
var hadFocus = IsKeyboardFocusWithin;
|
||||||
Toasts.Remove(toast);
|
Toasts.Remove(toast);
|
||||||
|
if (hadFocus && !IsKeyboardFocusWithin && _returnFocus is UIElement { IsVisible: true } previous) previous.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPreviewMouseMove(MouseEventArgs e)
|
/// <summary>Moves the keyboard to the newest toast's first control; false when no toast is shown.</summary>
|
||||||
|
public bool FocusNewest()
|
||||||
{
|
{
|
||||||
base.OnPreviewMouseMove(e);
|
if (Toasts.Count == 0) return false;
|
||||||
foreach (var t in Toasts.ToList()) SetPaused(t, true);
|
UpdateLayout();
|
||||||
|
return ItemContainerGenerator.ContainerFromIndex(Toasts.Count - 1) is UIElement container
|
||||||
|
&& container.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnPreviewGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnPreviewGotKeyboardFocus(e);
|
||||||
|
if (e.OldFocus is not DependencyObject old || !IsAncestorOf(old)) _returnFocus = e.OldFocus;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnIsKeyboardFocusWithinChanged(e);
|
||||||
|
UpdateTimers();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnMouseEnter(MouseEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnMouseEnter(e);
|
||||||
|
UpdateTimers();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseLeave(MouseEventArgs e)
|
protected override void OnMouseLeave(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnMouseLeave(e);
|
base.OnMouseLeave(e);
|
||||||
foreach (var t in Toasts.ToList()) SetPaused(t, false);
|
UpdateTimers();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnKeyDown(KeyEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnKeyDown(e);
|
||||||
|
if (e.Handled || e.Key != Key.Escape || (e.OriginalSource as FrameworkElement)?.DataContext is not Toast toast) return;
|
||||||
|
Dismiss(toast);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Hovering or focusing any toast holds them all; leaving restarts their full lifetime.</summary>
|
||||||
|
private void UpdateTimers()
|
||||||
|
{
|
||||||
|
var held = IsHeld;
|
||||||
|
foreach (var timer in _timers.Values)
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
if (!held) timer.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The action executes right after its Click event; the toast closes once it has run.</summary>
|
||||||
|
private void OnButtonClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.OriginalSource is ButtonBase { DataContext: Toast toast, Command: { } command } && ReferenceEquals(command, toast.ActionCommand))
|
||||||
|
Dispatcher.BeginInvoke(() => Dismiss(toast));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A UI Automation notification rather than a live region: a toast is a new element, not a text that changes, and
|
||||||
|
/// the host's peer is always in the tree. Notices queue (polite); errors interrupt (assertive).
|
||||||
|
/// </summary>
|
||||||
|
private void Announce(Toast toast)
|
||||||
|
{
|
||||||
|
var text = string.IsNullOrEmpty(toast.Message) ? toast.Title : toast.Title + " " + toast.Message;
|
||||||
|
UIElementAutomationPeer.CreatePeerForElement(this)?.RaiseNotificationEvent(
|
||||||
|
AutomationNotificationKind.Other, toast.IsError ? AutomationNotificationProcessing.ImportantAll : AutomationNotificationProcessing.All,
|
||||||
|
text, "Titano.Toast");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<ui:IconData x:Key="Icon.ActualSize" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M5 6 L6 5.5 V10.5 M9.5 6 L10.5 5.5 V10.5 M8 7 V7.1 M8 9.5 V9.6" />
|
<ui:IconData x:Key="Icon.ActualSize" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M5 6 L6 5.5 V10.5 M9.5 6 L10.5 5.5 V10.5 M8 7 V7.1 M8 9.5 V9.6" />
|
||||||
<ui:IconData x:Key="Icon.Analyse" Stroke="M1.5 8.5 H4.5 L6.5 3.5 L9.5 12.5 L11.5 8.5 H14.5" />
|
<ui:IconData x:Key="Icon.Analyse" Stroke="M1.5 8.5 H4.5 L6.5 3.5 L9.5 12.5 L11.5 8.5 H14.5" />
|
||||||
<ui:IconData x:Key="Icon.Archive" Stroke="M2 4.5 H14 V13.5 H2 Z M2 2 H14 V4.5 H2 Z M6 8 H10" />
|
<ui:IconData x:Key="Icon.Archive" Stroke="M2 4.5 H14 V13.5 H2 Z M2 2 H14 V4.5 H2 Z M6 8 H10" />
|
||||||
<ui:IconData x:Key="Icon.Back" Stroke="M13 8 H3 M7 4 L3 8 L7 12" />
|
<ui:IconData x:Key="Icon.Back" Stroke="M13 8 H3 M7 4 L3 8 L7 12" IsDirectional="True" />
|
||||||
<ui:IconData x:Key="Icon.Calendar" Stroke="M3.0 3 H13.0 A1.5 1.5 0 0 1 14.5 4.5 V13.0 A1.5 1.5 0 0 1 13.0 14.5 H3.0 A1.5 1.5 0 0 1 1.5 13.0 V4.5 A1.5 1.5 0 0 1 3.0 3 Z M1.5 6.5 H14.5 M5 1.5 V4 M11 1.5 V4" />
|
<ui:IconData x:Key="Icon.Calendar" Stroke="M3.0 3 H13.0 A1.5 1.5 0 0 1 14.5 4.5 V13.0 A1.5 1.5 0 0 1 13.0 14.5 H3.0 A1.5 1.5 0 0 1 1.5 13.0 V4.5 A1.5 1.5 0 0 1 3.0 3 Z M1.5 6.5 H14.5 M5 1.5 V4 M11 1.5 V4" />
|
||||||
<ui:IconData x:Key="Icon.Camera" Stroke="M1.5 5 A1 1 0 0 1 2.5 4 H4.5 L6 2.5 H10 L11.5 4 H13.5 A1 1 0 0 1 14.5 5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z M5.2 8.5 A2.8 2.8 0 1 0 10.8 8.5 A2.8 2.8 0 1 0 5.2 8.5 Z" />
|
<ui:IconData x:Key="Icon.Camera" Stroke="M1.5 5 A1 1 0 0 1 2.5 4 H4.5 L6 2.5 H10 L11.5 4 H13.5 A1 1 0 0 1 14.5 5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z M5.2 8.5 A2.8 2.8 0 1 0 10.8 8.5 A2.8 2.8 0 1 0 5.2 8.5 Z" />
|
||||||
<ui:IconData x:Key="Icon.Cancel" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M5.8 5.8 L10.2 10.2 M10.2 5.8 L5.8 10.2" />
|
<ui:IconData x:Key="Icon.Cancel" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M5.8 5.8 L10.2 10.2 M10.2 5.8 L5.8 10.2" />
|
||||||
@@ -14,8 +14,8 @@
|
|||||||
<ui:IconData x:Key="Icon.Chart" Stroke="M2 2 V14 H14 M4.5 10.5 L7.5 7 L9.5 9 L13.5 4" />
|
<ui:IconData x:Key="Icon.Chart" Stroke="M2 2 V14 H14 M4.5 10.5 L7.5 7 L9.5 9 L13.5 4" />
|
||||||
<ui:IconData x:Key="Icon.Check" Stroke="M3 8.5 L6.5 12 L13 4.5" />
|
<ui:IconData x:Key="Icon.Check" Stroke="M3 8.5 L6.5 12 L13 4.5" />
|
||||||
<ui:IconData x:Key="Icon.ChevronDown" Stroke="M4 6 L8 10 L12 6" />
|
<ui:IconData x:Key="Icon.ChevronDown" Stroke="M4 6 L8 10 L12 6" />
|
||||||
<ui:IconData x:Key="Icon.ChevronLeft" Stroke="M10 4 L6 8 L10 12" />
|
<ui:IconData x:Key="Icon.ChevronLeft" Stroke="M10 4 L6 8 L10 12" IsDirectional="True" />
|
||||||
<ui:IconData x:Key="Icon.ChevronRight" Stroke="M6 4 L10 8 L6 12" />
|
<ui:IconData x:Key="Icon.ChevronRight" Stroke="M6 4 L10 8 L6 12" IsDirectional="True" />
|
||||||
<ui:IconData x:Key="Icon.ChevronUp" Stroke="M4 10 L8 6 L12 10" />
|
<ui:IconData x:Key="Icon.ChevronUp" Stroke="M4 10 L8 6 L12 10" />
|
||||||
<ui:IconData x:Key="Icon.Clipboard" Stroke="M4.0 2.5 H12.0 A1.5 1.5 0 0 1 13.5 4.0 V13.0 A1.5 1.5 0 0 1 12.0 14.5 H4.0 A1.5 1.5 0 0 1 2.5 13.0 V4.0 A1.5 1.5 0 0 1 4.0 2.5 Z M6.3 1.5 H9.7 A0.8 0.8 0 0 1 10.5 2.3 V3.2 A0.8 0.8 0 0 1 9.7 4.0 H6.3 A0.8 0.8 0 0 1 5.5 3.2 V2.3 A0.8 0.8 0 0 1 6.3 1.5 Z" />
|
<ui:IconData x:Key="Icon.Clipboard" Stroke="M4.0 2.5 H12.0 A1.5 1.5 0 0 1 13.5 4.0 V13.0 A1.5 1.5 0 0 1 12.0 14.5 H4.0 A1.5 1.5 0 0 1 2.5 13.0 V4.0 A1.5 1.5 0 0 1 4.0 2.5 Z M6.3 1.5 H9.7 A0.8 0.8 0 0 1 10.5 2.3 V3.2 A0.8 0.8 0 0 1 9.7 4.0 H6.3 A0.8 0.8 0 0 1 5.5 3.2 V2.3 A0.8 0.8 0 0 1 6.3 1.5 Z" />
|
||||||
<ui:IconData x:Key="Icon.Clock" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 4.5 V8 L10.5 9.5" />
|
<ui:IconData x:Key="Icon.Clock" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 4.5 V8 L10.5 9.5" />
|
||||||
@@ -35,13 +35,13 @@
|
|||||||
<ui:IconData x:Key="Icon.Exclude" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M3.4 12.6 L12.6 3.4" />
|
<ui:IconData x:Key="Icon.Exclude" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M3.4 12.6 L12.6 3.4" />
|
||||||
<ui:IconData x:Key="Icon.Export" Stroke="M8 10 V1.8 M4.8 5 L8 1.8 L11.2 5 M5 7.5 H3 A1 1 0 0 0 2 8.5 V13.5 A1 1 0 0 0 3 14.5 H13 A1 1 0 0 0 14 13.5 V8.5 A1 1 0 0 0 13 7.5 H11" />
|
<ui:IconData x:Key="Icon.Export" Stroke="M8 10 V1.8 M4.8 5 L8 1.8 L11.2 5 M5 7.5 H3 A1 1 0 0 0 2 8.5 V13.5 A1 1 0 0 0 3 14.5 H13 A1 1 0 0 0 14 13.5 V8.5 A1 1 0 0 0 13 7.5 H11" />
|
||||||
<ui:IconData x:Key="Icon.Exposure" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M3.4 12.6 L12.6 3.4 M4.5 6 H7 M5.75 4.75 V7.25 M9 10 H11.5" />
|
<ui:IconData x:Key="Icon.Exposure" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M3.4 12.6 L12.6 3.4 M4.5 6 H7 M5.75 4.75 V7.25 M9 10 H11.5" />
|
||||||
<ui:IconData x:Key="Icon.ExternalLink" Stroke="M9.5 2 H14 V6.5 M14 2 L7.5 8.5 M12 9.5 V13 A1 1 0 0 1 11 14 H3 A1 1 0 0 1 2 13 V5 A1 1 0 0 1 3 4 H6.5" />
|
<ui:IconData x:Key="Icon.ExternalLink" Stroke="M9.5 2 H14 V6.5 M14 2 L7.5 8.5 M12 9.5 V13 A1 1 0 0 1 11 14 H3 A1 1 0 0 1 2 13 V5 A1 1 0 0 1 3 4 H6.5" IsDirectional="True" />
|
||||||
<ui:IconData x:Key="Icon.Eye" Stroke="M1.5 8 C3.5 4 12.5 4 14.5 8 C12.5 12 3.5 12 1.5 8 Z M5.8 8 A2.2 2.2 0 1 0 10.2 8 A2.2 2.2 0 1 0 5.8 8 Z" />
|
<ui:IconData x:Key="Icon.Eye" Stroke="M1.5 8 C3.5 4 12.5 4 14.5 8 C12.5 12 3.5 12 1.5 8 Z M5.8 8 A2.2 2.2 0 1 0 10.2 8 A2.2 2.2 0 1 0 5.8 8 Z" />
|
||||||
<ui:IconData x:Key="Icon.Filmstrip" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M4.5 2.5 V13.5 M11.5 2.5 V13.5 M1.5 6 H4.5 M1.5 10 H4.5 M11.5 6 H14.5 M11.5 10 H14.5" />
|
<ui:IconData x:Key="Icon.Filmstrip" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M4.5 2.5 V13.5 M11.5 2.5 V13.5 M1.5 6 H4.5 M1.5 10 H4.5 M11.5 6 H14.5 M11.5 10 H14.5" />
|
||||||
<ui:IconData x:Key="Icon.Filter" Stroke="M1.5 2.5 H14.5 L9.5 8.5 V13.5 L6.5 12 V8.5 Z" />
|
<ui:IconData x:Key="Icon.Filter" Stroke="M1.5 2.5 H14.5 L9.5 8.5 V13.5 L6.5 12 V8.5 Z" />
|
||||||
<ui:IconData x:Key="Icon.Folder" Stroke="M1.5 4 A1 1 0 0 1 2.5 3 H6 L7.5 4.5 H13.5 A1 1 0 0 1 14.5 5.5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z" />
|
<ui:IconData x:Key="Icon.Folder" Stroke="M1.5 4 A1 1 0 0 1 2.5 3 H6 L7.5 4.5 H13.5 A1 1 0 0 1 14.5 5.5 V12.5 A1 1 0 0 1 13.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z" />
|
||||||
<ui:IconData x:Key="Icon.FolderOpen" Stroke="M1.5 12.5 V4 A1 1 0 0 1 2.5 3 H6 L7.5 4.5 H12.5 V6.5 M1.5 12.5 L3.5 7 H14.5 L12.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z" />
|
<ui:IconData x:Key="Icon.FolderOpen" Stroke="M1.5 12.5 V4 A1 1 0 0 1 2.5 3 H6 L7.5 4.5 H12.5 V6.5 M1.5 12.5 L3.5 7 H14.5 L12.5 13.5 H2.5 A1 1 0 0 1 1.5 12.5 Z" />
|
||||||
<ui:IconData x:Key="Icon.Forward" Stroke="M3 8 H13 M9 4 L13 8 L9 12" />
|
<ui:IconData x:Key="Icon.Forward" Stroke="M3 8 H13 M9 4 L13 8 L9 12" IsDirectional="True" />
|
||||||
<ui:IconData x:Key="Icon.Fullscreen" Stroke="M2 6 V2 H6 M10 2 H14 V6 M14 10 V14 H10 M6 14 H2 V10" />
|
<ui:IconData x:Key="Icon.Fullscreen" Stroke="M2 6 V2 H6 M10 2 H14 V6 M14 10 V14 H10 M6 14 H2 V10" />
|
||||||
<ui:IconData x:Key="Icon.Gpu" Stroke="M5.0 3.5 H11.0 A1.5 1.5 0 0 1 12.5 5.0 V11.0 A1.5 1.5 0 0 1 11.0 12.5 H5.0 A1.5 1.5 0 0 1 3.5 11.0 V5.0 A1.5 1.5 0 0 1 5.0 3.5 Z M6.5 6 H9.5 A0.5 0.5 0 0 1 10 6.5 V9.5 A0.5 0.5 0 0 1 9.5 10 H6.5 A0.5 0.5 0 0 1 6 9.5 V6.5 A0.5 0.5 0 0 1 6.5 6 Z M6 1.5 V3.5 M10 1.5 V3.5 M6 12.5 V14.5 M10 12.5 V14.5 M1.5 6 H3.5 M1.5 10 H3.5 M12.5 6 H14.5 M12.5 10 H14.5" />
|
<ui:IconData x:Key="Icon.Gpu" Stroke="M5.0 3.5 H11.0 A1.5 1.5 0 0 1 12.5 5.0 V11.0 A1.5 1.5 0 0 1 11.0 12.5 H5.0 A1.5 1.5 0 0 1 3.5 11.0 V5.0 A1.5 1.5 0 0 1 5.0 3.5 Z M6.5 6 H9.5 A0.5 0.5 0 0 1 10 6.5 V9.5 A0.5 0.5 0 0 1 9.5 10 H6.5 A0.5 0.5 0 0 1 6 9.5 V6.5 A0.5 0.5 0 0 1 6.5 6 Z M6 1.5 V3.5 M10 1.5 V3.5 M6 12.5 V14.5 M10 12.5 V14.5 M1.5 6 H3.5 M1.5 10 H3.5 M12.5 6 H14.5 M12.5 10 H14.5" />
|
||||||
<ui:IconData x:Key="Icon.Grip" Fill="M5 4 A1 1 0 1 0 7 4 A1 1 0 1 0 5 4 ZM9 4 A1 1 0 1 0 11 4 A1 1 0 1 0 9 4 ZM5 8 A1 1 0 1 0 7 8 A1 1 0 1 0 5 8 ZM9 8 A1 1 0 1 0 11 8 A1 1 0 1 0 9 8 ZM5 12 A1 1 0 1 0 7 12 A1 1 0 1 0 5 12 ZM9 12 A1 1 0 1 0 11 12 A1 1 0 1 0 9 12 Z" />
|
<ui:IconData x:Key="Icon.Grip" Fill="M5 4 A1 1 0 1 0 7 4 A1 1 0 1 0 5 4 ZM9 4 A1 1 0 1 0 11 4 A1 1 0 1 0 9 4 ZM5 8 A1 1 0 1 0 7 8 A1 1 0 1 0 5 8 ZM9 8 A1 1 0 1 0 11 8 A1 1 0 1 0 9 8 ZM5 12 A1 1 0 1 0 7 12 A1 1 0 1 0 5 12 ZM9 12 A1 1 0 1 0 11 12 A1 1 0 1 0 9 12 Z" />
|
||||||
@@ -50,14 +50,14 @@
|
|||||||
<ui:IconData x:Key="Icon.Image" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M1.5 11 L5.5 7 L9 10.5 L11 8.5 L14.5 12" Fill="M9.600000000000001 5.6 A1.2 1.2 0 1 0 12.0 5.6 A1.2 1.2 0 1 0 9.600000000000001 5.6 Z" />
|
<ui:IconData x:Key="Icon.Image" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M1.5 11 L5.5 7 L9 10.5 L11 8.5 L14.5 12" Fill="M9.600000000000001 5.6 A1.2 1.2 0 1 0 12.0 5.6 A1.2 1.2 0 1 0 9.600000000000001 5.6 Z" />
|
||||||
<ui:IconData x:Key="Icon.Import" Stroke="M8 2V10 M4.5 6.5 L8 10 L11.5 6.5 M2.5 13.5 H13.5" />
|
<ui:IconData x:Key="Icon.Import" Stroke="M8 2V10 M4.5 6.5 L8 10 L11.5 6.5 M2.5 13.5 H13.5" />
|
||||||
<ui:IconData x:Key="Icon.Info" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 7 V11 M8 4.8 V5.2" />
|
<ui:IconData x:Key="Icon.Info" Stroke="M1.5 8 A6.5 6.5 0 1 0 14.5 8 A6.5 6.5 0 1 0 1.5 8 Z M8 7 V11 M8 4.8 V5.2" />
|
||||||
<ui:IconData x:Key="Icon.Jobs" Stroke="M3 8 H13 M3 4 H13 M3 12 H9" />
|
<ui:IconData x:Key="Icon.Jobs" Stroke="M3 8 H13 M3 4 H13 M3 12 H9" IsDirectional="True" />
|
||||||
<ui:IconData x:Key="Icon.Key" Stroke="M2 10.5 A3 3 0 1 0 8 10.5 A3 3 0 1 0 2 10.5 Z M7.2 8.3 L13.5 2 M11.5 4 L13 5.5 M9.8 5.7 L11 6.9" />
|
<ui:IconData x:Key="Icon.Key" Stroke="M2 10.5 A3 3 0 1 0 8 10.5 A3 3 0 1 0 2 10.5 Z M7.2 8.3 L13.5 2 M11.5 4 L13 5.5 M9.8 5.7 L11 6.9" />
|
||||||
<ui:IconData x:Key="Icon.Keyframe" Stroke="M8 2 L13 8 L8 14 L3 8 Z" />
|
<ui:IconData x:Key="Icon.Keyframe" Stroke="M8 2 L13 8 L8 14 L3 8 Z" />
|
||||||
<ui:IconData x:Key="Icon.Layers" Stroke="M8 1.8 L14.5 5.2 L8 8.6 L1.5 5.2 Z M1.5 8.2 L8 11.6 L14.5 8.2 M1.5 11 L8 14.4 L14.5 11" />
|
<ui:IconData x:Key="Icon.Layers" Stroke="M8 1.8 L14.5 5.2 L8 8.6 L1.5 5.2 Z M1.5 8.2 L8 11.6 L14.5 8.2 M1.5 11 L8 14.4 L14.5 11" />
|
||||||
<ui:IconData x:Key="Icon.Library" Stroke="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" />
|
<ui:IconData x:Key="Icon.Library" Stroke="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" />
|
||||||
<ui:IconData x:Key="Icon.Link" Stroke="M6.8 9.2 L9.2 6.8 M7.5 4.5 L9 3 A2.8 2.8 0 0 1 13 7 L11.5 8.5 M8.5 11.5 L7 13 A2.8 2.8 0 0 1 3 9 L4.5 7.5" />
|
<ui:IconData x:Key="Icon.Link" Stroke="M6.8 9.2 L9.2 6.8 M7.5 4.5 L9 3 A2.8 2.8 0 0 1 13 7 L11.5 8.5 M8.5 11.5 L7 13 A2.8 2.8 0 0 1 3 9 L4.5 7.5" />
|
||||||
<ui:IconData x:Key="Icon.Lock" Stroke="M4.5 7 H11.5 A1.5 1.5 0 0 1 13 8.5 V13.0 A1.5 1.5 0 0 1 11.5 14.5 H4.5 A1.5 1.5 0 0 1 3 13.0 V8.5 A1.5 1.5 0 0 1 4.5 7 Z M5.5 7 V5 A2.5 2.5 0 0 1 10.5 5 V7" />
|
<ui:IconData x:Key="Icon.Lock" Stroke="M4.5 7 H11.5 A1.5 1.5 0 0 1 13 8.5 V13.0 A1.5 1.5 0 0 1 11.5 14.5 H4.5 A1.5 1.5 0 0 1 3 13.0 V8.5 A1.5 1.5 0 0 1 4.5 7 Z M5.5 7 V5 A2.5 2.5 0 0 1 10.5 5 V7" />
|
||||||
<ui:IconData x:Key="Icon.Logs" Stroke="M3.5 1.5 H9.5 L12.5 4.5 V14.5 H3.5 Z M5.5 7 H10.5 M5.5 9.5 H10.5 M5.5 12 H8.5" />
|
<ui:IconData x:Key="Icon.Logs" Stroke="M3.5 1.5 H9.5 L12.5 4.5 V14.5 H3.5 Z M5.5 7 H10.5 M5.5 9.5 H10.5 M5.5 12 H8.5" IsDirectional="True" />
|
||||||
<ui:IconData x:Key="Icon.Menu" Stroke="M2.5 4 H13.5 M2.5 8 H13.5 M2.5 12 H13.5" />
|
<ui:IconData x:Key="Icon.Menu" Stroke="M2.5 4 H13.5 M2.5 8 H13.5 M2.5 12 H13.5" />
|
||||||
<ui:IconData x:Key="Icon.Minus" Stroke="M3 8 H13" />
|
<ui:IconData x:Key="Icon.Minus" Stroke="M3 8 H13" />
|
||||||
<ui:IconData x:Key="Icon.Moon" Stroke="M9.5 1.8 A6.5 6.5 0 1 0 14.2 11.2 A5.5 5.5 0 0 1 9.5 1.8 Z" />
|
<ui:IconData x:Key="Icon.Moon" Stroke="M9.5 1.8 A6.5 6.5 0 1 0 14.2 11.2 A5.5 5.5 0 0 1 9.5 1.8 Z" />
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
<ui:IconData x:Key="Icon.Vectors" Stroke="M2.5 12.5 L7 8 M7 8 H4.5 M7 8 V10.5 M9 7 L13.5 2.5 M13.5 2.5 H11 M13.5 2.5 V5" />
|
<ui:IconData x:Key="Icon.Vectors" Stroke="M2.5 12.5 L7 8 M7 8 H4.5 M7 8 V10.5 M9 7 L13.5 2.5 M13.5 2.5 H11 M13.5 2.5 V5" />
|
||||||
<ui:IconData x:Key="Icon.Verify" Stroke="M8 1.5 L13.5 3.5 V7.5 C13.5 11 11 13.3 8 14.5 C5 13.3 2.5 11 2.5 7.5 V3.5 Z M5.5 8 L7.3 9.8 L10.6 6.3" />
|
<ui:IconData x:Key="Icon.Verify" Stroke="M8 1.5 L13.5 3.5 V7.5 C13.5 11 11 13.3 8 14.5 C5 13.3 2.5 11 2.5 7.5 V3.5 Z M5.5 8 L7.3 9.8 L10.6 6.3" />
|
||||||
<ui:IconData x:Key="Icon.ViewGrid" Stroke="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" />
|
<ui:IconData x:Key="Icon.ViewGrid" Stroke="M2.5 1.5 H6.0 A1 1 0 0 1 7.0 2.5 V6.0 A1 1 0 0 1 6.0 7.0 H2.5 A1 1 0 0 1 1.5 6.0 V2.5 A1 1 0 0 1 2.5 1.5 ZM10 1.5 H13.5 A1 1 0 0 1 14.5 2.5 V6.0 A1 1 0 0 1 13.5 7.0 H10 A1 1 0 0 1 9 6.0 V2.5 A1 1 0 0 1 10 1.5 ZM2.5 9 H6.0 A1 1 0 0 1 7.0 10 V13.5 A1 1 0 0 1 6.0 14.5 H2.5 A1 1 0 0 1 1.5 13.5 V10 A1 1 0 0 1 2.5 9 ZM10 9 H13.5 A1 1 0 0 1 14.5 10 V13.5 A1 1 0 0 1 13.5 14.5 H10 A1 1 0 0 1 9 13.5 V10 A1 1 0 0 1 10 9 Z" />
|
||||||
<ui:IconData x:Key="Icon.ViewList" Stroke="M5.5 4 H13.5 M5.5 8 H13.5 M5.5 12 H13.5 M2.5 4 H2.6 M2.5 8 H2.6 M2.5 12 H2.6" />
|
<ui:IconData x:Key="Icon.ViewList" Stroke="M5.5 4 H13.5 M5.5 8 H13.5 M5.5 12 H13.5 M2.5 4 H2.6 M2.5 8 H2.6 M2.5 12 H2.6" IsDirectional="True" />
|
||||||
<ui:IconData x:Key="Icon.ViewTimeline" Stroke="M2 13.5 H14 M3.5 11 V8 M6 11 V5 M8.5 11 V7 M11 11 V3.5 M13.5 11 V9" />
|
<ui:IconData x:Key="Icon.ViewTimeline" Stroke="M2 13.5 H14 M3.5 11 V8 M6 11 V5 M8.5 11 V7 M11 11 V3.5 M13.5 11 V9" />
|
||||||
<ui:IconData x:Key="Icon.Warning" Stroke="M8 1.8 L14.8 13.8 H1.2 Z M8 6.2 V9.6 M8 11.7 V11.8" />
|
<ui:IconData x:Key="Icon.Warning" Stroke="M8 1.8 L14.8 13.8 H1.2 Z M8 6.2 V9.6 M8 11.7 V11.8" />
|
||||||
<ui:IconData x:Key="Icon.Window" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M1.5 5.5 H14.5" />
|
<ui:IconData x:Key="Icon.Window" Stroke="M3.0 2.5 H13.0 A1.5 1.5 0 0 1 14.5 4.0 V12.0 A1.5 1.5 0 0 1 13.0 13.5 H3.0 A1.5 1.5 0 0 1 1.5 12.0 V4.0 A1.5 1.5 0 0 1 3.0 2.5 Z M1.5 5.5 H14.5" />
|
||||||
|
|||||||
@@ -25,6 +25,17 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<!-- Focus inside the bounds, for list rows and table rows whose neighbours or scroll viewport would hide an outer ring. -->
|
||||||
|
<Style x:Key="Focus.Inset">
|
||||||
|
<Setter Property="Control.Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate>
|
||||||
|
<Border BorderBrush="{DynamicResource Brush.Accent}" BorderThickness="2" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True" />
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<DropShadowEffect x:Key="Shadow.Popup" BlurRadius="24" ShadowDepth="6" Direction="270" Opacity="0.45" Color="Black" />
|
<DropShadowEffect x:Key="Shadow.Popup" BlurRadius="24" ShadowDepth="6" Direction="270" Opacity="0.45" Color="Black" />
|
||||||
<DropShadowEffect x:Key="Shadow.ToolTip" BlurRadius="14" ShadowDepth="4" Direction="270" Opacity="0.4" Color="Black" />
|
<DropShadowEffect x:Key="Shadow.ToolTip" BlurRadius="14" ShadowDepth="4" Direction="270" Opacity="0.4" Color="Black" />
|
||||||
|
|
||||||
@@ -212,24 +223,26 @@
|
|||||||
<Setter Property="SelectionOpacity" Value="0.35" />
|
<Setter Property="SelectionOpacity" Value="0.35" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
|
<!-- The text box hands its Padding to the content host itself, so the template applies it nowhere else: the
|
||||||
|
placeholder takes it as its own padding (plus the 2 px the text view adds) and the leading icon sits at its
|
||||||
|
left edge; with an icon, text and placeholder start 8 px after it. -->
|
||||||
<ControlTemplate TargetType="TextBox">
|
<ControlTemplate TargetType="TextBox">
|
||||||
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True">
|
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True">
|
||||||
<Grid Margin="{TemplateBinding Padding}">
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<ui:Icon x:Name="Glyph" Glyph="{TemplateBinding ui:Field.Glyph}" Foreground="{DynamicResource Brush.TextFaint}" HorizontalAlignment="Left"
|
||||||
<ColumnDefinition Width="Auto" />
|
Margin="{TemplateBinding Padding}" />
|
||||||
<ColumnDefinition Width="*" />
|
<TextBlock x:Name="Placeholder" Text="{TemplateBinding ui:Field.Placeholder}" Foreground="{DynamicResource Brush.TextFaint}" Padding="{TemplateBinding Padding}"
|
||||||
</Grid.ColumnDefinitions>
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed" IsHitTestVisible="False" TextTrimming="CharacterEllipsis" Margin="24,0,0,0" />
|
||||||
<ui:Icon x:Name="Glyph" Glyph="{TemplateBinding ui:Field.Glyph}" Foreground="{DynamicResource Brush.TextFaint}" Margin="0,0,8,0" VerticalAlignment="Center" />
|
<ScrollViewer x:Name="PART_ContentHost" Focusable="False" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="22,0,0,0"
|
||||||
<TextBlock x:Name="Placeholder" Grid.Column="1" Text="{TemplateBinding ui:Field.Placeholder}" Foreground="{DynamicResource Brush.TextFaint}"
|
|
||||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Collapsed" IsHitTestVisible="False" TextTrimming="CharacterEllipsis" Margin="2,0,0,0" />
|
|
||||||
<ScrollViewer x:Name="PART_ContentHost" Grid.Column="1" Focusable="False" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
||||||
HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" />
|
HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="ui:Field.Glyph" Value="{x:Null}">
|
<Trigger Property="ui:Field.Glyph" Value="{x:Null}">
|
||||||
<Setter TargetName="Glyph" Property="Visibility" Value="Collapsed" />
|
<Setter TargetName="Glyph" Property="Visibility" Value="Collapsed" />
|
||||||
|
<Setter TargetName="Placeholder" Property="Margin" Value="2,0,0,0" />
|
||||||
|
<Setter TargetName="PART_ContentHost" Property="Margin" Value="0" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="Text" Value="">
|
<Trigger Property="Text" Value="">
|
||||||
<Setter TargetName="Placeholder" Property="Visibility" Value="Visible" />
|
<Setter TargetName="Placeholder" Property="Visibility" Value="Visible" />
|
||||||
@@ -256,8 +269,14 @@
|
|||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<!-- Naming templates ({year}/{date}_{n:0000}) and paths keep their characters in order in right-to-left languages. -->
|
||||||
<Style x:Key="TextBox.Mono" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
<Style x:Key="TextBox.Mono" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||||
<Setter Property="FontFamily" Value="{StaticResource Font.Mono}" />
|
<Setter Property="FontFamily" Value="{StaticResource Font.Mono}" />
|
||||||
|
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="TextBox.Path" TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
|
||||||
|
<Setter Property="FlowDirection" Value="LeftToRight" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style TargetType="PasswordBox" BasedOn="{StaticResource Input.Base}">
|
<Style TargetType="PasswordBox" BasedOn="{StaticResource Input.Base}">
|
||||||
@@ -265,10 +284,11 @@
|
|||||||
<Setter Property="SelectionBrush" Value="{DynamicResource Brush.Accent}" />
|
<Setter Property="SelectionBrush" Value="{DynamicResource Brush.Accent}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
|
<!-- As for TextBox, the password box hands its Padding to the content host itself. -->
|
||||||
<ControlTemplate TargetType="PasswordBox">
|
<ControlTemplate TargetType="PasswordBox">
|
||||||
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
<Border x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True">
|
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True">
|
||||||
<ScrollViewer x:Name="PART_ContentHost" Margin="{TemplateBinding Padding}" VerticalAlignment="Center" Focusable="False"
|
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" Focusable="False"
|
||||||
HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" />
|
HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" />
|
||||||
</Border>
|
</Border>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
@@ -278,6 +298,11 @@
|
|||||||
<Trigger Property="IsKeyboardFocused" Value="True">
|
<Trigger Property="IsKeyboardFocused" Value="True">
|
||||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
<!-- A password has no binding to validate: the owner sets ui:Field.Error (DESIGN §4 error state, as TextBox). -->
|
||||||
|
<Trigger Property="ui:Field.HasError" Value="True">
|
||||||
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Error}" />
|
||||||
|
<Setter Property="AutomationProperties.HelpText" Value="{Binding (ui:Field.Error), RelativeSource={RelativeSource Self}}" />
|
||||||
|
</Trigger>
|
||||||
<Trigger Property="IsEnabled" Value="False">
|
<Trigger Property="IsEnabled" Value="False">
|
||||||
<Setter Property="Opacity" Value="0.4" />
|
<Setter Property="Opacity" Value="0.4" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
@@ -295,7 +320,7 @@
|
|||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ToggleButton">
|
<ControlTemplate TargetType="ToggleButton">
|
||||||
<Border Background="Transparent">
|
<Border Background="Transparent">
|
||||||
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Size="14" HorizontalAlignment="Right" Margin="0,0,10,0"
|
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Size="14" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,10,0"
|
||||||
Foreground="{DynamicResource Brush.TextMuted}" />
|
Foreground="{DynamicResource Brush.TextMuted}" />
|
||||||
</Border>
|
</Border>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
@@ -737,7 +762,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style TargetType="ListBoxItem">
|
<Style TargetType="ListBoxItem">
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||||
<Setter Property="MinHeight" Value="36" />
|
<Setter Property="MinHeight" Value="36" />
|
||||||
<Setter Property="Padding" Value="10,0" />
|
<Setter Property="Padding" Value="10,0" />
|
||||||
@@ -800,7 +825,7 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<Style TargetType="ListViewItem">
|
<Style TargetType="ListViewItem">
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Inset}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||||
<Setter Property="Height" Value="{StaticResource Height.Row}" />
|
<Setter Property="Height" Value="{StaticResource Height.Row}" />
|
||||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
@@ -1050,11 +1075,11 @@
|
|||||||
<DockPanel LastChildFill="True">
|
<DockPanel LastChildFill="True">
|
||||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
||||||
<Button x:Name="Minimize" Style="{StaticResource Caption.Button}" ui:ButtonIcon.Glyph="{StaticResource Icon.Caption.Minimize}"
|
<Button x:Name="Minimize" Style="{StaticResource Caption.Button}" ui:ButtonIcon.Glyph="{StaticResource Icon.Caption.Minimize}"
|
||||||
Command="{x:Static SystemCommands.MinimizeWindowCommand}" AutomationProperties.Name="Minimize" ToolTip="{l:Loc Tooltips.Window.Minimize}" />
|
Command="{x:Static SystemCommands.MinimizeWindowCommand}" AutomationProperties.Name="{l:Loc Tooltips.Window.Minimize}" ToolTip="{l:Loc Tooltips.Window.Minimize}" />
|
||||||
<Button x:Name="PART_Maximize" Style="{StaticResource Caption.Button}" ui:ButtonIcon.Glyph="{StaticResource Icon.Caption.Maximize}"
|
<Button x:Name="PART_Maximize" Style="{StaticResource Caption.Button}" ui:ButtonIcon.Glyph="{StaticResource Icon.Caption.Maximize}"
|
||||||
Command="{x:Static SystemCommands.MaximizeWindowCommand}" AutomationProperties.Name="Maximize" ToolTip="{l:Loc Tooltips.Window.Maximize}" />
|
Command="{x:Static SystemCommands.MaximizeWindowCommand}" AutomationProperties.Name="{l:Loc Tooltips.Window.Maximize}" ToolTip="{l:Loc Tooltips.Window.Maximize}" />
|
||||||
<Button x:Name="Close" Style="{StaticResource Caption.Close}" ui:ButtonIcon.Glyph="{StaticResource Icon.Caption.Close}"
|
<Button x:Name="Close" Style="{StaticResource Caption.Close}" ui:ButtonIcon.Glyph="{StaticResource Icon.Caption.Close}"
|
||||||
Command="{x:Static SystemCommands.CloseWindowCommand}" AutomationProperties.Name="Close" ToolTip="{l:Loc Tooltips.Window.Close}" />
|
Command="{x:Static SystemCommands.CloseWindowCommand}" AutomationProperties.Name="{l:Loc Tooltips.Window.Close}" ToolTip="{l:Loc Tooltips.Window.Close}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ui:BrandMarkIcon Width="16" Height="16" Margin="12,0,10,0" VerticalAlignment="Center" />
|
<ui:BrandMarkIcon Width="16" Height="16" Margin="12,0,10,0" VerticalAlignment="Center" />
|
||||||
<TextBlock Text="{TemplateBinding Title}" Foreground="{DynamicResource Brush.TextMuted}" FontSize="{StaticResource Size.Secondary}"
|
<TextBlock Text="{TemplateBinding Title}" Foreground="{DynamicResource Brush.TextMuted}" FontSize="{StaticResource Size.Secondary}"
|
||||||
@@ -1072,6 +1097,7 @@
|
|||||||
<Setter TargetName="Root" Property="Padding" Value="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
<Setter TargetName="Root" Property="Padding" Value="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
||||||
<Setter TargetName="PART_Maximize" Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Caption.Restore}" />
|
<Setter TargetName="PART_Maximize" Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.Caption.Restore}" />
|
||||||
<Setter TargetName="PART_Maximize" Property="ToolTip" Value="{l:Loc Tooltips.Window.Restore}" />
|
<Setter TargetName="PART_Maximize" Property="ToolTip" Value="{l:Loc Tooltips.Window.Restore}" />
|
||||||
|
<Setter TargetName="PART_Maximize" Property="AutomationProperties.Name" Value="{l:Loc Tooltips.Window.Restore}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsMaximizeHovered" Value="True">
|
<Trigger Property="IsMaximizeHovered" Value="True">
|
||||||
<Setter TargetName="PART_Maximize" Property="Background" Value="{DynamicResource Brush.Card}" />
|
<Setter TargetName="PART_Maximize" Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||||
@@ -1106,7 +1132,7 @@
|
|||||||
<Border x:Name="Bd" Background="Transparent" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True">
|
<Border x:Name="Bd" Background="Transparent" CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Border x:Name="Edge" Width="3" HorizontalAlignment="Left" CornerRadius="1.5" Margin="0,8" Background="{DynamicResource Brush.Accent}" Visibility="Hidden" />
|
<Border x:Name="Edge" Width="3" HorizontalAlignment="Left" CornerRadius="1.5" Margin="0,8" Background="{DynamicResource Brush.Accent}" Visibility="Hidden" />
|
||||||
<Grid Margin="10,0,8,0">
|
<Grid x:Name="Row" Margin="10,0,8,0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
@@ -1116,8 +1142,9 @@
|
|||||||
<TextBlock x:Name="Label" Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis">
|
<TextBlock x:Name="Label" Grid.Column="1" Margin="10,0,0,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis">
|
||||||
<ContentPresenter RecognizesAccessKey="True" />
|
<ContentPresenter RecognizesAccessKey="True" />
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<Border x:Name="Badge" Grid.Column="2" MinWidth="18" Height="16" CornerRadius="8" Padding="5,0" Background="{DynamicResource Brush.Accent}" VerticalAlignment="Center">
|
<Border x:Name="Badge" Grid.Column="2" MinWidth="18" Height="16" CornerRadius="8" Padding="5,0" Margin="6,0,0,0" Background="{DynamicResource Brush.Accent}" VerticalAlignment="Center">
|
||||||
<TextBlock Text="{Binding Badge, RelativeSource={RelativeSource TemplatedParent}}" FontSize="10" FontWeight="SemiBold" Foreground="{DynamicResource Brush.OnAccent}" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
<TextBlock Text="{Binding Badge, RelativeSource={RelativeSource TemplatedParent}}" FontSize="{StaticResource Size.Chip}" FontWeight="SemiBold" Foreground="{DynamicResource Brush.OnAccent}"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -1126,12 +1153,15 @@
|
|||||||
<Trigger Property="Badge" Value="0">
|
<Trigger Property="Badge" Value="0">
|
||||||
<Setter TargetName="Badge" Property="Visibility" Value="Collapsed" />
|
<Setter TargetName="Badge" Property="Visibility" Value="Collapsed" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
|
<!-- 32 px button: the 16 px icon centred; the badge hangs off the icon's top-right corner (the negative margin
|
||||||
|
keeps it from widening the icon column) and covers only that corner. -->
|
||||||
<Trigger Property="ui:NavRail.IsCollapsed" Value="True">
|
<Trigger Property="ui:NavRail.IsCollapsed" Value="True">
|
||||||
<Setter TargetName="Label" Property="Visibility" Value="Collapsed" />
|
<Setter TargetName="Label" Property="Visibility" Value="Collapsed" />
|
||||||
<Setter TargetName="Badge" Property="HorizontalAlignment" Value="Right" />
|
<Setter TargetName="Row" Property="Margin" Value="8,0" />
|
||||||
<Setter TargetName="Badge" Property="VerticalAlignment" Value="Top" />
|
|
||||||
<Setter TargetName="Badge" Property="Margin" Value="-14,4,0,0" />
|
|
||||||
<Setter TargetName="Badge" Property="Grid.Column" Value="0" />
|
<Setter TargetName="Badge" Property="Grid.Column" Value="0" />
|
||||||
|
<Setter TargetName="Badge" Property="HorizontalAlignment" Value="Left" />
|
||||||
|
<Setter TargetName="Badge" Property="VerticalAlignment" Value="Top" />
|
||||||
|
<Setter TargetName="Badge" Property="Margin" Value="8,2,-24,0" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsMouseOver" Value="True">
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Card}" />
|
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||||
@@ -1149,6 +1179,21 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- ===================== AutoSlider (advisor Auto / manual) ===================== -->
|
<!-- ===================== AutoSlider (advisor Auto / manual) ===================== -->
|
||||||
|
<!-- "Auto · 8" pill (DESIGN §4 Auto/manual): accent outline, 24 px, 11 px text; its tooltip gives the advisor's reason. -->
|
||||||
|
<Style x:Key="Button.AutoPill" TargetType="Button" BasedOn="{StaticResource Button.Base}">
|
||||||
|
<Setter Property="Height" Value="24" />
|
||||||
|
<Setter Property="MinWidth" Value="0" />
|
||||||
|
<Setter Property="Padding" Value="8,0" />
|
||||||
|
<Setter Property="FontSize" Value="{StaticResource Size.Chip}" />
|
||||||
|
<Setter Property="Background" Value="Transparent" />
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="ui:ControlState.CornerRadius" Value="12" />
|
||||||
|
<Setter Property="ui:ControlState.HoverBackground" Value="{DynamicResource Brush.AccentSubtle}" />
|
||||||
|
<Setter Property="ui:ControlState.HoverBorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||||
|
<Setter Property="ui:ControlState.PressedBackground" Value="{DynamicResource Brush.AccentSubtle}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style x:Key="Pill.Auto" TargetType="Border">
|
<Style x:Key="Pill.Auto" TargetType="Border">
|
||||||
<Setter Property="Height" Value="22" />
|
<Setter Property="Height" Value="22" />
|
||||||
<Setter Property="Padding" Value="8,0" />
|
<Setter Property="Padding" Value="8,0" />
|
||||||
@@ -1172,32 +1217,40 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Text="{TemplateBinding Header}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
<TextBlock Text="{TemplateBinding Header}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||||
<Border x:Name="AutoPill" Grid.Column="1" Style="{StaticResource Pill.Auto}" ToolTip="{TemplateBinding AutoReason}" ToolTipService.ShowOnDisabled="True">
|
<Button x:Name="AutoPill" Grid.Column="1" Style="{StaticResource Button.AutoPill}" Content="{TemplateBinding AutoText}" ToolTip="{TemplateBinding AutoReason}"
|
||||||
<TextBlock Text="{TemplateBinding AutoText}" FontSize="{StaticResource Size.Chip}" Foreground="{DynamicResource Brush.Accent}" VerticalAlignment="Center" />
|
AutomationProperties.Name="{Binding AutoText, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
</Border>
|
AutomationProperties.HelpText="{Binding AutoReason, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
<StackPanel x:Name="Manual" Grid.Column="1" Orientation="Horizontal" Visibility="Collapsed">
|
<StackPanel x:Name="Manual" Grid.Column="1" Orientation="Horizontal" Visibility="Collapsed">
|
||||||
<TextBlock Text="{TemplateBinding DisplayValue}" VerticalAlignment="Center" Style="{StaticResource Text.Number}" />
|
<TextBlock Text="{TemplateBinding DisplayValue}" VerticalAlignment="Center" Style="{StaticResource Text.Number}" />
|
||||||
<Button Style="{StaticResource Button.IconSubtle}" Width="26" Height="26" Margin="6,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Reset}"
|
<Button Style="{StaticResource Button.IconSubtle}" Width="26" Height="26" Margin="6,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Reset}"
|
||||||
Command="{x:Static ui:AutoSlider.ResetCommand}" ToolTip="{l:Loc Tooltips.Common.ResetToAuto}" />
|
Command="{x:Static ui:AutoSlider.ResetCommand}" ToolTip="{l:Loc Tooltips.Common.ResetToAuto}" AutomationProperties.Name="{l:Loc Common.ResetToAuto}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock x:Name="NotApplicable" Grid.Column="1" Text="{l:Loc Common.NotApplicable}" Foreground="{DynamicResource Brush.TextFaint}"
|
<TextBlock x:Name="NotApplicable" Grid.Column="1" Text="{l:Loc Common.NotApplicable}" Foreground="{DynamicResource Brush.TextFaint}"
|
||||||
ToolTip="{TemplateBinding NotApplicableReason}" Visibility="Collapsed" VerticalAlignment="Center" />
|
ToolTip="{TemplateBinding NotApplicableReason}" Visibility="Collapsed" VerticalAlignment="Center" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<!-- The slider carries the setting's name; its status says Auto (with the advisor's reason) or not applicable. -->
|
||||||
<Slider x:Name="PART_Slider" Margin="0,6,0,0" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}"
|
<Slider x:Name="PART_Slider" Margin="0,6,0,0" Minimum="{TemplateBinding Minimum}" Maximum="{TemplateBinding Maximum}"
|
||||||
SmallChange="{TemplateBinding SmallChange}" LargeChange="{TemplateBinding SmallChange}" TickFrequency="{TemplateBinding TickFrequency}"
|
SmallChange="{TemplateBinding SmallChange}" LargeChange="{TemplateBinding SmallChange}" TickFrequency="{TemplateBinding TickFrequency}"
|
||||||
IsSnapToTickEnabled="{TemplateBinding IsSnapToTickEnabled}" ToolTip="{TemplateBinding SliderToolTip}" />
|
IsSnapToTickEnabled="{TemplateBinding IsSnapToTickEnabled}" ToolTip="{TemplateBinding SliderToolTip}"
|
||||||
|
AutomationProperties.Name="{Binding Header, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
AutomationProperties.ItemStatus="{Binding AutoText, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
|
AutomationProperties.HelpText="{Binding AutoReason, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="IsAuto" Value="False">
|
<Trigger Property="IsAuto" Value="False">
|
||||||
<Setter TargetName="AutoPill" Property="Visibility" Value="Collapsed" />
|
<Setter TargetName="AutoPill" Property="Visibility" Value="Collapsed" />
|
||||||
<Setter TargetName="Manual" Property="Visibility" Value="Visible" />
|
<Setter TargetName="Manual" Property="Visibility" Value="Visible" />
|
||||||
<Setter TargetName="PART_Slider" Property="ui:ControlState.Accent" Value="{DynamicResource Brush.Sun}" />
|
<Setter TargetName="PART_Slider" Property="ui:ControlState.Accent" Value="{DynamicResource Brush.Sun}" />
|
||||||
|
<Setter TargetName="PART_Slider" Property="AutomationProperties.ItemStatus" Value="" />
|
||||||
|
<Setter TargetName="PART_Slider" Property="AutomationProperties.HelpText" Value="" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsApplicable" Value="False">
|
<Trigger Property="IsApplicable" Value="False">
|
||||||
<Setter TargetName="AutoPill" Property="Visibility" Value="Collapsed" />
|
<Setter TargetName="AutoPill" Property="Visibility" Value="Collapsed" />
|
||||||
<Setter TargetName="Manual" Property="Visibility" Value="Collapsed" />
|
<Setter TargetName="Manual" Property="Visibility" Value="Collapsed" />
|
||||||
<Setter TargetName="NotApplicable" Property="Visibility" Value="Visible" />
|
<Setter TargetName="NotApplicable" Property="Visibility" Value="Visible" />
|
||||||
<Setter TargetName="PART_Slider" Property="IsEnabled" Value="False" />
|
<Setter TargetName="PART_Slider" Property="IsEnabled" Value="False" />
|
||||||
|
<Setter TargetName="PART_Slider" Property="AutomationProperties.ItemStatus" Value="{l:Loc Common.NotApplicable}" />
|
||||||
|
<Setter TargetName="PART_Slider" Property="AutomationProperties.HelpText" Value="{Binding NotApplicableReason, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</ControlTemplate.Triggers>
|
</ControlTemplate.Triggers>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
@@ -1221,7 +1274,7 @@
|
|||||||
<ContentPresenter VerticalAlignment="Center" Margin="0,0,4,0" />
|
<ContentPresenter VerticalAlignment="Center" Margin="0,0,4,0" />
|
||||||
<Button x:Name="Remove" Style="{StaticResource Button.IconSubtle}" Width="18" Height="18" MinWidth="18" ui:ControlState.CornerRadius="9"
|
<Button x:Name="Remove" Style="{StaticResource Button.IconSubtle}" Width="18" Height="18" MinWidth="18" ui:ControlState.CornerRadius="9"
|
||||||
ui:ButtonIcon.Glyph="{StaticResource Icon.Close}" Command="{TemplateBinding RemoveCommand}" CommandParameter="{TemplateBinding RemoveCommandParameter}"
|
ui:ButtonIcon.Glyph="{StaticResource Icon.Close}" Command="{TemplateBinding RemoveCommand}" CommandParameter="{TemplateBinding RemoveCommandParameter}"
|
||||||
ToolTip="{TemplateBinding RemoveToolTip}" />
|
ToolTip="{TemplateBinding RemoveToolTip}" AutomationProperties.Name="{l:Loc Common.Remove}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
@@ -1314,19 +1367,19 @@
|
|||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="ui:JobBar">
|
<ControlTemplate TargetType="ui:JobBar">
|
||||||
<Border Background="{DynamicResource Brush.Surface}" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="20,0,12,0">
|
<Border Background="{DynamicResource Brush.Surface}" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,0,0,1" Padding="20,0,12,0">
|
||||||
<Grid>
|
<!-- The text takes what it needs and trims only once the bar is down to 120 px: the spacer reserves those
|
||||||
<Grid.ColumnDefinitions>
|
120 px before the text is measured, and the bar reaches back over it. -->
|
||||||
<ColumnDefinition Width="*" MinWidth="120" />
|
<DockPanel>
|
||||||
<ColumnDefinition Width="Auto" />
|
<Button x:Name="Stop" DockPanel.Dock="Right" Style="{StaticResource Button.Icon}" Width="28" Height="28" MinWidth="28"
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ProgressBar x:Name="Bar" VerticalAlignment="Center" Maximum="1" Value="{TemplateBinding Progress}" IsIndeterminate="{TemplateBinding IsIndeterminate}" />
|
|
||||||
<TextBlock Grid.Column="1" Text="{TemplateBinding Text}" Margin="12,0,12,0" VerticalAlignment="Center" FontSize="{StaticResource Size.Body}"
|
|
||||||
Typography.NumeralAlignment="Tabular" TextTrimming="CharacterEllipsis" MaxWidth="640" />
|
|
||||||
<Button x:Name="Stop" Grid.Column="2" Style="{StaticResource Button.Icon}" Width="28" Height="28" MinWidth="28"
|
|
||||||
ui:ButtonIcon.Glyph="{TemplateBinding ActionGlyph}" Command="{TemplateBinding StopCommand}" ToolTip="{TemplateBinding StopToolTip}"
|
ui:ButtonIcon.Glyph="{TemplateBinding ActionGlyph}" Command="{TemplateBinding StopCommand}" ToolTip="{TemplateBinding StopToolTip}"
|
||||||
AutomationProperties.Name="{Binding StopToolTip, RelativeSource={RelativeSource TemplatedParent}}" />
|
AutomationProperties.Name="{Binding StopName, RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
</Grid>
|
AutomationProperties.HelpText="{Binding StopToolTip, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
|
<FrameworkElement DockPanel.Dock="Left" Width="120" />
|
||||||
|
<TextBlock DockPanel.Dock="Right" Text="{TemplateBinding Text}" Margin="12,0,12,0" VerticalAlignment="Center" FontSize="{StaticResource Size.Body}"
|
||||||
|
Typography.NumeralAlignment="Tabular" TextTrimming="CharacterEllipsis" />
|
||||||
|
<ProgressBar x:Name="Bar" Margin="-120,0,0,0" VerticalAlignment="Center" Maximum="1" Value="{TemplateBinding Progress}" IsIndeterminate="{TemplateBinding IsIndeterminate}"
|
||||||
|
AutomationProperties.Name="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="IsActive" Value="False">
|
<Trigger Property="IsActive" Value="False">
|
||||||
@@ -1364,6 +1417,22 @@
|
|||||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
<Setter Property="VerticalAlignment" Value="Bottom" />
|
||||||
<Setter Property="Margin" Value="0,0,20,44" />
|
<Setter Property="Margin" Value="0,0,20,44" />
|
||||||
<Setter Property="Focusable" Value="False" />
|
<Setter Property="Focusable" Value="False" />
|
||||||
|
<!-- The host keys its own style, so no theme template applies: without this one nothing would draw. -->
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ui:ToastHost">
|
||||||
|
<ItemsPresenter />
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Setter Property="ItemContainerStyle">
|
||||||
|
<Setter.Value>
|
||||||
|
<Style TargetType="ContentPresenter">
|
||||||
|
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||||
|
<Setter Property="AutomationProperties.HelpText" Value="{Binding Message}" />
|
||||||
|
</Style>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
<Setter Property="ItemTemplate">
|
<Setter Property="ItemTemplate">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<DataTemplate DataType="{x:Type ui:Toast}">
|
<DataTemplate DataType="{x:Type ui:Toast}">
|
||||||
@@ -1384,7 +1453,8 @@
|
|||||||
<Button Grid.Column="1" Style="{StaticResource Button.Primary}" Margin="12,0,0,0" Content="{Binding ActionText}" Command="{Binding ActionCommand}"
|
<Button Grid.Column="1" Style="{StaticResource Button.Primary}" Margin="12,0,0,0" Content="{Binding ActionText}" Command="{Binding ActionCommand}"
|
||||||
ToolTip="{Binding ActionToolTip}" Visibility="{Binding ActionCommand, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
ToolTip="{Binding ActionToolTip}" Visibility="{Binding ActionCommand, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||||
<Button Grid.Column="2" Style="{StaticResource Button.IconSubtle}" Margin="4,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Close}"
|
<Button Grid.Column="2" Style="{StaticResource Button.IconSubtle}" Margin="4,0,0,0" ui:ButtonIcon.Glyph="{StaticResource Icon.Close}"
|
||||||
Command="{x:Static ui:ToastHost.DismissCommand}" CommandParameter="{Binding}" ToolTip="{l:Loc Tooltips.Common.Dismiss}" />
|
Command="{x:Static ui:ToastHost.DismissCommand}" CommandParameter="{Binding}" ToolTip="{l:Loc Tooltips.Common.DismissToast}"
|
||||||
|
AutomationProperties.Name="{l:Loc Tooltips.Common.Dismiss}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:ui="clr-namespace:Titano.Ui.Controls"
|
xmlns:ui="clr-namespace:Titano.Ui.Controls"
|
||||||
xmlns:v="clr-namespace:Titano.Ui.Visuals">
|
xmlns:v="clr-namespace:Titano.Ui.Visuals"
|
||||||
|
xmlns:l="clr-namespace:Titano.Ui.Localization">
|
||||||
<!--
|
<!--
|
||||||
Styles of the high-performance visuals (Titano.Ui.Visuals), merged by Controls.xaml. Brushes and the shared
|
Styles of the high-performance visuals (Titano.Ui.Visuals), merged by Controls.xaml. Brushes and the shared
|
||||||
button templates of Controls.xaml are DynamicResource (they live in the parent dictionary); sizes, radii and
|
button templates of Controls.xaml are DynamicResource (they live in the parent dictionary); sizes, radii and
|
||||||
@@ -76,14 +77,17 @@
|
|||||||
CornerRadius="{StaticResource Radius.Card}">
|
CornerRadius="{StaticResource Radius.Card}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<v:AspectRatioDecorator>
|
<v:AspectRatioDecorator>
|
||||||
<Grid x:Name="PART_Thumbnail" Background="Transparent">
|
<!-- The photo and the scrub position are a left-to-right island (time runs left to right, as in the
|
||||||
|
filmstrip); the check box, badge and quick actions follow the layout direction. -->
|
||||||
|
<Grid Background="Transparent">
|
||||||
<Border CornerRadius="7,7,0,0" Background="{DynamicResource Brush.Preview}" />
|
<Border CornerRadius="7,7,0,0" Background="{DynamicResource Brush.Preview}" />
|
||||||
<Border CornerRadius="7,7,0,0">
|
<Border x:Name="PART_Thumbnail" CornerRadius="7,7,0,0" FlowDirection="LeftToRight">
|
||||||
<Border.Background>
|
<Border.Background>
|
||||||
<ImageBrush ImageSource="{Binding DisplayedThumbnail, RelativeSource={RelativeSource TemplatedParent}}" Stretch="UniformToFill" />
|
<ImageBrush ImageSource="{Binding DisplayedThumbnail, RelativeSource={RelativeSource TemplatedParent}}" Stretch="UniformToFill" />
|
||||||
</Border.Background>
|
</Border.Background>
|
||||||
</Border>
|
</Border>
|
||||||
<Border x:Name="ScrubTrack" Height="2" VerticalAlignment="Bottom" Background="{DynamicResource Brush.Accent}" RenderTransformOrigin="0,0.5" Visibility="Collapsed">
|
<Border x:Name="ScrubTrack" Height="2" VerticalAlignment="Bottom" Background="{DynamicResource Brush.Accent}" RenderTransformOrigin="0,0.5" Visibility="Collapsed"
|
||||||
|
FlowDirection="LeftToRight">
|
||||||
<Border.RenderTransform>
|
<Border.RenderTransform>
|
||||||
<ScaleTransform ScaleX="{Binding ScrubPosition, RelativeSource={RelativeSource TemplatedParent}}" />
|
<ScaleTransform ScaleX="{Binding ScrubPosition, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
</Border.RenderTransform>
|
</Border.RenderTransform>
|
||||||
@@ -151,13 +155,14 @@
|
|||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
<!-- ===================== Preview viewport (BRIEF §12.3) ===================== -->
|
<!-- ===================== Preview viewport (BRIEF §12.3) ===================== -->
|
||||||
|
<!-- The image surface (a drawn visual, always left to right) and the numeric shot data stay left to right; the tool
|
||||||
|
row follows the layout direction. -->
|
||||||
<Style TargetType="v:PreviewViewport">
|
<Style TargetType="v:PreviewViewport">
|
||||||
<Setter Property="Background" Value="{DynamicResource Brush.Preview}" />
|
<Setter Property="Background" Value="{DynamicResource Brush.Preview}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
|
||||||
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
||||||
<Setter Property="FontSize" Value="{StaticResource Size.Secondary}" />
|
<Setter Property="FontSize" Value="{StaticResource Size.Secondary}" />
|
||||||
<Setter Property="FlowDirection" Value="LeftToRight" />
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource Focus.Ring}" />
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="v:PreviewViewport">
|
<ControlTemplate TargetType="v:PreviewViewport">
|
||||||
@@ -165,7 +170,7 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<v:PreviewSurface x:Name="PART_Surface" CornerRadius="8" />
|
<v:PreviewSurface x:Name="PART_Surface" CornerRadius="8" />
|
||||||
<ContentPresenter x:Name="PART_Tools" Content="{TemplateBinding ToolsContent}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="12" />
|
<ContentPresenter x:Name="PART_Tools" Content="{TemplateBinding ToolsContent}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="12" />
|
||||||
<Grid x:Name="PART_Info" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="12" IsHitTestVisible="False">
|
<Grid x:Name="PART_Info" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="12" IsHitTestVisible="False" FlowDirection="LeftToRight">
|
||||||
<Border Background="{DynamicResource Brush.Chrome}" Opacity="0.85" CornerRadius="{StaticResource Radius.Control}" />
|
<Border Background="{DynamicResource Brush.Chrome}" Opacity="0.85" CornerRadius="{StaticResource Radius.Control}" />
|
||||||
<TextBlock Text="{TemplateBinding InfoText}" Margin="10,6" Typography.NumeralAlignment="Tabular" TextTrimming="CharacterEllipsis" />
|
<TextBlock Text="{TemplateBinding InfoText}" Margin="10,6" Typography.NumeralAlignment="Tabular" TextTrimming="CharacterEllipsis" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -275,6 +280,7 @@
|
|||||||
|
|
||||||
<Style TargetType="v:SplitButton">
|
<Style TargetType="v:SplitButton">
|
||||||
<Setter Property="Height" Value="{StaticResource Height.Control}" />
|
<Setter Property="Height" Value="{StaticResource Height.Control}" />
|
||||||
|
<Setter Property="DropDownName" Value="{l:Loc Common.MoreChoices}" />
|
||||||
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
<Setter Property="FontFamily" Value="{StaticResource Font.Ui}" />
|
||||||
<Setter Property="FontSize" Value="{StaticResource Size.Body}" />
|
<Setter Property="FontSize" Value="{StaticResource Size.Body}" />
|
||||||
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
<Setter Property="ToolTipService.ShowOnDisabled" Value="True" />
|
||||||
@@ -287,7 +293,8 @@
|
|||||||
CommandTarget="{TemplateBinding CommandTarget}" />
|
CommandTarget="{TemplateBinding CommandTarget}" />
|
||||||
<ToggleButton x:Name="Arrow" Style="{DynamicResource Button.Base}" Height="{TemplateBinding Height}" Width="28" MinWidth="28" Padding="0" Margin="-1,0,0,0"
|
<ToggleButton x:Name="Arrow" Style="{DynamicResource Button.Base}" Height="{TemplateBinding Height}" Width="28" MinWidth="28" Padding="0" Margin="-1,0,0,0"
|
||||||
ClickMode="Press" ui:ControlState.CornerRadius="0,6,6,0" ui:ButtonIcon.Glyph="{DynamicResource Icon.ChevronDown}"
|
ClickMode="Press" ui:ControlState.CornerRadius="0,6,6,0" ui:ButtonIcon.Glyph="{DynamicResource Icon.ChevronDown}"
|
||||||
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" ToolTip="{TemplateBinding DropDownToolTip}" />
|
IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" ToolTip="{TemplateBinding DropDownToolTip}"
|
||||||
|
AutomationProperties.Name="{Binding DropDownName, RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ControlTemplate.Triggers>
|
<ControlTemplate.Triggers>
|
||||||
<Trigger Property="IsPrimary" Value="True">
|
<Trigger Property="IsPrimary" Value="True">
|
||||||
|
|||||||
@@ -85,6 +85,9 @@ public sealed class BarChart : DrawingElement
|
|||||||
remove => RemoveHandler(ItemActivatedEvent, value);
|
remove => RemoveHandler(ItemActivatedEvent, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected internal override string? AutomationDescription =>
|
||||||
|
Items is { Count: > 0 } items ? string.Join(Environment.NewLine, items.Select(ReadoutText)) : null;
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize)
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
{
|
{
|
||||||
var count = Items?.Count ?? 0;
|
var count = Items?.Count ?? 0;
|
||||||
@@ -166,10 +169,10 @@ public sealed class BarChart : DrawingElement
|
|||||||
double labelWidth = 0, valueWidth = 0;
|
double labelWidth = 0, valueWidth = 0;
|
||||||
for (var i = 0; i < items.Count; i++)
|
for (var i = 0; i < items.Count; i++)
|
||||||
{
|
{
|
||||||
labels[i] = CreateText(items[i].Label, LabelSize, faint);
|
labels[i] = CreateLabel(items[i].Label, LabelSize, faint);
|
||||||
labelWidth = Math.Max(labelWidth, labels[i].Width);
|
labelWidth = Math.Max(labelWidth, labels[i].Width);
|
||||||
if (!ShowValues) continue;
|
if (!ShowValues) continue;
|
||||||
values[i] = CreateText(items[i].ValueText ?? Format(items[i].Value), LabelSize, text);
|
values[i] = CreateLabel(items[i].ValueText ?? Format(items[i].Value), LabelSize, text);
|
||||||
valueWidth = Math.Max(valueWidth, values[i]!.Width);
|
valueWidth = Math.Max(valueWidth, values[i]!.Width);
|
||||||
}
|
}
|
||||||
var gridHeight = ShowGrid ? 16 : 0;
|
var gridHeight = ShowGrid ? 16 : 0;
|
||||||
@@ -184,7 +187,7 @@ public sealed class BarChart : DrawingElement
|
|||||||
{
|
{
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
var cy = _area.Top + _pitch * (i + 0.5);
|
var cy = _area.Top + _pitch * (i + 0.5);
|
||||||
dc.DrawText(labels[i], new Point(left - 8 - labels[i].Width, cy - labels[i].Height / 2));
|
DrawTextAt(dc, labels[i], new Point(left - 8 - labels[i].Width, cy - labels[i].Height / 2));
|
||||||
var length = _area.Width * Math.Clamp(item.Value / max, 0, 1);
|
var length = _area.Width * Math.Clamp(item.Value / max, 0, 1);
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
{
|
{
|
||||||
@@ -192,7 +195,7 @@ public sealed class BarChart : DrawingElement
|
|||||||
dc.DrawRoundedRectangle(GetBrush(item.BrushKey ?? BrushKey), null, new Rect(left, cy - thickness / 2, length, thickness), 2, 2);
|
dc.DrawRoundedRectangle(GetBrush(item.BrushKey ?? BrushKey), null, new Rect(left, cy - thickness / 2, length, thickness), 2, 2);
|
||||||
dc.Pop();
|
dc.Pop();
|
||||||
}
|
}
|
||||||
if (values[i] is { } value) dc.DrawText(value, new Point(left + length + 6, cy - value.Height / 2));
|
if (values[i] is { } value) DrawTextAt(dc, value, new Point(left + length + 6, cy - value.Height / 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,13 +231,13 @@ public sealed class BarChart : DrawingElement
|
|||||||
}
|
}
|
||||||
if (ShowValues && _pitch >= 24)
|
if (ShowValues && _pitch >= 24)
|
||||||
{
|
{
|
||||||
var value = CreateText(item.ValueText ?? Format(item.Value), LabelSize, text);
|
var value = CreateLabel(item.ValueText ?? Format(item.Value), LabelSize, text);
|
||||||
if (value.Width <= _pitch) dc.DrawText(value, new Point(cx - value.Width / 2, _area.Bottom - height - value.Height - 2));
|
if (value.Width <= _pitch) DrawTextAt(dc, value, new Point(cx - value.Width / 2, _area.Bottom - height - value.Height - 2));
|
||||||
}
|
}
|
||||||
var label = CreateText(item.Label, LabelSize, faint);
|
var label = CreateLabel(item.Label, LabelSize, faint);
|
||||||
var x = cx - label.Width / 2;
|
var x = cx - label.Width / 2;
|
||||||
if (x < lastLabelRight + 6) continue;
|
if (x < lastLabelRight + 6) continue;
|
||||||
dc.DrawText(label, new Point(x, _area.Bottom + 4));
|
DrawTextAt(dc, label, new Point(x, _area.Bottom + 4));
|
||||||
lastLabelRight = x + label.Width;
|
lastLabelRight = x + label.Width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
|
using System.Windows.Automation.Provider;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Titano.Core.Localization;
|
using Titano.Core.Localization;
|
||||||
@@ -23,6 +26,8 @@ public enum CurveEditMode
|
|||||||
/// sampling <see cref="Evaluator"/> once per device-pixel column, so the engine's Fritsch–Carlson spline is what
|
/// sampling <see cref="Evaluator"/> once per device-pixel column, so the engine's Fritsch–Carlson spline is what
|
||||||
/// the user sees. Grid, optional identity diagonal and a playhead are drawn; hovering or dragging a point reads
|
/// the user sees. Grid, optional identity diagonal and a playhead are drawn; hovering or dragging a point reads
|
||||||
/// out its coordinates. <see cref="EditCompletedEvent"/> fires after each add, delete, nudge or finished drag.
|
/// out its coordinates. <see cref="EditCompletedEvent"/> fires after each add, delete, nudge or finished drag.
|
||||||
|
/// Keyboard alone: focus selects the first point, PageUp/PageDown step through the points, Insert or Enter adds one
|
||||||
|
/// at the playhead, and the readout follows the selected point; screen readers hear the selected point as the value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class CurveEditor : DrawingElement
|
public sealed class CurveEditor : DrawingElement
|
||||||
{
|
{
|
||||||
@@ -37,7 +42,8 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
|
|
||||||
public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register(
|
||||||
nameof(SelectedIndex), typeof(int), typeof(CurveEditor),
|
nameof(SelectedIndex), typeof(int), typeof(CurveEditor),
|
||||||
new FrameworkPropertyMetadata(-1, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.AffectsRender, null, CoerceSelectedIndex));
|
new FrameworkPropertyMetadata(-1, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault | FrameworkPropertyMetadataOptions.AffectsRender,
|
||||||
|
(d, _) => ((CurveEditor)d).AnnounceSelection(), CoerceSelectedIndex));
|
||||||
|
|
||||||
public static readonly DependencyProperty PlayheadPositionProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty PlayheadPositionProperty = DependencyProperty.Register(
|
||||||
nameof(PlayheadPosition), typeof(double), typeof(CurveEditor), new PropertyMetadata(double.NaN, (d, _) => ((CurveEditor)d).RenderOverlay()));
|
nameof(PlayheadPosition), typeof(double), typeof(CurveEditor), new PropertyMetadata(double.NaN, (d, _) => ((CurveEditor)d).RenderOverlay()));
|
||||||
@@ -70,6 +76,7 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
private int _hover = -1;
|
private int _hover = -1;
|
||||||
private bool _dragging;
|
private bool _dragging;
|
||||||
private bool _moved;
|
private bool _moved;
|
||||||
|
private string _announced = string.Empty;
|
||||||
|
|
||||||
static CurveEditor()
|
static CurveEditor()
|
||||||
{
|
{
|
||||||
@@ -138,8 +145,15 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
_hover = -1;
|
_hover = -1;
|
||||||
CoerceValue(SelectedIndexProperty);
|
CoerceValue(SelectedIndexProperty);
|
||||||
base.OnDataChanged();
|
base.OnDataChanged();
|
||||||
|
AnnounceSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected internal override string? AutomationDescription => SelectionText;
|
||||||
|
|
||||||
|
/// <summary>"Point 2 of 4: x → y" for the selected point; empty without a selection.</summary>
|
||||||
|
internal string SelectionText =>
|
||||||
|
SelectedIndex >= 0 && SelectedIndex < _count ? Loc.L("Common.CurvePoint", SelectedIndex + 1, _count, ReadoutText(SelectedIndex)) : string.Empty;
|
||||||
|
|
||||||
protected override void OnRender(DrawingContext dc)
|
protected override void OnRender(DrawingContext dc)
|
||||||
{
|
{
|
||||||
DrawHitArea(dc);
|
DrawHitArea(dc);
|
||||||
@@ -211,7 +225,7 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
if (_dragging && SelectedIndex >= 0)
|
if (_dragging && SelectedIndex >= 0)
|
||||||
{
|
{
|
||||||
_moved |= Move(SelectedIndex, ToX(p.X), ToY(p.Y));
|
_moved |= Move(SelectedIndex, ToX(p.X), ToY(p.Y));
|
||||||
Readout.Show(ReadoutText(SelectedIndex), p);
|
Readout.Show(ReadoutText(SelectedIndex), p, FlowDirection.LeftToRight);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var hover = HitTest(p);
|
var hover = HitTest(p);
|
||||||
@@ -220,7 +234,7 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
_hover = hover;
|
_hover = hover;
|
||||||
InvalidateVisual();
|
InvalidateVisual();
|
||||||
}
|
}
|
||||||
Readout.Show(hover >= 0 ? ReadoutText(hover) : null, p);
|
Readout.Show(hover >= 0 ? ReadoutText(hover) : null, p, FlowDirection.LeftToRight);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
|
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
|
||||||
@@ -256,11 +270,42 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnGotKeyboardFocus(e);
|
||||||
|
// Tabbing in selects a point so the arrows have something to move; a click selects what it hits instead.
|
||||||
|
if (SelectedIndex < 0 && _count > 0 && InputManager.Current.MostRecentInputDevice is KeyboardDevice)
|
||||||
|
SetCurrentValue(SelectedIndexProperty, 0);
|
||||||
|
ShowSelectionReadout();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
|
||||||
|
{
|
||||||
|
base.OnLostKeyboardFocus(e);
|
||||||
|
if (!_dragging) Readout.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnKeyDown(KeyEventArgs e)
|
protected override void OnKeyDown(KeyEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnKeyDown(e);
|
base.OnKeyDown(e);
|
||||||
|
if (e.Handled) return;
|
||||||
|
if (e.Key is (Key.PageUp or Key.PageDown) && _count > 0)
|
||||||
|
{
|
||||||
|
var next = SelectedIndex < 0 ? 0 : SelectedIndex + (e.Key == Key.PageDown ? 1 : -1);
|
||||||
|
SetCurrentValue(SelectedIndexProperty, Math.Clamp(next, 0, _count - 1));
|
||||||
|
ShowSelectionReadout();
|
||||||
|
e.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (e.Key is (Key.Insert or Key.Enter) && IsEditable)
|
||||||
|
{
|
||||||
|
AddFromKeyboard();
|
||||||
|
ShowSelectionReadout();
|
||||||
|
e.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
var index = SelectedIndex;
|
var index = SelectedIndex;
|
||||||
if (e.Handled || index < 0 || index >= _count || !IsEditable) return;
|
if (index < 0 || index >= _count || !IsEditable) return;
|
||||||
var step = (Keyboard.Modifiers & ModifierKeys.Shift) != 0 ? 0.1 : 0.01;
|
var step = (Keyboard.Modifiers & ModifierKeys.Shift) != 0 ? 0.1 : 0.01;
|
||||||
var changed = e.Key switch
|
var changed = e.Key switch
|
||||||
{
|
{
|
||||||
@@ -273,9 +318,12 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
};
|
};
|
||||||
if (changed is null) return;
|
if (changed is null) return;
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
ShowSelectionReadout();
|
||||||
if (changed.Value) RaiseEvent(new RoutedEventArgs(EditCompletedEvent));
|
if (changed.Value) RaiseEvent(new RoutedEventArgs(EditCompletedEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override AutomationPeer OnCreateAutomationPeer() => new CurveEditorAutomationPeer(this);
|
||||||
|
|
||||||
private static object CoerceSelectedIndex(DependencyObject d, object value)
|
private static object CoerceSelectedIndex(DependencyObject d, object value)
|
||||||
{
|
{
|
||||||
var index = (int)value;
|
var index = (int)value;
|
||||||
@@ -341,18 +389,45 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Add(Point at)
|
private void Add(Point at) => AddAt(ToX(at.X), ToY(at.Y));
|
||||||
|
|
||||||
|
/// <summary>A new point on the curve as it is drawn now, at the playhead or in the gap after the selection.</summary>
|
||||||
|
private void AddFromKeyboard()
|
||||||
|
{
|
||||||
|
var xs = _xs.AsSpan(0, _count);
|
||||||
|
var x = CurveMath.KeyboardInsertionX(xs, SelectedIndex, PlayheadPosition, MinimumGap, PinEnds);
|
||||||
|
AddAt(x, Evaluator?.Invoke(x) ?? CurveMath.Interpolate(xs, _ys.AsSpan(0, _count), x));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddAt(double x, double y)
|
||||||
{
|
{
|
||||||
if (Points is not { IsReadOnly: false } points) return;
|
if (Points is not { IsReadOnly: false } points) return;
|
||||||
var x = ToX(at.X);
|
|
||||||
var index = CurveMath.InsertionIndex(_xs.AsSpan(0, _count), x, MinimumGap, PinEnds);
|
var index = CurveMath.InsertionIndex(_xs.AsSpan(0, _count), x, MinimumGap, PinEnds);
|
||||||
if (index < 0) return;
|
if (index < 0) return;
|
||||||
points.Insert(index, new Point(x, CurveMath.ConstrainY(ToY(at.Y))));
|
points.Insert(index, new Point(x, CurveMath.ConstrainY(y)));
|
||||||
AfterEdit(points);
|
AfterEdit(points);
|
||||||
SetCurrentValue(SelectedIndexProperty, index);
|
SetCurrentValue(SelectedIndexProperty, index);
|
||||||
RaiseEvent(new RoutedEventArgs(EditCompletedEvent));
|
RaiseEvent(new RoutedEventArgs(EditCompletedEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Tells screen readers about a new selection or a moved point (the peer's value).</summary>
|
||||||
|
private void AnnounceSelection()
|
||||||
|
{
|
||||||
|
var text = SelectionText;
|
||||||
|
if (text == _announced) return;
|
||||||
|
var previous = _announced;
|
||||||
|
_announced = text;
|
||||||
|
UIElementAutomationPeer.FromElement(this)?.RaisePropertyChangedEvent(ValuePatternIdentifiers.ValueProperty, previous, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>The coordinate readout next to the selected point, for keyboard edits.</summary>
|
||||||
|
private void ShowSelectionReadout()
|
||||||
|
{
|
||||||
|
var index = SelectedIndex;
|
||||||
|
if (!IsKeyboardFocused || index < 0 || index >= _count || _plot.Width < 1) return;
|
||||||
|
Readout.Show(ReadoutText(index), new Point(X(_xs[index]), Y(_ys[index])), FlowDirection.LeftToRight);
|
||||||
|
}
|
||||||
|
|
||||||
private bool Remove(int index)
|
private bool Remove(int index)
|
||||||
{
|
{
|
||||||
if (Points is not { IsReadOnly: false } points || !CurveMath.CanRemove(_count, index, PinEnds)) return false;
|
if (Points is not { IsReadOnly: false } points || !CurveMath.CanRemove(_count, index, PinEnds)) return false;
|
||||||
@@ -372,8 +447,25 @@ public sealed class CurveEditor : DrawingElement
|
|||||||
{
|
{
|
||||||
var x = XLabelFormatter ?? DefaultFormat;
|
var x = XLabelFormatter ?? DefaultFormat;
|
||||||
var y = YLabelFormatter ?? DefaultFormat;
|
var y = YLabelFormatter ?? DefaultFormat;
|
||||||
return x(_xs[index]) + " → " + y(_ys[index]);
|
return Loc.L("Common.CurveReadout", x(_xs[index]), y(_ys[index]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string DefaultFormat(double value) => value.ToString("0.###", Loc.Culture);
|
private static string DefaultFormat(double value) => value.ToString("0.###", Loc.Culture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>The curve editor seen by UI Automation: its value reads the selected point ("Point 2 of 4: 0:12 → 0:30").</summary>
|
||||||
|
public sealed class CurveEditorAutomationPeer(CurveEditor owner) : DrawingElementAutomationPeer(owner), IValueProvider
|
||||||
|
{
|
||||||
|
public string Value => ((CurveEditor)Owner).SelectionText;
|
||||||
|
|
||||||
|
public bool IsReadOnly => true;
|
||||||
|
|
||||||
|
public void SetValue(string value) => throw new InvalidOperationException("The curve is edited with the arrow keys, not by text.");
|
||||||
|
|
||||||
|
public override object? GetPattern(PatternInterface patternInterface) =>
|
||||||
|
patternInterface == PatternInterface.Value ? this : base.GetPattern(patternInterface);
|
||||||
|
|
||||||
|
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Custom;
|
||||||
|
|
||||||
|
protected override string GetLocalizedControlTypeCore() => Loc.L("Common.Curve");
|
||||||
|
}
|
||||||
@@ -51,6 +51,34 @@ public static class CurveMath
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// X of a point added from the keyboard: the playhead when a point fits there, otherwise the middle of the gap
|
||||||
|
/// after point <paramref name="selected"/> (before it for the last point; 0.5 on an empty curve).
|
||||||
|
/// </summary>
|
||||||
|
public static double KeyboardInsertionX(ReadOnlySpan<double> xs, int selected, double playhead, double minGap, bool pinEnds)
|
||||||
|
{
|
||||||
|
if (double.IsFinite(playhead) && InsertionIndex(xs, playhead, minGap, pinEnds) >= 0) return playhead;
|
||||||
|
if (xs.Length == 0) return 0.5;
|
||||||
|
if (xs.Length == 1) return xs[0] < 0.5 ? (xs[0] + 1) / 2 : xs[0] / 2;
|
||||||
|
var i = Math.Clamp(selected, 0, xs.Length - 2);
|
||||||
|
return (xs[i] + xs[i + 1]) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Y at <paramref name="x"/> on the straight segments through the points, flat beyond the ends; the identity without points.</summary>
|
||||||
|
public static double Interpolate(ReadOnlySpan<double> xs, ReadOnlySpan<double> ys, double x)
|
||||||
|
{
|
||||||
|
var n = Math.Min(xs.Length, ys.Length);
|
||||||
|
if (n == 0) return x;
|
||||||
|
if (x <= xs[0]) return ys[0];
|
||||||
|
for (var i = 1; i < n; i++)
|
||||||
|
{
|
||||||
|
if (x > xs[i]) continue;
|
||||||
|
var span = xs[i] - xs[i - 1];
|
||||||
|
return span > 0 ? ys[i - 1] + (x - xs[i - 1]) / span * (ys[i] - ys[i - 1]) : ys[i];
|
||||||
|
}
|
||||||
|
return ys[n - 1];
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Whether point <paramref name="index"/> may be deleted: two points always remain and pinned ends stay.</summary>
|
/// <summary>Whether point <paramref name="index"/> may be deleted: two points always remain and pinned ends stay.</summary>
|
||||||
public static bool CanRemove(int count, int index, bool pinEnds) =>
|
public static bool CanRemove(int count, int index, bool pinEnds) =>
|
||||||
count > 2 && index >= 0 && index < count && (!pinEnds || (index > 0 && index < count - 1));
|
count > 2 && index >= 0 && index < count && (!pinEnds || (index > 0 && index < count - 1));
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Titano.Core.Localization;
|
using Titano.Core.Localization;
|
||||||
|
using Titano.Ui.Controls;
|
||||||
|
|
||||||
namespace Titano.Ui.Visuals;
|
namespace Titano.Ui.Visuals;
|
||||||
|
|
||||||
@@ -10,7 +12,9 @@ namespace Titano.Ui.Visuals;
|
|||||||
/// Base of the retained-mode visuals. Brushes are looked up by theme resource key and re-resolved when the token
|
/// Base of the retained-mode visuals. Brushes are looked up by theme resource key and re-resolved when the token
|
||||||
/// dictionary is swapped (frozen pens are cached per theme); text is laid out with the UI font at the element's
|
/// dictionary is swapped (frozen pens are cached per theme); text is laid out with the UI font at the element's
|
||||||
/// DPI; an optional overlay layer (playhead, hover) is redrawn without re-rendering the static content drawn in
|
/// DPI; an optional overlay layer (playhead, hover) is redrawn without re-rendering the static content drawn in
|
||||||
/// <see cref="UIElement.OnRender"/>. Time axes and images never mirror, so the element is always left-to-right.
|
/// <see cref="UIElement.OnRender"/>. Time axes and images never mirror, so the element is always left-to-right;
|
||||||
|
/// words (categories, legends, summaries) still read in the UI language's direction (<see cref="CreateLabel"/>) and
|
||||||
|
/// legends start on its side. Screen readers see a named image (<see cref="DrawingElementAutomationPeer"/>).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class DrawingElement : FrameworkElement
|
public abstract class DrawingElement : FrameworkElement
|
||||||
{
|
{
|
||||||
@@ -91,13 +95,29 @@ public abstract class DrawingElement : FrameworkElement
|
|||||||
/// <summary>Pen covering whole device pixels, for gridlines and edges drawn at <see cref="PixelGrid.SnapLine"/> positions.</summary>
|
/// <summary>Pen covering whole device pixels, for gridlines and edges drawn at <see cref="PixelGrid.SnapLine"/> positions.</summary>
|
||||||
protected Pen GetHairline(string key, LineDash dash = LineDash.Solid) => GetPen(key, PixelGrid.SnapThickness(1, PixelScale), dash);
|
protected Pen GetHairline(string key, LineDash dash = LineDash.Solid) => GetPen(key, PixelGrid.SnapThickness(1, PixelScale), dash);
|
||||||
|
|
||||||
/// <summary>Single-line text in the UI font, laid out for this element's DPI and text formatting mode.</summary>
|
/// <summary>
|
||||||
protected FormattedText CreateText(string text, double emSize, Brush brush, bool semiBold = false)
|
/// Text a screen reader hears for the visual when no AutomationProperties.Name is set (its summary, its values);
|
||||||
{
|
/// null leaves the image unnamed.
|
||||||
var typeface = semiBold ? _semiBold ??= CreateTypeface(FontWeights.SemiBold) : _regular ??= CreateTypeface(FontWeights.Normal);
|
/// </summary>
|
||||||
return new FormattedText(text, Loc.Culture, FlowDirection.LeftToRight, typeface, emSize, brush, null,
|
protected internal virtual string? AutomationDescription => null;
|
||||||
TextOptions.GetTextFormattingMode(this), VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
|
||||||
}
|
/// <summary>Single-line left-to-right text in the UI font (numbers, ticks, times), laid out for this element's DPI and text formatting mode.</summary>
|
||||||
|
protected FormattedText CreateText(string text, double emSize, Brush brush, bool semiBold = false) =>
|
||||||
|
Format(text, emSize, brush, semiBold, FlowDirection.LeftToRight);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Single-line words (category, legend, summary) in the reading order of the UI language, so right-to-left text
|
||||||
|
/// mixed with numbers or Latin units keeps its order. Place it with <see cref="DrawTextAt"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected FormattedText CreateLabel(string text, double emSize, Brush brush, bool semiBold = false) =>
|
||||||
|
Format(text, emSize, brush, semiBold, Bidi.UiDirection);
|
||||||
|
|
||||||
|
/// <summary>Draws <paramref name="text"/> with its top-left corner at <paramref name="topLeft"/>; right-to-left text is laid out leftwards from its origin.</summary>
|
||||||
|
protected static void DrawTextAt(DrawingContext dc, FormattedText text, Point topLeft) =>
|
||||||
|
dc.DrawText(text, text.FlowDirection == FlowDirection.RightToLeft ? new Point(topLeft.X + text.Width, topLeft.Y) : topLeft);
|
||||||
|
|
||||||
|
/// <summary>Position of a <paramref name="width"/>-wide box laid out from the left within [0, <paramref name="extent"/>], mirrored in a right-to-left UI.</summary>
|
||||||
|
protected static double FromStart(double x, double width, double extent) => Loc.IsRightToLeft ? extent - x - width : x;
|
||||||
|
|
||||||
/// <summary>Redraws the overlay layer; call after any change that only affects playhead or hover state.</summary>
|
/// <summary>Redraws the overlay layer; call after any change that only affects playhead or hover state.</summary>
|
||||||
protected void RenderOverlay()
|
protected void RenderOverlay()
|
||||||
@@ -165,25 +185,24 @@ public abstract class DrawingElement : FrameworkElement
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Draws legend entries left to right from <paramref name="origin"/> (swatch, 6 px, text in the entry colour,
|
/// Draws legend entries in reading order from the start side of [<paramref name="left"/>, <paramref name="right"/>]
|
||||||
/// 16 px between entries) and stops before <paramref name="maxRight"/>. Returns the right edge reached.
|
/// (swatch, 6 px, text in the entry colour, 16 px between entries); entries that do not fit are left out.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected double DrawLegend(DrawingContext dc, IReadOnlyList<ChartLegendItem> items, Point origin, double maxRight, double emSize)
|
protected void DrawLegend(DrawingContext dc, IReadOnlyList<ChartLegendItem> items, double left, double right, double top, double emSize)
|
||||||
{
|
{
|
||||||
var x = origin.X;
|
var offset = 0.0;
|
||||||
for (var i = 0; i < items.Count; i++)
|
for (var i = 0; i < items.Count; i++)
|
||||||
{
|
{
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
var brush = GetBrush(item.BrushKey);
|
var text = CreateLabel(item.Text, emSize, GetBrush(item.BrushKey));
|
||||||
var text = CreateText(item.Text, emSize, brush);
|
|
||||||
var width = 16 + 6 + text.Width;
|
var width = 16 + 6 + text.Width;
|
||||||
if (x + width > maxRight) break;
|
if (left + offset + width > right) break;
|
||||||
var cy = origin.Y + text.Height / 2;
|
var cy = top + text.Height / 2;
|
||||||
DrawSwatch(dc, item.Swatch, item.BrushKey, new Rect(x, cy - 5, 16, 10));
|
var extent = right - left;
|
||||||
dc.DrawText(text, new Point(x + 22, origin.Y));
|
DrawSwatch(dc, item.Swatch, item.BrushKey, new Rect(left + FromStart(offset, 16, extent), cy - 5, 16, 10));
|
||||||
x += width + 16;
|
DrawTextAt(dc, text, new Point(left + FromStart(offset + 22, text.Width, extent), top));
|
||||||
|
offset += width + 16;
|
||||||
}
|
}
|
||||||
return x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Draws a legend swatch centred in <paramref name="box"/>.</summary>
|
/// <summary>Draws a legend swatch centred in <paramref name="box"/>.</summary>
|
||||||
@@ -235,8 +254,31 @@ public abstract class DrawingElement : FrameworkElement
|
|||||||
element.OnThemeChanged();
|
element.OnThemeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override AutomationPeer OnCreateAutomationPeer() => new DrawingElementAutomationPeer(this);
|
||||||
|
|
||||||
|
private FormattedText Format(string text, double emSize, Brush brush, bool semiBold, FlowDirection direction)
|
||||||
|
{
|
||||||
|
var typeface = semiBold ? _semiBold ??= CreateTypeface(FontWeights.SemiBold) : _regular ??= CreateTypeface(FontWeights.Normal);
|
||||||
|
return new FormattedText(text, Loc.Culture, direction, typeface, emSize, brush, null,
|
||||||
|
TextOptions.GetTextFormattingMode(this), VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||||
|
}
|
||||||
|
|
||||||
private Typeface CreateTypeface(FontWeight weight) =>
|
private Typeface CreateTypeface(FontWeight weight) =>
|
||||||
new(TryFindResource("Font.Ui") as FontFamily ?? SystemFonts.MessageFontFamily, FontStyles.Normal, weight, FontStretches.Normal);
|
new(TryFindResource("Font.Ui") as FontFamily ?? SystemFonts.MessageFontFamily, FontStyles.Normal, weight, FontStretches.Normal);
|
||||||
|
|
||||||
private void OnWatchedCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) => OnDataChanged();
|
private void OnWatchedCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) => OnDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>A chart seen by UI Automation: an image named by AutomationProperties.Name or, failing that, by its description.</summary>
|
||||||
|
public class DrawingElementAutomationPeer(DrawingElement owner) : FrameworkElementAutomationPeer(owner)
|
||||||
|
{
|
||||||
|
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Image;
|
||||||
|
|
||||||
|
protected override string GetClassNameCore() => Owner.GetType().Name;
|
||||||
|
|
||||||
|
protected override string GetNameCore()
|
||||||
|
{
|
||||||
|
var name = base.GetNameCore();
|
||||||
|
return string.IsNullOrEmpty(name) ? ((DrawingElement)Owner).AutomationDescription ?? string.Empty : name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
|
using System.Windows.Automation.Provider;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Titano.Core.Diagnostics;
|
using Titano.Core.Diagnostics;
|
||||||
@@ -11,7 +14,8 @@ namespace Titano.Ui.Visuals;
|
|||||||
/// (exposure steps ▼ in Sun/Warning, keyframes ◆ in Accent). The cell holding <see cref="CurrentIndex"/> is outlined
|
/// (exposure steps ▼ in Sun/Warning, keyframes ◆ in Accent). The cell holding <see cref="CurrentIndex"/> is outlined
|
||||||
/// in Accent and an accent ▼ marks the exact frame. Click or drag seeks, the wheel and arrow keys step one frame
|
/// in Accent and an accent ▼ marks the exact frame. Click or drag seeks, the wheel and arrow keys step one frame
|
||||||
/// (PageUp/PageDown one cell, Home/End the ends). Thumbnails load asynchronously from <see cref="Source"/> into an
|
/// (PageUp/PageDown one cell, Home/End the ends). Thumbnails load asynchronously from <see cref="Source"/> into an
|
||||||
/// LRU cache; cells show a placeholder until their image arrives. Hovering a marker reads out its label.
|
/// LRU cache; cells show a placeholder until their image arrives. Hovering a marker reads out its label. Screen
|
||||||
|
/// readers see a slider over the frame index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Filmstrip : DrawingElement
|
public sealed class Filmstrip : DrawingElement
|
||||||
{
|
{
|
||||||
@@ -77,7 +81,10 @@ public sealed class Filmstrip : DrawingElement
|
|||||||
/// <summary>Decoded thumbnails kept in memory.</summary>
|
/// <summary>Decoded thumbnails kept in memory.</summary>
|
||||||
public int CacheCapacity { get => (int)GetValue(CacheCapacityProperty); set => SetValue(CacheCapacityProperty, value); }
|
public int CacheCapacity { get => (int)GetValue(CacheCapacityProperty); set => SetValue(CacheCapacityProperty, value); }
|
||||||
|
|
||||||
private int FrameCount => Source?.Count ?? 0;
|
internal int FrameCount => Source?.Count ?? 0;
|
||||||
|
|
||||||
|
/// <summary>Frames per thumbnail cell: the PageUp/PageDown step.</summary>
|
||||||
|
internal int CellFrames => Math.Max(1, FrameCount / Math.Max(1, _strip.CellCount));
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize) => new(0, MarkerRow + 3 + CellHeight);
|
protected override Size MeasureOverride(Size availableSize) => new(0, MarkerRow + 3 + CellHeight);
|
||||||
|
|
||||||
@@ -188,7 +195,7 @@ public sealed class Filmstrip : DrawingElement
|
|||||||
base.OnKeyDown(e);
|
base.OnKeyDown(e);
|
||||||
var count = FrameCount;
|
var count = FrameCount;
|
||||||
if (count == 0) return;
|
if (count == 0) return;
|
||||||
var cellFrames = Math.Max(1, count / Math.Max(1, _strip.CellCount));
|
var cellFrames = CellFrames;
|
||||||
int? target = e.Key switch
|
int? target = e.Key switch
|
||||||
{
|
{
|
||||||
Key.Left => CurrentIndex - 1,
|
Key.Left => CurrentIndex - 1,
|
||||||
@@ -212,7 +219,14 @@ public sealed class Filmstrip : DrawingElement
|
|||||||
strip.InvalidateVisual();
|
strip.InvalidateVisual();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnCurrentIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) => ((Filmstrip)d).RenderOverlay();
|
protected override AutomationPeer OnCreateAutomationPeer() => new FilmstripAutomationPeer(this);
|
||||||
|
|
||||||
|
private static void OnCurrentIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var strip = (Filmstrip)d;
|
||||||
|
strip.RenderOverlay();
|
||||||
|
UIElementAutomationPeer.FromElement(strip)?.RaisePropertyChangedEvent(RangeValuePatternIdentifiers.ValueProperty, (double)(int)e.OldValue, (double)(int)e.NewValue);
|
||||||
|
}
|
||||||
|
|
||||||
private static object CoerceCurrentIndex(DependencyObject d, object value)
|
private static object CoerceCurrentIndex(DependencyObject d, object value)
|
||||||
{
|
{
|
||||||
@@ -347,3 +361,32 @@ public sealed class Filmstrip : DrawingElement
|
|||||||
|
|
||||||
private readonly record struct CachedFrame(ImageSource Image, int PixelWidth);
|
private readonly record struct CachedFrame(ImageSource Image, int PixelWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>The filmstrip seen by UI Automation: a slider whose value is the current frame (0-based).</summary>
|
||||||
|
public sealed class FilmstripAutomationPeer(Filmstrip owner) : DrawingElementAutomationPeer(owner), IRangeValueProvider
|
||||||
|
{
|
||||||
|
private Filmstrip Strip => (Filmstrip)Owner;
|
||||||
|
|
||||||
|
public double Value => Strip.CurrentIndex;
|
||||||
|
|
||||||
|
public double Minimum => 0;
|
||||||
|
|
||||||
|
public double Maximum => Math.Max(0, Strip.FrameCount - 1);
|
||||||
|
|
||||||
|
public double SmallChange => 1;
|
||||||
|
|
||||||
|
public double LargeChange => Strip.CellFrames;
|
||||||
|
|
||||||
|
public bool IsReadOnly => !IsEnabled();
|
||||||
|
|
||||||
|
public void SetValue(double value)
|
||||||
|
{
|
||||||
|
if (!IsEnabled()) throw new ElementNotEnabledException();
|
||||||
|
Strip.SetCurrentValue(Filmstrip.CurrentIndexProperty, (int)Math.Round(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object? GetPattern(PatternInterface patternInterface) =>
|
||||||
|
patternInterface == PatternInterface.RangeValue ? this : base.GetPattern(patternInterface);
|
||||||
|
|
||||||
|
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Slider;
|
||||||
|
}
|
||||||
@@ -114,9 +114,9 @@ public sealed class HeatmapStrip : DrawingElement
|
|||||||
{
|
{
|
||||||
for (var c = 0; c < columns.Count; c++)
|
for (var c = 0; c < columns.Count; c++)
|
||||||
{
|
{
|
||||||
var label = CreateText(columns[c], LabelSize, faint);
|
var label = CreateLabel(columns[c], LabelSize, faint);
|
||||||
var (x, _) = _grid.CellOrigin(0, c);
|
var (x, _) = _grid.CellOrigin(0, c);
|
||||||
dc.DrawText(label, new Point(x + (_grid.CellSize - label.Width) / 2, 0));
|
DrawTextAt(dc, label, new Point(x + (_grid.CellSize - label.Width) / 2, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,9 +126,9 @@ public sealed class HeatmapStrip : DrawingElement
|
|||||||
for (var r = 0; r < rows.Count; r++)
|
for (var r = 0; r < rows.Count; r++)
|
||||||
{
|
{
|
||||||
var row = rows[r];
|
var row = rows[r];
|
||||||
var label = CreateText(row.Label, LabelSize, faint);
|
var label = CreateLabel(row.Label, LabelSize, faint);
|
||||||
var (_, y) = _grid.CellOrigin(r, 0);
|
var (_, y) = _grid.CellOrigin(r, 0);
|
||||||
dc.DrawText(label, new Point(_grid.Left - 8 - label.Width, y + (_grid.CellSize - label.Height) / 2));
|
DrawTextAt(dc, label, new Point(_grid.Left - 8 - label.Width, y + (_grid.CellSize - label.Height) / 2));
|
||||||
for (var c = 0; c < _grid.Columns; c++)
|
for (var c = 0; c < _grid.Columns; c++)
|
||||||
{
|
{
|
||||||
var (x, _) = _grid.CellOrigin(r, c);
|
var (x, _) = _grid.CellOrigin(r, c);
|
||||||
@@ -192,7 +192,7 @@ public sealed class HeatmapStrip : DrawingElement
|
|||||||
var faint = Brushes.Transparent;
|
var faint = Brushes.Transparent;
|
||||||
var labelWidth = 0.0;
|
var labelWidth = 0.0;
|
||||||
if (Rows is { } rows)
|
if (Rows is { } rows)
|
||||||
for (var r = 0; r < rows.Count; r++) labelWidth = Math.Max(labelWidth, CreateText(rows[r].Label, LabelSize, faint).Width);
|
for (var r = 0; r < rows.Count; r++) labelWidth = Math.Max(labelWidth, CreateLabel(rows[r].Label, LabelSize, faint).Width);
|
||||||
var left = Math.Ceiling(labelWidth) + 8;
|
var left = Math.Ceiling(labelWidth) + 8;
|
||||||
var top = ColumnLabels is { Count: > 0 } ? LabelHeight() + 4 : 0;
|
var top = ColumnLabels is { Count: > 0 } ? LabelHeight() + 4 : 0;
|
||||||
var cell = CellGridLayout.FitCellSize(width - left, height - top, RowCount, ColumnCount, CellGap, MaxCellSize);
|
var cell = CellGridLayout.FitCellSize(width - left, height - top, RowCount, ColumnCount, CellGap, MaxCellSize);
|
||||||
|
|||||||
@@ -1,36 +1,51 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
|
using Titano.Ui.Controls;
|
||||||
|
|
||||||
namespace Titano.Ui.Visuals;
|
namespace Titano.Ui.Visuals;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A tooltip (same style as every other) that opens at once and follows the mouse to read out the value under
|
/// A tooltip (same style as every other) that opens at once and follows the mouse to read out the value under
|
||||||
/// the cursor. While it shows, the owner's own tooltip (which describes the action) is suppressed.
|
/// the cursor. While it shows, the owner's own tooltip (which describes the action) is suppressed. The text reads in
|
||||||
|
/// the UI language's direction unless the caller pins a numeric readout left to right.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class HoverReadout(FrameworkElement owner)
|
public sealed class HoverReadout(FrameworkElement owner)
|
||||||
{
|
{
|
||||||
private ToolTip? _tip;
|
private ToolTip? _tip;
|
||||||
|
private TextBlock? _text;
|
||||||
private object? _savedEnabled;
|
private object? _savedEnabled;
|
||||||
|
|
||||||
public bool IsOpen => _tip?.IsOpen == true;
|
public bool IsOpen => _tip?.IsOpen == true;
|
||||||
|
|
||||||
/// <summary>Shows <paramref name="text"/> next to <paramref name="position"/> (owner coordinates); empty text hides the readout.</summary>
|
/// <summary>
|
||||||
public void Show(string? text, Point position)
|
/// Shows <paramref name="text"/> next to <paramref name="position"/> (owner coordinates); empty text hides the
|
||||||
|
/// readout. <paramref name="direction"/> defaults to the UI language's.
|
||||||
|
/// </summary>
|
||||||
|
public void Show(string? text, Point position, FlowDirection? direction = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(text))
|
if (string.IsNullOrEmpty(text))
|
||||||
{
|
{
|
||||||
Hide();
|
Hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_tip ??= new ToolTip
|
if (_tip is null)
|
||||||
{
|
{
|
||||||
Placement = PlacementMode.Relative,
|
// The tip keeps the owner's direction so its placement offsets stay the owner's; only the text inside reads
|
||||||
PlacementTarget = owner,
|
// right to left. The content is explicit, so the tooltip style's text settings are repeated here.
|
||||||
IsHitTestVisible = false,
|
_text = new TextBlock { TextWrapping = TextWrapping.Wrap, LineHeight = 16 };
|
||||||
Focusable = false,
|
_tip = new ToolTip
|
||||||
};
|
{
|
||||||
if (!Equals(_tip.Content, text)) _tip.Content = text;
|
Placement = PlacementMode.Relative,
|
||||||
|
PlacementTarget = owner,
|
||||||
|
IsHitTestVisible = false,
|
||||||
|
Focusable = false,
|
||||||
|
FlowDirection = owner.FlowDirection,
|
||||||
|
Content = _text,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
_text!.FlowDirection = direction ?? Bidi.UiDirection;
|
||||||
|
if (_text.Text != text) _text.Text = text;
|
||||||
// Below-right of the cursor so the popup never sits under the mouse (which would end the hover).
|
// Below-right of the cursor so the popup never sits under the mouse (which would end the hover).
|
||||||
_tip.HorizontalOffset = position.X + 12;
|
_tip.HorizontalOffset = position.X + 12;
|
||||||
_tip.VerticalOffset = position.Y + 18;
|
_tip.VerticalOffset = position.Y + 18;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace Titano.Ui.Visuals;
|
namespace Titano.Ui.Visuals;
|
||||||
@@ -50,6 +51,9 @@ public sealed class PreviewSurface : DrawingElement
|
|||||||
|
|
||||||
protected override Visual GetVisualChild(int index) => _layers[index];
|
protected override Visual GetVisualChild(int index) => _layers[index];
|
||||||
|
|
||||||
|
/// <summary>The viewport is the image screen readers see; the surface adds nothing to it.</summary>
|
||||||
|
protected override AutomationPeer OnCreateAutomationPeer() => null!;
|
||||||
|
|
||||||
/// <summary>Redraws both images over the image rectangle [0, size].</summary>
|
/// <summary>Redraws both images over the image rectangle [0, size].</summary>
|
||||||
internal void SetImages(ImageSource? corrected, ImageSource? original, Size imageSize)
|
internal void SetImages(ImageSource? corrected, ImageSource? original, Size imageSize)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using Titano.Core.Localization;
|
||||||
|
|
||||||
namespace Titano.Ui.Visuals;
|
namespace Titano.Ui.Visuals;
|
||||||
|
|
||||||
@@ -39,7 +41,8 @@ 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
|
/// 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
|
/// 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
|
/// 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.
|
/// 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TemplatePart(Name = PartSurface, Type = typeof(FrameworkElement))]
|
[TemplatePart(Name = PartSurface, Type = typeof(FrameworkElement))]
|
||||||
[TemplatePart(Name = PartTools, Type = typeof(FrameworkElement))]
|
[TemplatePart(Name = PartTools, Type = typeof(FrameworkElement))]
|
||||||
@@ -298,6 +301,8 @@ public class PreviewViewport : Control
|
|||||||
ApplyZoomMode();
|
ApplyZoomMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override AutomationPeer OnCreateAutomationPeer() => new PreviewViewportAutomationPeer(this);
|
||||||
|
|
||||||
private static object CoerceUnit(DependencyObject d, object value) => double.IsNaN((double)value) ? 0.5 : Math.Clamp((double)value, 0, 1);
|
private static object CoerceUnit(DependencyObject d, object value) => double.IsNaN((double)value) ? 0.5 : Math.Clamp((double)value, 0, 1);
|
||||||
|
|
||||||
private static object CoerceZoom(DependencyObject d, object value) =>
|
private static object CoerceZoom(DependencyObject d, object value) =>
|
||||||
@@ -411,3 +416,23 @@ public class PreviewViewport : Control
|
|||||||
return !_imageSize.IsEmpty && (_imageSize.Width * _view.Scale > view.Width + 0.5 || _imageSize.Height * _view.Scale > view.Height + 0.5);
|
return !_imageSize.IsEmpty && (_imageSize.Width * _view.Scale > view.Width + 0.5 || _imageSize.Height * _view.Scale > view.Height + 0.5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>The preview seen by UI Automation: an image whose status gives the zoom ("50 %") and whose help text is the shot data.</summary>
|
||||||
|
public sealed class PreviewViewportAutomationPeer(PreviewViewport owner) : FrameworkElementAutomationPeer(owner)
|
||||||
|
{
|
||||||
|
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Image;
|
||||||
|
|
||||||
|
protected override string GetClassNameCore() => nameof(PreviewViewport);
|
||||||
|
|
||||||
|
protected override string GetItemStatusCore()
|
||||||
|
{
|
||||||
|
var viewport = (PreviewViewport)Owner;
|
||||||
|
return viewport.ImageSize.IsEmpty ? string.Empty : Loc.L("Common.Percent", Math.Round(viewport.Zoom * 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string GetHelpTextCore()
|
||||||
|
{
|
||||||
|
var help = base.GetHelpTextCore();
|
||||||
|
return string.IsNullOrEmpty(help) ? ((PreviewViewport)Owner).InfoText ?? string.Empty : help;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -86,7 +86,7 @@ public sealed class SeriesChart : DrawingElement
|
|||||||
/// <summary>Explicit legend entries; null lists the titled series.</summary>
|
/// <summary>Explicit legend entries; null lists the titled series.</summary>
|
||||||
public IReadOnlyList<ChartLegendItem>? Legend { get => (IReadOnlyList<ChartLegendItem>?)GetValue(LegendProperty); set => SetValue(LegendProperty, value); }
|
public IReadOnlyList<ChartLegendItem>? Legend { get => (IReadOnlyList<ChartLegendItem>?)GetValue(LegendProperty); set => SetValue(LegendProperty, value); }
|
||||||
|
|
||||||
/// <summary>Right-aligned text of the legend row (e.g. "flicker −67 % · max step 0.21 EV").</summary>
|
/// <summary>Text closing the legend row, at its end side (e.g. "flicker −67 % · max step 0.21 EV").</summary>
|
||||||
public string? Summary { get => (string?)GetValue(SummaryProperty); set => SetValue(SummaryProperty, value); }
|
public string? Summary { get => (string?)GetValue(SummaryProperty); set => SetValue(SummaryProperty, value); }
|
||||||
|
|
||||||
public bool ShowLegend { get => (bool)GetValue(ShowLegendProperty); set => SetValue(ShowLegendProperty, value); }
|
public bool ShowLegend { get => (bool)GetValue(ShowLegendProperty); set => SetValue(ShowLegendProperty, value); }
|
||||||
@@ -114,6 +114,8 @@ public sealed class SeriesChart : DrawingElement
|
|||||||
/// <summary>Formatting of frame indices (readout header and, when set, X axis labels).</summary>
|
/// <summary>Formatting of frame indices (readout header and, when set, X axis labels).</summary>
|
||||||
public Func<double, string>? XLabelFormatter { get => (Func<double, string>?)GetValue(XLabelFormatterProperty); set => SetValue(XLabelFormatterProperty, value); }
|
public Func<double, string>? XLabelFormatter { get => (Func<double, string>?)GetValue(XLabelFormatterProperty); set => SetValue(XLabelFormatterProperty, value); }
|
||||||
|
|
||||||
|
protected internal override string? AutomationDescription => Summary;
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize) => new(0, 160);
|
protected override Size MeasureOverride(Size availableSize) => new(0, 160);
|
||||||
|
|
||||||
protected override void OnDataChanged()
|
protected override void OnDataChanged()
|
||||||
@@ -290,15 +292,16 @@ public sealed class SeriesChart : DrawingElement
|
|||||||
{
|
{
|
||||||
var items = Legend ?? AutoLegend();
|
var items = Legend ?? AutoLegend();
|
||||||
if (items.Count == 0 && string.IsNullOrEmpty(Summary)) return 0;
|
if (items.Count == 0 && string.IsNullOrEmpty(Summary)) return 0;
|
||||||
var right = width;
|
double left = 0, right = width;
|
||||||
if (!string.IsNullOrEmpty(Summary))
|
if (!string.IsNullOrEmpty(Summary))
|
||||||
{
|
{
|
||||||
var summary = CreateText(Summary, LabelSize, GetBrush("Brush.TextMuted"));
|
var summary = CreateLabel(Summary, LabelSize, GetBrush("Brush.TextMuted"));
|
||||||
right -= summary.Width;
|
var x = FromStart(width - summary.Width, summary.Width, width);
|
||||||
dc.DrawText(summary, new Point(right, 0));
|
DrawTextAt(dc, summary, new Point(x, 0));
|
||||||
right -= 16;
|
if (Loc.IsRightToLeft) left = summary.Width + 16;
|
||||||
|
else right = x - 16;
|
||||||
}
|
}
|
||||||
DrawLegend(dc, items, new Point(0, 0), right, LabelSize);
|
DrawLegend(dc, items, left, right, 0, LabelSize);
|
||||||
return LegendHeight;
|
return LegendHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
|
using System.Windows.Automation.Provider;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Controls.Primitives;
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
@@ -12,7 +15,9 @@ namespace Titano.Ui.Visuals;
|
|||||||
/// The main part executes <see cref="Command"/>; choosing a menu entry sets <see cref="SelectedItem"/> (checked in
|
/// The main part executes <see cref="Command"/>; choosing a menu entry sets <see cref="SelectedItem"/> (checked in
|
||||||
/// the menu) — bind <see cref="CommandParameter"/> to it to act on the chosen preset. The control's ToolTip
|
/// the menu) — bind <see cref="CommandParameter"/> to it to act on the chosen preset. The control's ToolTip
|
||||||
/// describes the main action, <see cref="DropDownToolTip"/> the ▾ part. F4 or Alt+Down opens the menu.
|
/// describes the main action, <see cref="DropDownToolTip"/> the ▾ part. F4 or Alt+Down opens the menu.
|
||||||
/// <see cref="IsPrimary"/> gives the accent look of the screen's primary button.
|
/// <see cref="IsPrimary"/> gives the accent look of the screen's primary button. Screen readers see a split button
|
||||||
|
/// (named by AutomationProperties.Name or the content) that invokes and expands, holding the two parts;
|
||||||
|
/// <see cref="DropDownName"/> names the ▾ part.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SplitButton : Control
|
public class SplitButton : Control
|
||||||
{
|
{
|
||||||
@@ -25,6 +30,7 @@ public class SplitButton : Control
|
|||||||
public static readonly DependencyProperty ItemContainerStyleProperty = DependencyProperty.Register(nameof(ItemContainerStyle), typeof(Style), typeof(SplitButton));
|
public static readonly DependencyProperty ItemContainerStyleProperty = DependencyProperty.Register(nameof(ItemContainerStyle), typeof(Style), typeof(SplitButton));
|
||||||
public static readonly DependencyProperty DisplayMemberPathProperty = DependencyProperty.Register(nameof(DisplayMemberPath), typeof(string), typeof(SplitButton));
|
public static readonly DependencyProperty DisplayMemberPathProperty = DependencyProperty.Register(nameof(DisplayMemberPath), typeof(string), typeof(SplitButton));
|
||||||
public static readonly DependencyProperty DropDownToolTipProperty = DependencyProperty.Register(nameof(DropDownToolTip), typeof(object), typeof(SplitButton));
|
public static readonly DependencyProperty DropDownToolTipProperty = DependencyProperty.Register(nameof(DropDownToolTip), typeof(object), typeof(SplitButton));
|
||||||
|
public static readonly DependencyProperty DropDownNameProperty = DependencyProperty.Register(nameof(DropDownName), typeof(string), typeof(SplitButton));
|
||||||
public static readonly DependencyProperty IsPrimaryProperty = DependencyProperty.Register(nameof(IsPrimary), typeof(bool), typeof(SplitButton));
|
public static readonly DependencyProperty IsPrimaryProperty = DependencyProperty.Register(nameof(IsPrimary), typeof(bool), typeof(SplitButton));
|
||||||
|
|
||||||
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register(
|
||||||
@@ -69,6 +75,9 @@ public class SplitButton : Control
|
|||||||
/// <summary>Tooltip of the ▾ part.</summary>
|
/// <summary>Tooltip of the ▾ part.</summary>
|
||||||
public object? DropDownToolTip { get => GetValue(DropDownToolTipProperty); set => SetValue(DropDownToolTipProperty, value); }
|
public object? DropDownToolTip { get => GetValue(DropDownToolTipProperty); set => SetValue(DropDownToolTipProperty, value); }
|
||||||
|
|
||||||
|
/// <summary>Accessible name of the ▾ part (default "More choices").</summary>
|
||||||
|
public string? DropDownName { get => (string?)GetValue(DropDownNameProperty); set => SetValue(DropDownNameProperty, value); }
|
||||||
|
|
||||||
/// <summary>Accent fill (the one primary action of a screen).</summary>
|
/// <summary>Accent fill (the one primary action of a screen).</summary>
|
||||||
public bool IsPrimary { get => (bool)GetValue(IsPrimaryProperty); set => SetValue(IsPrimaryProperty, value); }
|
public bool IsPrimary { get => (bool)GetValue(IsPrimaryProperty); set => SetValue(IsPrimaryProperty, value); }
|
||||||
|
|
||||||
@@ -84,11 +93,25 @@ public class SplitButton : Control
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override AutomationPeer OnCreateAutomationPeer() => new SplitButtonAutomationPeer(this);
|
||||||
|
|
||||||
|
/// <summary>Runs the main action, as a click on the main part does.</summary>
|
||||||
|
internal void Invoke()
|
||||||
|
{
|
||||||
|
if (Command is { } command && command.CanExecute(CommandParameter)) command.Execute(CommandParameter);
|
||||||
|
}
|
||||||
|
|
||||||
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
private static void OnIsDropDownOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
var button = (SplitButton)d;
|
var button = (SplitButton)d;
|
||||||
if ((bool)e.NewValue) button.EnsureMenu().IsOpen = true;
|
if ((bool)e.NewValue) button.EnsureMenu().IsOpen = true;
|
||||||
else if (button._menu is { IsOpen: true } menu) menu.IsOpen = false;
|
else if (button._menu is { IsOpen: true } menu) menu.IsOpen = false;
|
||||||
|
if (UIElementAutomationPeer.FromElement(button) is { } peer)
|
||||||
|
{
|
||||||
|
peer.RaisePropertyChangedEvent(ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty,
|
||||||
|
(bool)e.OldValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed,
|
||||||
|
(bool)e.NewValue ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContextMenu EnsureMenu()
|
private ContextMenu EnsureMenu()
|
||||||
@@ -124,3 +147,34 @@ public class SplitButton : Control
|
|||||||
container.IsChecked = Equals(_menu.Items[i], SelectedItem);
|
container.IsChecked = Equals(_menu.Items[i], SelectedItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>UI Automation view of a <see cref="SplitButton"/>: Invoke runs the main action, ExpandCollapse opens the choices.</summary>
|
||||||
|
public sealed class SplitButtonAutomationPeer(SplitButton owner) : FrameworkElementAutomationPeer(owner), IInvokeProvider, IExpandCollapseProvider
|
||||||
|
{
|
||||||
|
private SplitButton Button => (SplitButton)Owner;
|
||||||
|
|
||||||
|
public ExpandCollapseState ExpandCollapseState => Button.IsDropDownOpen ? ExpandCollapseState.Expanded : ExpandCollapseState.Collapsed;
|
||||||
|
|
||||||
|
public override object? GetPattern(PatternInterface patternInterface) =>
|
||||||
|
patternInterface is PatternInterface.Invoke or PatternInterface.ExpandCollapse ? this : base.GetPattern(patternInterface);
|
||||||
|
|
||||||
|
public void Invoke()
|
||||||
|
{
|
||||||
|
if (!IsEnabled()) throw new ElementNotEnabledException();
|
||||||
|
Button.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Expand() => Button.SetCurrentValue(SplitButton.IsDropDownOpenProperty, true);
|
||||||
|
|
||||||
|
public void Collapse() => Button.SetCurrentValue(SplitButton.IsDropDownOpenProperty, false);
|
||||||
|
|
||||||
|
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.SplitButton;
|
||||||
|
|
||||||
|
protected override string GetClassNameCore() => nameof(SplitButton);
|
||||||
|
|
||||||
|
protected override string GetNameCore()
|
||||||
|
{
|
||||||
|
var name = base.GetNameCore();
|
||||||
|
return string.IsNullOrEmpty(name) ? Button.Content as string ?? string.Empty : name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,6 +62,9 @@ public sealed class StackedBar : DrawingElement
|
|||||||
remove => RemoveHandler(ItemActivatedEvent, value);
|
remove => RemoveHandler(ItemActivatedEvent, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected internal override string? AutomationDescription =>
|
||||||
|
Items is { Count: > 0 } items ? string.Join(Environment.NewLine, Enumerable.Range(0, items.Count).Select(ReadoutText)) : null;
|
||||||
|
|
||||||
protected override Size MeasureOverride(Size availableSize)
|
protected override Size MeasureOverride(Size availableSize)
|
||||||
{
|
{
|
||||||
if (Items is not { Count: > 0 } items) return new Size(0, 0);
|
if (Items is not { Count: > 0 } items) return new Size(0, 0);
|
||||||
@@ -147,7 +150,10 @@ public sealed class StackedBar : DrawingElement
|
|||||||
|
|
||||||
private string Share(double share) => ShareFormatter?.Invoke(share) ?? share.ToString("P0", Loc.Culture);
|
private string Share(double share) => ShareFormatter?.Invoke(share) ?? share.ToString("P0", Loc.Culture);
|
||||||
|
|
||||||
/// <summary>Flows legend entries into lines of the given width; draws them when <paramref name="dc"/> is set. Returns the line count.</summary>
|
/// <summary>
|
||||||
|
/// Flows legend entries into lines of the given width from the reading direction's side (the bar itself never
|
||||||
|
/// mirrors); draws them when <paramref name="dc"/> is set. Returns the line count.
|
||||||
|
/// </summary>
|
||||||
private int LayoutLegend(IReadOnlyList<ChartItem> items, double width, DrawingContext? dc)
|
private int LayoutLegend(IReadOnlyList<ChartItem> items, double width, DrawingContext? dc)
|
||||||
{
|
{
|
||||||
var total = Total(items);
|
var total = Total(items);
|
||||||
@@ -158,8 +164,8 @@ public sealed class StackedBar : DrawingElement
|
|||||||
var top = BarHeight + LegendGap;
|
var top = BarHeight + LegendGap;
|
||||||
for (var i = 0; i < items.Count; i++)
|
for (var i = 0; i < items.Count; i++)
|
||||||
{
|
{
|
||||||
var label = CreateText(items[i].Label, LabelSize, muted);
|
var label = CreateLabel(items[i].Label, LabelSize, muted);
|
||||||
var value = CreateText(items[i].ValueText ?? Share(total > 0 ? Math.Max(0, items[i].Value) / total : 0), LabelSize, text);
|
var value = CreateLabel(items[i].ValueText ?? Share(total > 0 ? Math.Max(0, items[i].Value) / total : 0), LabelSize, text);
|
||||||
var entryWidth = 8 + 6 + label.Width + 4 + value.Width;
|
var entryWidth = 8 + 6 + label.Width + 4 + value.Width;
|
||||||
if (x > 0 && double.IsFinite(width) && x + entryWidth > width)
|
if (x > 0 && double.IsFinite(width) && x + entryWidth > width)
|
||||||
{
|
{
|
||||||
@@ -171,11 +177,11 @@ public sealed class StackedBar : DrawingElement
|
|||||||
var y = top + line * LegendLine;
|
var y = top + line * LegendLine;
|
||||||
var cy = y + label.Height / 2;
|
var cy = y + label.Height / 2;
|
||||||
dc.PushOpacity(OpacityOf(i, items));
|
dc.PushOpacity(OpacityOf(i, items));
|
||||||
dc.DrawRoundedRectangle(GetBrush(items[i].BrushKey ?? BrushKey), null, new Rect(x, cy - 4, 8, 8), 2, 2);
|
dc.DrawRoundedRectangle(GetBrush(items[i].BrushKey ?? BrushKey), null, new Rect(FromStart(x, 8, width), cy - 4, 8, 8), 2, 2);
|
||||||
dc.Pop();
|
dc.Pop();
|
||||||
dc.DrawText(label, new Point(x + 14, y));
|
DrawTextAt(dc, label, new Point(FromStart(x + 14, label.Width, width), y));
|
||||||
dc.DrawText(value, new Point(x + 14 + label.Width + 4, y));
|
DrawTextAt(dc, value, new Point(FromStart(x + 14 + label.Width + 4, value.Width, width), y));
|
||||||
_entries.Add(new Rect(x, y, entryWidth, LegendLine));
|
_entries.Add(new Rect(FromStart(x, entryWidth, width), y, entryWidth, LegendLine));
|
||||||
}
|
}
|
||||||
x += entryWidth + EntryGap;
|
x += entryWidth + EntryGap;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,8 +132,8 @@ public sealed class TimelineBands : DrawingElement
|
|||||||
var top = b * BandHeight;
|
var top = b * BandHeight;
|
||||||
var baseline = top + BandHeight - captionHeight - 8;
|
var baseline = top + BandHeight - captionHeight - 8;
|
||||||
var barSpace = baseline - top - 8;
|
var barSpace = baseline - top - 8;
|
||||||
var title = CreateText(band.Label, 13, text, semiBold: true);
|
var title = CreateLabel(band.Label, 13, text, semiBold: true);
|
||||||
dc.DrawText(title, new Point(0, top + (BandHeight - title.Height) / 2));
|
DrawTextAt(dc, title, new Point(0, top + (BandHeight - title.Height) / 2));
|
||||||
for (var s = 0; s < slots; s++)
|
for (var s = 0; s < slots; s++)
|
||||||
{
|
{
|
||||||
var cx = LabelColumn + pitch * (s + 0.5);
|
var cx = LabelColumn + pitch * (s + 0.5);
|
||||||
@@ -145,8 +145,8 @@ public sealed class TimelineBands : DrawingElement
|
|||||||
}
|
}
|
||||||
if (SlotLabels is { } labels && s < labels.Count)
|
if (SlotLabels is { } labels && s < labels.Count)
|
||||||
{
|
{
|
||||||
var caption = CreateText(labels[s], LabelSize, faint);
|
var caption = CreateLabel(labels[s], LabelSize, faint);
|
||||||
dc.DrawText(caption, new Point(cx - caption.Width / 2, baseline + 4));
|
DrawTextAt(dc, caption, new Point(cx - caption.Width / 2, baseline + 4));
|
||||||
}
|
}
|
||||||
if (b == CurrentBand && s == CurrentSlot)
|
if (b == CurrentBand && s == CurrentSlot)
|
||||||
dc.DrawRoundedRectangle(null, GetPen("Brush.Accent", 1.5), new Rect(cx - pitch / 2 + 2, top + 4, pitch - 4, BandHeight - 8), 4, 4);
|
dc.DrawRoundedRectangle(null, GetPen("Brush.Accent", 1.5), new Rect(cx - pitch / 2 + 2, top + 4, pitch - 4, BandHeight - 8), 4, 4);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ public sealed partial class ConfirmDialog : TitanoWindow
|
|||||||
{
|
{
|
||||||
DataContext = request;
|
DataContext = request;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
WindowDirection.Follow(this);
|
|
||||||
Action.SetResourceReference(StyleProperty, request.IsDestructive ? "Button.Destructive" : "Button.Primary");
|
Action.SetResourceReference(StyleProperty, request.IsDestructive ? "Button.Destructive" : "Button.Primary");
|
||||||
// The keyboard starts on the safe default, as in Windows dialogs.
|
// The keyboard starts on the safe default, as in Windows dialogs.
|
||||||
Loaded += (_, _) => Safe.Focus();
|
Loaded += (_, _) => Safe.Focus();
|
||||||
|
|||||||
@@ -136,8 +136,7 @@
|
|||||||
<!-- First run / signed out: connect form. -->
|
<!-- First run / signed out: connect form. -->
|
||||||
<Grid Grid.Row="1" Visibility="{Binding IsConnectVisible, Converter={StaticResource BoolToVisibility}}">
|
<Grid Grid.Row="1" Visibility="{Binding IsConnectVisible, Converter={StaticResource BoolToVisibility}}">
|
||||||
<StackPanel DataContext="{Binding Connect}" Width="440" HorizontalAlignment="Center" VerticalAlignment="Center">
|
<StackPanel DataContext="{Binding Connect}" Width="440" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<!-- The mark is artwork: its off-centre sun must not flip in right-to-left languages. -->
|
<ui:BrandMarkIcon Width="48" Height="48" HorizontalAlignment="Center" />
|
||||||
<ui:BrandMarkIcon Width="48" Height="48" HorizontalAlignment="Center" FlowDirection="LeftToRight" />
|
|
||||||
<TextBlock Text="{l:Loc Uploader.Connect.Title}" Style="{StaticResource Text.Title}" HorizontalAlignment="Center" Margin="0,14,0,20" />
|
<TextBlock Text="{l:Loc Uploader.Connect.Title}" Style="{StaticResource Text.Title}" HorizontalAlignment="Center" Margin="0,14,0,20" />
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -188,15 +187,9 @@
|
|||||||
ToolTip="{l:Loc Tooltips.Uploader.User}" AutomationProperties.Name="{l:Loc Uploader.Connect.User}" />
|
ToolTip="{l:Loc Tooltips.Uploader.User}" AutomationProperties.Name="{l:Loc Uploader.Connect.User}" />
|
||||||
|
|
||||||
<TextBlock Grid.Row="3" Text="{l:Loc Uploader.Connect.Password}" Style="{StaticResource Text.Label}" Margin="0,12,12,0" />
|
<TextBlock Grid.Row="3" Text="{l:Loc Uploader.Connect.Password}" Style="{StaticResource Text.Label}" Margin="0,12,12,0" />
|
||||||
|
<!-- A wrong password: the kit's error border (DESIGN §4); the message is the tooltip. -->
|
||||||
<PasswordBox x:Name="Password" Grid.Row="3" Grid.Column="1" Margin="0,12,0,0" PasswordChanged="OnPasswordChanged"
|
<PasswordBox x:Name="Password" Grid.Row="3" Grid.Column="1" Margin="0,12,0,0" PasswordChanged="OnPasswordChanged"
|
||||||
ToolTip="{Binding PasswordToolTip}" AutomationProperties.Name="{l:Loc Uploader.Connect.Password}" />
|
ToolTip="{Binding PasswordToolTip}" AutomationProperties.Name="{l:Loc Uploader.Connect.Password}" ui:Field.Error="{Binding PasswordError}" />
|
||||||
<!--
|
|
||||||
A wrong password: the Error border (DESIGN §4), drawn over the box because the password box has no binding
|
|
||||||
to validate and its template paints the focus border over its own; the message is the tooltip.
|
|
||||||
-->
|
|
||||||
<Border x:Name="PasswordErrorRing" Grid.Row="3" Grid.Column="1" Margin="0,12,0,0" BorderBrush="{DynamicResource Brush.Error}" BorderThickness="1"
|
|
||||||
CornerRadius="{StaticResource Radius.Control}" SnapsToDevicePixels="True" IsHitTestVisible="False"
|
|
||||||
Visibility="{Binding PasswordError, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
|
||||||
|
|
||||||
<Border Grid.Row="4" Grid.Column="1" Margin="0,12,0,0" Padding="10,6,6,6" CornerRadius="{StaticResource Radius.Control}" Background="{DynamicResource Brush.ErrorSubtle}"
|
<Border Grid.Row="4" Grid.Column="1" Margin="0,12,0,0" Padding="10,6,6,6" CornerRadius="{StaticResource Radius.Control}" Background="{DynamicResource Brush.ErrorSubtle}"
|
||||||
Visibility="{Binding ErrorText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
Visibility="{Binding ErrorText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}">
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ public sealed partial class MainWindow : TitanoWindow
|
|||||||
_connectShown = vm.IsConnectVisible;
|
_connectShown = vm.IsConnectVisible;
|
||||||
DataContext = vm;
|
DataContext = vm;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
WindowDirection.Follow(this);
|
|
||||||
vm.PendingToasts.CollectionChanged += OnToastRequested;
|
vm.PendingToasts.CollectionChanged += OnToastRequested;
|
||||||
vm.PropertyChanged += OnViewModelChanged;
|
vm.PropertyChanged += OnViewModelChanged;
|
||||||
vm.Connect.PropertyChanged += OnConnectChanged;
|
vm.Connect.PropertyChanged += OnConnectChanged;
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
using System.Windows;
|
|
||||||
using Titano.Core.Localization;
|
|
||||||
|
|
||||||
namespace Titano.Uploader.Shell;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Mirrors a window for right-to-left languages (BRIEF §16: ar, he, fa, ur) and follows later language switches.
|
|
||||||
/// Windows do not inherit <see cref="FrameworkElement.FlowDirection"/> from their owner, so every window calls this.
|
|
||||||
/// </summary>
|
|
||||||
public static class WindowDirection
|
|
||||||
{
|
|
||||||
public static void Follow(Window window)
|
|
||||||
{
|
|
||||||
Apply(window);
|
|
||||||
void OnCultureChanged(object? sender, EventArgs e) => window.Dispatcher.Invoke(() => Apply(window));
|
|
||||||
Loc.CultureChanged += OnCultureChanged;
|
|
||||||
window.Closed += (_, _) => Loc.CultureChanged -= OnCultureChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void Apply(Window window) =>
|
|
||||||
window.FlowDirection = Loc.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using Titano.App.Archiving;
|
using Titano.App.Archiving;
|
||||||
|
using Titano.App.Infrastructure;
|
||||||
using Titano.App.Library;
|
using Titano.App.Library;
|
||||||
using Titano.Core.Archiving;
|
using Titano.Core.Archiving;
|
||||||
using Titano.Core.Imaging;
|
using Titano.Core.Imaging;
|
||||||
using Titano.Core.Localization;
|
using Titano.Core.Localization;
|
||||||
using Titano.Core.Model;
|
using Titano.Core.Model;
|
||||||
|
using Titano.Data;
|
||||||
using Titano.Data.Archiving;
|
using Titano.Data.Archiving;
|
||||||
using Titano.Data.Repositories;
|
using Titano.Data.Repositories;
|
||||||
using Titano.Testing;
|
using Titano.Testing;
|
||||||
|
using Titano.Ui.Controls;
|
||||||
|
|
||||||
namespace Titano.App.Tests.Archiving;
|
namespace Titano.App.Tests.Archiving;
|
||||||
|
|
||||||
@@ -163,11 +167,31 @@ public sealed class ArchiveLogicTests
|
|||||||
Assert.True(double.IsNaN(rows[2].Values[10]));
|
Assert.True(double.IsNaN(rows[2].Values[10]));
|
||||||
Assert.Null(rows[2].ToolTips[11]);
|
Assert.Null(rows[2].ToolTips[11]);
|
||||||
Assert.Equal("July 2026 · 5,000 photos · 5 sequences", rows[2].ToolTips[6]);
|
Assert.Equal("July 2026 · 5,000 photos · 5 sequences", rows[2].ToolTips[6]);
|
||||||
Assert.Equal(12, ArchiveFigures.MonthLabels().Count);
|
|
||||||
Assert.Equal("J", ArchiveFigures.MonthLabels()[0]);
|
|
||||||
Assert.Empty(ArchiveFigures.PhotosPerMonth(Stats() with { ByMonth = [] }, DateTime.Today));
|
Assert.Empty(ArchiveFigures.PhotosPerMonth(Stats() with { ByMonth = [] }, DateTime.Today));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void MonthColumnsAreInitialsOnlyWhereTheyAreLetters()
|
||||||
|
{
|
||||||
|
var numbers = Enumerable.Range(1, 12).Select(m => m.ToString(CultureInfo.InvariantCulture)).ToArray();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Assert.Equal("J F M A M J J A S O N D", string.Join(' ', ArchiveFigures.MonthLabels()));
|
||||||
|
Loc.SetCulture(CultureInfo.GetCultureInfo("it"));
|
||||||
|
Assert.Equal("G F M A M G L A S O N D", string.Join(' ', ArchiveFigures.MonthLabels()));
|
||||||
|
// Numbered abbreviations ("10月", "Tháng 10") would read "1" for October to December, or "T" for every month.
|
||||||
|
foreach (var culture in new[] { "ja", "ko", "zh-Hans", "zh-Hant", "vi", "th", "ar", "he" })
|
||||||
|
{
|
||||||
|
Loc.SetCulture(CultureInfo.GetCultureInfo(culture));
|
||||||
|
Assert.SequenceEqual(numbers, ArchiveFigures.MonthLabels(), culture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TilesAndHealthSummariseTheIndex()
|
public void TilesAndHealthSummariseTheIndex()
|
||||||
{
|
{
|
||||||
@@ -177,7 +201,7 @@ public sealed class ArchiveLogicTests
|
|||||||
Assert.Equal("9.4 TB", tiles[2].Value);
|
Assert.Equal("9.4 TB", tiles[2].Value);
|
||||||
Assert.Equal("6", tiles[3].Value);
|
Assert.Equal("6", tiles[3].Value);
|
||||||
Assert.Equal("cameras · 8 formats", tiles[3].Caption);
|
Assert.Equal("cameras · 8 formats", tiles[3].Caption);
|
||||||
Assert.Equal("2024 – 2026", tiles[4].Value);
|
Assert.Equal(Formatting.LeftToRight("2024 – 2026"), tiles[4].Value, "a year range keeps its order in right-to-left text");
|
||||||
|
|
||||||
var health = ArchiveFigures.Health(Stats(), withoutProxies: 0);
|
var health = ArchiveFigures.Health(Stats(), withoutProxies: 0);
|
||||||
Assert.Equal(HealthAction.Verify, health[0].Action);
|
Assert.Equal(HealthAction.Verify, health[0].Action);
|
||||||
@@ -187,6 +211,59 @@ public sealed class ArchiveLogicTests
|
|||||||
Assert.True(health[2].IsOk);
|
Assert.True(health[2].IsOk);
|
||||||
Assert.Equal(HealthAction.Analyse, health[3].Action);
|
Assert.Equal(HealthAction.Analyse, health[3].Action);
|
||||||
Assert.Equal(HealthAction.Duplicates, health[4].Action);
|
Assert.Equal(HealthAction.Duplicates, health[4].Action);
|
||||||
|
Assert.Equal("5 duplicate frames", health[4].Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void HealthDuplicatesFollowTheLastDuplicatesSearch()
|
||||||
|
{
|
||||||
|
var unflagged = Stats() with { Health = Stats().Health with { DuplicateFrames = 0 } };
|
||||||
|
var before = ArchiveFigures.Health(unflagged, withoutProxies: 0)[4];
|
||||||
|
Assert.True(before.IsOk);
|
||||||
|
Assert.Equal("No copies flagged", before.Text, "before a search the line says what it measures");
|
||||||
|
|
||||||
|
var found = ArchiveFigures.Health(unflagged, withoutProxies: 0, duplicateGroups: 1)[4];
|
||||||
|
Assert.False(found.IsOk, "never a tick while the Duplicates card lists groups");
|
||||||
|
Assert.Equal("1 duplicate group", found.Text);
|
||||||
|
Assert.Equal(HealthAction.MarkDuplicates, found.Action);
|
||||||
|
|
||||||
|
var none = ArchiveFigures.Health(Stats(), withoutProxies: 0, duplicateGroups: 0)[4];
|
||||||
|
Assert.True(none.IsOk);
|
||||||
|
Assert.Equal(HealthAction.None, none.Action);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void FailuresAreOneLocalizedSentenceByCause()
|
||||||
|
{
|
||||||
|
Assert.Equal("The archive " + Formatting.LeftToRight("/archive") + " is offline.",
|
||||||
|
ArchiveFailures.Cause(new ArchiveOfflineException("/archive", ArchiveAvailability.Offline)));
|
||||||
|
Assert.Equal("The archive " + Formatting.LeftToRight("/archive") + " is read-only.",
|
||||||
|
ArchiveFailures.Cause(new ArchiveOfflineException("/archive", ArchiveAvailability.ReadOnly)));
|
||||||
|
Assert.Equal("Titano was denied access to the archive.", ArchiveFailures.Cause(new UnauthorizedAccessException("Access to '/x' is denied.")));
|
||||||
|
Assert.Equal("The index could not be read or written.", ArchiveFailures.Cause(new DatabaseConnectionException("socket closed")));
|
||||||
|
Assert.Equal("The sequence is no longer in the index.", ArchiveFailures.Cause(new ArgumentException("Unknown sequence 42.")));
|
||||||
|
Assert.Equal("A file of the archive could not be read or written.", ArchiveFailures.Cause(new IOException("The device is not ready.")));
|
||||||
|
Assert.Equal(Loc.L("Archive.Error.StalePlan"), ArchiveFailures.Cause(new StaleRenamePlanException(Guid.NewGuid())));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TreeRowsShowTheirWholeTitleAndTheKeysOfTheReadingDirection()
|
||||||
|
{
|
||||||
|
var harbour = Seq("Construction cam · weekly", new DateTime(2026, 9, 28), 3_600, 72_000_000_000);
|
||||||
|
var tree = ArchiveTree.Build(Main, ArchiveAvailability.Online, [harbour]);
|
||||||
|
var year = new ArchiveTreeRowViewModel(tree.Root.Children[0], ArchiveAvailability.Online, _ => { });
|
||||||
|
var sequence = new ArchiveTreeRowViewModel(tree.Root.Children[0].Children[0], ArchiveAvailability.Online, _ => { });
|
||||||
|
Assert.Equal("Construction cam · weekly · 3,600 photos · 72 GB", sequence.RowToolTip);
|
||||||
|
Assert.Equal("2026 · 1 sequence · 72 GB · Right arrow opens the year, Left arrow closes it", year.RowToolTip);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Loc.SetCulture(CultureInfo.GetCultureInfo("he"));
|
||||||
|
Assert.Equal(Loc.L("Tooltips.Archive.YearRowRtl", "2026 · " + year.Detail), year.RowToolTip, "the arrow keys of a mirrored tree");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -257,6 +334,11 @@ public sealed class ArchiveLogicTests
|
|||||||
Assert.Equal("2 photos not in sidecar", orphans[0].Detail);
|
Assert.Equal("2 photos not in sidecar", orphans[0].Detail);
|
||||||
Assert.Equal(a.Id, orphans[0].SequenceId);
|
Assert.Equal(a.Id, orphans[0].SequenceId);
|
||||||
Assert.Null(orphans[2].SequenceId);
|
Assert.Null(orphans[2].SequenceId);
|
||||||
|
// Folders stay left to right inside right-to-left text.
|
||||||
|
Assert.Equal("No sidecar in " + Formatting.LeftToRight("2024/Gone"), orphans[1].Detail);
|
||||||
|
Assert.Equal(Formatting.LeftToRight("2026/New shoot"), orphans[2].Title);
|
||||||
|
Assert.True(duplicates.Single().Places[1].EndsWith(Formatting.LeftToRight(b.Folder + "/originals/IMG_9.CR2"), StringComparison.Ordinal),
|
||||||
|
"a duplicate's path stays left to right");
|
||||||
|
|
||||||
var now = DateTimeOffset.UtcNow;
|
var now = DateTimeOffset.UtcNow;
|
||||||
var jobs = new[]
|
var jobs = new[]
|
||||||
@@ -267,7 +349,9 @@ public sealed class ArchiveLogicTests
|
|||||||
var recent = MaintenanceReports.Recent(jobs, 5);
|
var recent = MaintenanceReports.Recent(jobs, 5);
|
||||||
Assert.Equal("Verify · TitanoArchive", recent[0].Text);
|
Assert.Equal("Verify · TitanoArchive", recent[0].Text);
|
||||||
Assert.Equal("71 %", recent[0].StateText);
|
Assert.Equal("71 %", recent[0].StateText);
|
||||||
|
Assert.Equal(StatusKind.Running, recent[0].StateKind);
|
||||||
Assert.Equal(JobState.Done, recent[1].State);
|
Assert.Equal(JobState.Done, recent[1].State);
|
||||||
|
Assert.Equal(StatusKind.Done, recent[1].StateKind, "a finished run is a green dot, a failed one a red cross");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Automation;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
using Titano.App.Archiving;
|
using Titano.App.Archiving;
|
||||||
|
using Titano.App.Infrastructure;
|
||||||
using Titano.App.Sections;
|
using Titano.App.Sections;
|
||||||
|
using Titano.App.Shell;
|
||||||
using Titano.App.Tests.Windows;
|
using Titano.App.Tests.Windows;
|
||||||
|
using Titano.Core.Archiving;
|
||||||
|
using Titano.Core.Localization;
|
||||||
using Titano.Testing;
|
using Titano.Testing;
|
||||||
using Titano.Ui.Controls;
|
using Titano.Ui.Controls;
|
||||||
|
|
||||||
@@ -10,7 +19,9 @@ namespace Titano.App.Tests.Archiving;
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Every Archive view of <c>--capture</c> (<see cref="ArchiveScenes"/>) on the sample archive, rendered in both themes
|
/// Every Archive view of <c>--capture</c> (<see cref="ArchiveScenes"/>) on the sample archive, rendered in both themes
|
||||||
/// in the real main window, with what each view must show — and the buttons really enabled, not only their commands.
|
/// in the real main window, with what each view must show — the buttons really enabled and named for screen readers,
|
||||||
|
/// keyboard focus visible, no error or busy state left over — and paths and templates readable in a right-to-left
|
||||||
|
/// language.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[WindowsOnly]
|
[WindowsOnly]
|
||||||
[Serial]
|
[Serial]
|
||||||
@@ -35,14 +46,21 @@ public sealed class ArchiveScreenSmokeTests
|
|||||||
Assert.NotEmpty(archive.StorageBars);
|
Assert.NotEmpty(archive.StorageBars);
|
||||||
Assert.NotEmpty(archive.CameraBars);
|
Assert.NotEmpty(archive.CameraBars);
|
||||||
Assert.NotEmpty(archive.FormatBars);
|
Assert.NotEmpty(archive.FormatBars);
|
||||||
|
Assert.True(archive.HasMonthScale, "the heatmap's scale sits in its header");
|
||||||
|
Assert.Contains(archive.CameraBars[0].ToolTip!, archive.CamerasDescription);
|
||||||
Assert.True(archive.ScanCommand.CanExecute(null), "an online archive can be scanned");
|
Assert.True(archive.ScanCommand.CanExecute(null), "an online archive can be scanned");
|
||||||
await app.ExpectAsync<ArchiveView>("archive-overview");
|
await app.ExpectAsync<ArchiveView>("archive-overview");
|
||||||
Assert.True(ButtonFor(app, archive.ScanCommand).IsEnabled, "the Scan button is enabled once the archive is read");
|
Assert.True(ButtonFor(app, archive.ScanCommand).IsEnabled, "the Scan button is enabled once the archive is read");
|
||||||
Assert.True(ButtonFor(app, archive.AnalyseSetCommand).IsEnabled, "mass operations are enabled on the whole archive");
|
Assert.True(ButtonFor(app, archive.AnalyseSetCommand).IsEnabled, "mass operations are enabled on the whole archive");
|
||||||
|
AssertEveryButtonIsNamed(app);
|
||||||
|
Assert.Contains(archive.SetText, AutomationProperties.GetName(SetButton(app)));
|
||||||
|
foreach (var row in TreeItems(app)) Assert.NotNull(row.FocusVisualStyle, "a tree row shows keyboard focus");
|
||||||
|
var sequence = archive.TreeRows.First(r => r.Node.Kind == TreeNodeKind.Sequence);
|
||||||
|
Assert.Contains(sequence.Title, sequence.RowToolTip);
|
||||||
|
|
||||||
// Expanding another year keeps the selection: the set stays what the user chose.
|
// Expanding another year keeps the selection: the set stays what the user chose.
|
||||||
var year = archive.TreeRows[1];
|
var year = archive.TreeRows[1];
|
||||||
var tree = app.FindAll<ListBox>().Single(l => l.Name == "Tree");
|
var tree = Tree(app);
|
||||||
tree.SelectedItems.Add(year);
|
tree.SelectedItems.Add(year);
|
||||||
var chosen = archive.SetText;
|
var chosen = archive.SetText;
|
||||||
archive.Toggle(archive.TreeRows.Last(r => r.IsYear));
|
archive.Toggle(archive.TreeRows.Last(r => r.IsYear));
|
||||||
@@ -55,19 +73,34 @@ public sealed class ArchiveScreenSmokeTests
|
|||||||
Assert.Equal(5, archive.Health.Count);
|
Assert.Equal(5, archive.Health.Count);
|
||||||
Assert.Equal(1, archive.Duplicates!.Count);
|
Assert.Equal(1, archive.Duplicates!.Count);
|
||||||
Assert.Equal(3, archive.Orphans!.Count, "unlisted photos, a row without sidecar, a folder not indexed");
|
Assert.Equal(3, archive.Orphans!.Count, "unlisted photos, a row without sidecar, a folder not indexed");
|
||||||
|
var duplicatesLine = archive.Health[4].Line;
|
||||||
|
Assert.False(duplicatesLine.IsOk, "index health agrees with the duplicate groups listed beside it");
|
||||||
|
Assert.Equal(HealthAction.MarkDuplicates, duplicatesLine.Action);
|
||||||
await app.ExpectAsync<ArchiveView>("archive-maintenance");
|
await app.ExpectAsync<ArchiveView>("archive-maintenance");
|
||||||
|
Assert.False(app.FindAll<Button>().Any(b => b.IsVisible && ReferenceEquals(b.Command, archive.CancelSearchCommand)), "no Cancel without a search");
|
||||||
|
Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(TextFor(app, archive.DuplicatesText)), "search results are announced");
|
||||||
|
AssertEveryButtonIsNamed(app);
|
||||||
|
|
||||||
await ArchiveScenes.ShowAsync(app.Shell, "rebuild");
|
await ArchiveScenes.ShowAsync(app.Shell, "rebuild");
|
||||||
var rebuild = Assert.NotNull(archive.Dialog as RebuildDialogViewModel);
|
var rebuild = Assert.NotNull(archive.Dialog as RebuildDialogViewModel);
|
||||||
Assert.True(rebuild.RebuildCommand.CanExecute(null));
|
Assert.True(rebuild.RebuildCommand.CanExecute(null));
|
||||||
Assert.False(archive.IsContentEnabled, "the screen behind a dialog takes no input");
|
Assert.False(archive.IsContentEnabled, "the screen behind a dialog takes no input");
|
||||||
|
Assert.False(rebuild.FactRows.Any(f => f.Value == Loc.L("Archive.Rebuild.Counting")), "counted, the facts no longer say Counting…");
|
||||||
await app.ExpectAsync<ArchiveView>("archive-rebuild");
|
await app.ExpectAsync<ArchiveView>("archive-rebuild");
|
||||||
|
Assert.False(tree.IsEnabled);
|
||||||
|
var frame = Assert.NotNull(VisualTreeHelper.GetChild(tree, 0) as Border);
|
||||||
|
Assert.Equal(0, ((SolidColorBrush)frame.Background).Color.A, "the disabled tree keeps its panel's fill instead of the system's white");
|
||||||
|
AssertNoErrorShown(app);
|
||||||
|
|
||||||
await ArchiveScenes.ShowAsync(app.Shell, "move");
|
await ArchiveScenes.ShowAsync(app.Shell, "move");
|
||||||
var move = Assert.NotNull(archive.Dialog as RenameDialogViewModel);
|
var move = Assert.NotNull(archive.Dialog as RenameDialogViewModel);
|
||||||
Assert.NotEmpty(move.Rows, "the dry run lists the folders that change");
|
Assert.NotEmpty(move.Rows, "the dry run lists the folders that change");
|
||||||
|
Assert.Null(move.ErrorText);
|
||||||
await app.ExpectAsync<ArchiveView>("archive-move");
|
await app.ExpectAsync<ArchiveView>("archive-move");
|
||||||
Assert.True(ButtonFor(app, move.ApplyCommand).IsEnabled, "Apply follows the dry run");
|
Assert.True(ButtonFor(app, move.ApplyCommand).IsEnabled, "Apply follows the dry run");
|
||||||
|
Assert.True(ButtonFor(app, move.CloseCommand).IsDefault, "Enter takes the safe way out");
|
||||||
|
AssertNoErrorShown(app);
|
||||||
|
AssertEveryButtonIsNamed(app);
|
||||||
|
|
||||||
move.CloseCommand.Execute(null);
|
move.CloseCommand.Execute(null);
|
||||||
archive.RetagSetCommand.Execute(null);
|
archive.RetagSetCommand.Execute(null);
|
||||||
@@ -75,9 +108,113 @@ public sealed class ArchiveScreenSmokeTests
|
|||||||
retag.Add.Text = "sunset";
|
retag.Add.Text = "sunset";
|
||||||
await app.ExpectAsync<ArchiveView>("archive-retag");
|
await app.ExpectAsync<ArchiveView>("archive-retag");
|
||||||
Assert.True(ButtonFor(app, retag.ApplyCommand).IsEnabled, "Apply follows the typed tags");
|
Assert.True(ButtonFor(app, retag.ApplyCommand).IsEnabled, "Apply follows the typed tags");
|
||||||
|
AssertNoErrorShown(app);
|
||||||
retag.CloseCommand.Execute(null);
|
retag.CloseCommand.Execute(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public Task PathsTemplatesAndMonthsStayReadableRightToLeft() => ScreenHost.RunAsync(async () =>
|
||||||
|
{
|
||||||
|
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||||||
|
await app.Sample.FillAsync();
|
||||||
|
UiLanguage.Apply("ar");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var archive = app.Shell.Archive;
|
||||||
|
await ArchiveScenes.ShowAsync(app.Shell, "overview");
|
||||||
|
Assert.Equal(12.ToString("N0", Loc.Culture), archive.MonthLabels[^1], "Arabic month names have no initials: the columns are numbered");
|
||||||
|
var year = archive.TreeRows[1];
|
||||||
|
Assert.Equal(Loc.L("Tooltips.Archive.YearRowRtl", year.Title + " · " + year.Detail), year.RowToolTip, "the tooltip names the mirrored arrow keys");
|
||||||
|
await app.ExpectAsync<ArchiveView>("archive-overview-ar");
|
||||||
|
|
||||||
|
await ArchiveScenes.ShowAsync(app.Shell, "rebuild");
|
||||||
|
Assert.Equal(FlowDirection.LeftToRight, TextFor(app, archive.SelectedArchive!.RootPath).FlowDirection, "the archive folder reads left to right");
|
||||||
|
await app.ExpectAsync<ArchiveView>("archive-rebuild-ar");
|
||||||
|
|
||||||
|
await ArchiveScenes.ShowAsync(app.Shell, "move");
|
||||||
|
var move = Assert.NotNull(archive.Dialog as RenameDialogViewModel);
|
||||||
|
var template = Assert.NotNull(app.FindAll<TextBox>().FirstOrDefault(t => t.IsVisible && EditBehavior.GetField(t) == move.Template));
|
||||||
|
Assert.Equal(FlowDirection.LeftToRight, template.FlowDirection, "the naming template reads left to right");
|
||||||
|
Assert.Equal(FlowDirection.LeftToRight, TextFor(app, move.Rows[0].From).FlowDirection, "a folder before the move reads left to right");
|
||||||
|
Assert.Equal(FlowDirection.LeftToRight, TextFor(app, move.Rows[0].To).FlowDirection, "a folder after the move reads left to right");
|
||||||
|
await app.ExpectAsync<ArchiveView>("archive-move-ar");
|
||||||
|
move.CloseCommand.Execute(null);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
UiLanguage.Apply("en");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task RebuildCountsSayWhyInsteadOfCountingForever()
|
||||||
|
{
|
||||||
|
var offline = new RebuildDialogViewModel(Archive("/nowhere"), ArchiveAvailability.Offline, 3, () => Task.CompletedTask, _ => { });
|
||||||
|
await offline.CountAsync();
|
||||||
|
var sidecars = Fact(offline, "Archive.Rebuild.Sidecars");
|
||||||
|
Assert.Equal("—", sidecars.Value);
|
||||||
|
Assert.Equal(Loc.L("Archive.Error.Offline", Formatting.LeftToRight("/nowhere")), sidecars.ToolTip);
|
||||||
|
Assert.True(Fact(offline, "Archive.Rebuild.Root").IsPath, "the archive folder is shown left to right");
|
||||||
|
|
||||||
|
var missing = Path.Combine(Path.GetTempPath(), "titano-missing-" + Guid.NewGuid().ToString("N"));
|
||||||
|
var unreadable = new RebuildDialogViewModel(Archive(missing), ArchiveAvailability.Online, 3, () => Task.CompletedTask, _ => { });
|
||||||
|
await unreadable.CountAsync();
|
||||||
|
Assert.Equal("—", Fact(unreadable, "Archive.Rebuild.Metadata").Value);
|
||||||
|
Assert.Equal(Loc.L("Archive.Failed.Files"), Fact(unreadable, "Archive.Rebuild.Metadata").ToolTip);
|
||||||
|
Assert.Null(unreadable.BusyText, "nothing is counting any more");
|
||||||
|
|
||||||
|
static Core.Model.Archive Archive(string root) => new() { Id = Guid.CreateVersion7(), Name = "TitanoArchive", RootPath = root };
|
||||||
|
static DialogFact Fact(RebuildDialogViewModel dialog, string label) => dialog.FactRows.Single(f => f.Label == Loc.L(label));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TheArrowTowardsTheIndentOpensAYearInEitherDirection()
|
||||||
|
{
|
||||||
|
Assert.True(ArchiveView.Toggles(Key.Right, FlowDirection.LeftToRight, isExpanded: false));
|
||||||
|
Assert.False(ArchiveView.Toggles(Key.Right, FlowDirection.LeftToRight, isExpanded: true));
|
||||||
|
Assert.True(ArchiveView.Toggles(Key.Left, FlowDirection.LeftToRight, isExpanded: true));
|
||||||
|
Assert.True(ArchiveView.Toggles(Key.Left, FlowDirection.RightToLeft, isExpanded: false), "a mirrored tree opens with Left");
|
||||||
|
Assert.True(ArchiveView.Toggles(Key.Right, FlowDirection.RightToLeft, isExpanded: true), "and closes with Right");
|
||||||
|
Assert.False(ArchiveView.Toggles(Key.Right, FlowDirection.RightToLeft, isExpanded: false));
|
||||||
|
Assert.True(ArchiveView.Toggles(Key.Enter, FlowDirection.RightToLeft, isExpanded: true));
|
||||||
|
Assert.False(ArchiveView.Toggles(Key.Down, FlowDirection.LeftToRight, isExpanded: false));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Every button of the screen has a name screen readers can announce, menu buttons with drawn chevrons included.</summary>
|
||||||
|
private static void AssertEveryButtonIsNamed(ScreenSmokeTests.SampleApp app)
|
||||||
|
{
|
||||||
|
foreach (var button in app.FindAll<ButtonBase>().Where(b => b.IsVisible && b.Focusable && IsInArchive(b)))
|
||||||
|
{
|
||||||
|
var name = AutomationProperties.GetName(button);
|
||||||
|
if (string.IsNullOrEmpty(name)) name = button.Content as string;
|
||||||
|
Assert.False(string.IsNullOrWhiteSpace(name), $"{button.GetType().Name} '{button.Name}' bound to {button.Command} has no accessible name");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>A dialog that has not failed shows no error line.</summary>
|
||||||
|
private static void AssertNoErrorShown(ScreenSmokeTests.SampleApp app) =>
|
||||||
|
Assert.False(app.FindAll<StatusGlyph>().Any(g => g.IsVisible && g.Kind == StatusKind.Error && IsInArchive(g)), "no error state before anything failed");
|
||||||
|
|
||||||
|
private static ListBox Tree(ScreenSmokeTests.SampleApp app) => app.FindAll<ListBox>().Single(l => l.Name == "Tree");
|
||||||
|
|
||||||
|
private static IEnumerable<ListBoxItem> TreeItems(ScreenSmokeTests.SampleApp app) =>
|
||||||
|
app.FindAll<ListBoxItem>().Where(i => i.IsVisible && i.DataContext is ArchiveTreeRowViewModel);
|
||||||
|
|
||||||
|
private static Button SetButton(ScreenSmokeTests.SampleApp app) =>
|
||||||
|
Assert.NotNull(app.FindAll<Button>().FirstOrDefault(b => b.IsVisible && b.ToolTip as string == Loc.L("Tooltips.Archive.Set")), "the set filter button");
|
||||||
|
|
||||||
|
private static bool IsInArchive(DependencyObject element)
|
||||||
|
{
|
||||||
|
for (var node = VisualTreeHelper.GetParent(element); node is not null; node = VisualTreeHelper.GetParent(node))
|
||||||
|
{
|
||||||
|
if (node is ArchiveView) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TextBlock TextFor(ScreenSmokeTests.SampleApp app, string text) =>
|
||||||
|
Assert.NotNull(app.FindAll<TextBlock>().FirstOrDefault(t => t.IsVisible && t.Text == text && IsInArchive(t)), $"a visible text '{text}'");
|
||||||
|
|
||||||
private static Button ButtonFor(ScreenSmokeTests.SampleApp app, ICommand command) =>
|
private static Button ButtonFor(ScreenSmokeTests.SampleApp app, ICommand command) =>
|
||||||
Assert.NotNull(app.FindAll<Button>().FirstOrDefault(b => ReferenceEquals(b.Command, command) && b.IsVisible), "a visible button bound to the command");
|
Assert.NotNull(app.FindAll<Button>().FirstOrDefault(b => ReferenceEquals(b.Command, command) && b.IsVisible), "a visible button bound to the command");
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ public sealed class UploaderScreenSmokeTests
|
|||||||
Assert.Null(vm.Connect.ErrorText);
|
Assert.Null(vm.Connect.ErrorText);
|
||||||
foreach (var box in screen.Visible<TextBox>())
|
foreach (var box in screen.Visible<TextBox>())
|
||||||
Assert.False(Validation.GetHasError(box), $"{AutomationProperties.GetName(box)} shows an error before use");
|
Assert.False(Validation.GetHasError(box), $"{AutomationProperties.GetName(box)} shows an error before use");
|
||||||
Assert.False(screen.Named<Border>("PasswordErrorRing").IsVisible, "the password box shows no error before use");
|
Assert.False(Field.GetHasError(screen.Named<PasswordBox>("Password")), "the password box shows no error before use");
|
||||||
screen.AssertIconButtonsNamed("connect");
|
screen.AssertIconButtonsNamed("connect");
|
||||||
|
|
||||||
// Enter signs in from the form, not from the settings panel drawn over it.
|
// Enter signs in from the form, not from the settings panel drawn over it.
|
||||||
|
|||||||
@@ -73,6 +73,32 @@ public sealed class CurveMathTests
|
|||||||
Assert.False(CurveMath.CanRemove(3, 2, pinEnds: true));
|
Assert.False(CurveMath.CanRemove(3, 2, pinEnds: true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void KeyboardInsertionUsesThePlayheadWhenAPointFitsThere()
|
||||||
|
{
|
||||||
|
double[] xs = [0, 0.4, 1];
|
||||||
|
Assert.Approximately(0.7, CurveMath.KeyboardInsertionX(xs, 1, 0.7, Gap, pinEnds: true), 0);
|
||||||
|
// On a point, past a pinned end or unset: the middle of the gap after the selection (before it for the last point).
|
||||||
|
Assert.Approximately(0.7, CurveMath.KeyboardInsertionX(xs, 1, 0.4, Gap, pinEnds: true), 1e-12);
|
||||||
|
Assert.Approximately(0.2, CurveMath.KeyboardInsertionX(xs, 0, double.NaN, Gap, pinEnds: true), 1e-12);
|
||||||
|
Assert.Approximately(0.7, CurveMath.KeyboardInsertionX(xs, 2, double.NaN, Gap, pinEnds: true), 1e-12);
|
||||||
|
Assert.Approximately(0.2, CurveMath.KeyboardInsertionX(xs, -1, double.NaN, Gap, pinEnds: true), 1e-12);
|
||||||
|
Assert.Approximately(0.5, CurveMath.KeyboardInsertionX([], -1, double.NaN, Gap, pinEnds: false), 0);
|
||||||
|
Assert.Approximately(0.6, CurveMath.KeyboardInsertionX([0.2], 0, double.NaN, Gap, pinEnds: false), 1e-12);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void InterpolationFollowsTheSegmentsAndIsFlatBeyondTheEnds()
|
||||||
|
{
|
||||||
|
double[] xs = [0.2, 0.6, 1];
|
||||||
|
double[] ys = [0.1, 0.5, 0.3];
|
||||||
|
Assert.Approximately(0.3, CurveMath.Interpolate(xs, ys, 0.4), 1e-12);
|
||||||
|
Assert.Approximately(0.4, CurveMath.Interpolate(xs, ys, 0.8), 1e-12);
|
||||||
|
Assert.Approximately(0.1, CurveMath.Interpolate(xs, ys, 0), 0);
|
||||||
|
Assert.Approximately(0.3, CurveMath.Interpolate(xs, ys, 1), 0);
|
||||||
|
Assert.Approximately(0.25, CurveMath.Interpolate([], [], 0.25), 0);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void HitTestPicksTheNearestPointWithinRadius()
|
public void HitTestPicksTheNearestPointWithinRadius()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Automation;
|
||||||
|
using System.Windows.Automation.Peers;
|
||||||
|
using System.Windows.Automation.Provider;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
@@ -8,8 +13,10 @@ using Titano.App.Sections;
|
|||||||
using Titano.App.Server;
|
using Titano.App.Server;
|
||||||
using Titano.App.Settings;
|
using Titano.App.Settings;
|
||||||
using Titano.App.Shell;
|
using Titano.App.Shell;
|
||||||
|
using Titano.Core.Localization;
|
||||||
using Titano.Testing;
|
using Titano.Testing;
|
||||||
using Titano.Ui.Controls;
|
using Titano.Ui.Controls;
|
||||||
|
using Titano.Ui.Mvvm;
|
||||||
using Titano.Ui.Theming;
|
using Titano.Ui.Theming;
|
||||||
using Titano.Ui.Visuals;
|
using Titano.Ui.Visuals;
|
||||||
|
|
||||||
@@ -121,6 +128,111 @@ public sealed class ScreenSmokeTests
|
|||||||
Assert.Equal(english, app.Shell.Library.Title);
|
Assert.Equal(english, app.Shell.Library.Title);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public Task ArabicMirrorsTheShellFromStartButNotItsPicturesOrLogo() => ScreenHost.RunAsync(async () =>
|
||||||
|
{
|
||||||
|
// The language is applied before the window exists, as at start-up with Arabic saved in the settings.
|
||||||
|
await using var app = await SampleApp.StartAsync("ar");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var window = app.Window;
|
||||||
|
Assert.Equal(FlowDirection.RightToLeft, window.FlowDirection, "the main window opens mirrored");
|
||||||
|
var rail = (FrameworkElement)window.FindName("Rail");
|
||||||
|
Assert.Equal(FlowDirection.RightToLeft, rail.FlowDirection, "the rail mirrors with the window");
|
||||||
|
// The window's content carries the mirror (a capture of it alone reads right to left, as on screen).
|
||||||
|
Assert.Greater(rail.TranslatePoint(new Point(rail.ActualWidth / 2, 0), window).X, window.ActualWidth / 2, "the rail starts on the right");
|
||||||
|
|
||||||
|
// The first-run dialog keeps the shell behind it out of reach.
|
||||||
|
Assert.True(app.Shell.IsWelcomeOpen);
|
||||||
|
Assert.False(rail.IsEnabled, "the rail behind the first-run dialog takes no input");
|
||||||
|
app.Shell.CompleteWelcome();
|
||||||
|
Assert.True(rail.IsEnabled);
|
||||||
|
|
||||||
|
var id = await app.Sample.FillEditorAsync();
|
||||||
|
app.Shell.OpenSequence(id);
|
||||||
|
await app.Shell.Sequence.OpenAsync(id);
|
||||||
|
var editor = Assert.NotNull(app.Shell.Sequence.Editor);
|
||||||
|
Assert.True(await editor.WhenIdleAsync(TimeSpan.FromSeconds(60)), "the editor settled");
|
||||||
|
await app.ExpectAsync<SequenceView>("sequence-ar");
|
||||||
|
|
||||||
|
// Directional glyphs follow the reading direction; the others, the logo, the picture and the charts do not.
|
||||||
|
var back = Assert.NotNull(app.FindAll<Button>().FirstOrDefault(b => b.IsVisible && ReferenceEquals(b.Command, editor.BackCommand)), "the editor's Back button");
|
||||||
|
var arrow = Descendants<Icon>(back).Single();
|
||||||
|
Assert.True(arrow.Glyph!.IsDirectional);
|
||||||
|
Assert.Equal(FlowDirection.RightToLeft, arrow.FlowDirection, "Back points the way Arabic reads");
|
||||||
|
foreach (var icon in app.FindAll<Icon>().Where(i => i.Glyph is { IsDirectional: false } && Bidi.GetIsDirectional(i) is null))
|
||||||
|
Assert.Equal(FlowDirection.LeftToRight, icon.FlowDirection, "a glyph that does not point anywhere keeps its drawing");
|
||||||
|
Assert.True(app.FindAll<BrandMarkIcon>().All(m => m.FlowDirection == FlowDirection.LeftToRight), "the logo never mirrors");
|
||||||
|
var viewport = app.FindAll<PreviewViewport>().Single(v => v.IsVisible);
|
||||||
|
Assert.Equal(FlowDirection.LeftToRight, ((FrameworkElement)viewport.Template.FindName(PreviewViewport.PartSurface, viewport)).FlowDirection, "the photo is not mirrored");
|
||||||
|
Assert.Equal(FlowDirection.RightToLeft, ((FrameworkElement)viewport.Template.FindName(PreviewViewport.PartTools, viewport)).FlowDirection, "the preview tools follow the layout");
|
||||||
|
Assert.True(app.FindAll<DrawingElement>().All(d => d.FlowDirection == FlowDirection.LeftToRight), "charts, filmstrip and curves keep their time axis");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
await app.Shell.Sequence.CloseAsync();
|
||||||
|
UiLanguage.Apply("en");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public Task ToastsDrawSpeakAndCloseAfterTheirAction() => ScreenHost.RunAsync(async () =>
|
||||||
|
{
|
||||||
|
await using var app = await SampleApp.StartAsync();
|
||||||
|
app.Shell.CompleteWelcome();
|
||||||
|
var ran = false;
|
||||||
|
app.Shell.ShowToast(new Toast { Title = "Harbour sunset rendered", ActionText = "Open", ActionCommand = new RelayCommand(() => ran = true) });
|
||||||
|
await app.ExpectAsync<LibraryView>("library-toast");
|
||||||
|
var host = app.Window.Toasts;
|
||||||
|
Assert.Equal(1, host.Toasts.Count);
|
||||||
|
var toast = Assert.NotNull(host.ItemContainerGenerator.ContainerFromIndex(0) as FrameworkElement, "the toast's container");
|
||||||
|
Assert.Greater(toast.ActualHeight, 0, "the toast is drawn");
|
||||||
|
Assert.Equal("Harbour sunset rendered", AutomationProperties.GetName(toast));
|
||||||
|
var dismiss = Descendants<Button>(toast).Single(b => ReferenceEquals(b.Command, ToastHost.DismissCommand));
|
||||||
|
Assert.Equal(Loc.L("Tooltips.Common.Dismiss"), AutomationProperties.GetName(dismiss));
|
||||||
|
|
||||||
|
var action = Descendants<Button>(toast).Single(b => b.IsVisible && !ReferenceEquals(b.Command, ToastHost.DismissCommand));
|
||||||
|
Assert.True(action.Command!.CanExecute(null));
|
||||||
|
((IInvokeProvider)new ButtonAutomationPeer(action)).Invoke();
|
||||||
|
await app.ExpectAsync<LibraryView>("library-toast-done");
|
||||||
|
Assert.True(ran, "the action ran");
|
||||||
|
Assert.Equal(0, host.Toasts.Count, "the toast closes once its action has run");
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public Task TheChromeAndTheJobBarHaveNamesAndStates() => ScreenHost.RunAsync(async () =>
|
||||||
|
{
|
||||||
|
await using var app = await SampleApp.StartAsync();
|
||||||
|
app.Shell.CompleteWelcome();
|
||||||
|
await app.ExpectAsync<LibraryView>("library-empty");
|
||||||
|
var window = app.Window;
|
||||||
|
var captions = Descendants<Button>(window).Where(b => b.Command is RoutedCommand).ToList();
|
||||||
|
Assert.Equal(Loc.L("Tooltips.Window.Minimize"), AutomationProperties.GetName(captions.Single(b => b.Command == SystemCommands.MinimizeWindowCommand)));
|
||||||
|
Assert.Equal(Loc.L("Tooltips.Window.Maximize"), AutomationProperties.GetName(captions.Single(b => b.Command == SystemCommands.MaximizeWindowCommand)));
|
||||||
|
Assert.Equal(Loc.L("Tooltips.Window.Close"), AutomationProperties.GetName(captions.Single(b => b.Command == SystemCommands.CloseWindowCommand)));
|
||||||
|
|
||||||
|
var bar = (JobBar)window.FindName("JobBar");
|
||||||
|
Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(bar));
|
||||||
|
Assert.Equal(app.Shell.JobAnnouncement, AutomationProperties.GetName(bar), "screen readers hear the job state, not its progress");
|
||||||
|
Assert.Equal(AutomationControlType.StatusBar, UIElementAutomationPeer.CreatePeerForElement(bar).GetAutomationControlType());
|
||||||
|
var pause = Descendants<Button>(bar).Single();
|
||||||
|
Assert.Equal(Loc.L("Shell.JobBar.Pause"), AutomationProperties.GetName(pause), "a short name; the sentence is the tooltip");
|
||||||
|
|
||||||
|
// A text box hands its padding to the text itself; the template adds none (8 px after a leading icon).
|
||||||
|
app.Shell.Navigate(SectionKey.Settings);
|
||||||
|
await app.ExpectAsync<SettingsView>("settings");
|
||||||
|
var boxes = app.FindAll<TextBox>().Where(t => t.IsVisible).ToList();
|
||||||
|
Assert.Contains(boxes, t => Field.GetGlyph(t) is not null);
|
||||||
|
Assert.Contains(boxes, t => Field.GetGlyph(t) is null);
|
||||||
|
foreach (var box in boxes)
|
||||||
|
{
|
||||||
|
var host = (ScrollViewer)box.Template.FindName("PART_ContentHost", box);
|
||||||
|
Assert.Equal(box.Padding, host.Padding);
|
||||||
|
Assert.Equal(new Thickness(0), ((FrameworkElement)VisualTreeHelper.GetParent(host)).Margin, "no second padding around the text");
|
||||||
|
Assert.Equal(Field.GetGlyph(box) is null ? 0.0 : 22.0, host.Margin.Left);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/// <summary>A <see cref="MainWindow"/> on capture services and sample data, shown off screen like <c>--capture</c>.</summary>
|
/// <summary>A <see cref="MainWindow"/> on capture services and sample data, shown off screen like <c>--capture</c>.</summary>
|
||||||
internal sealed class SampleApp : IAsyncDisposable
|
internal sealed class SampleApp : IAsyncDisposable
|
||||||
{
|
{
|
||||||
@@ -143,13 +255,15 @@ public sealed class ScreenSmokeTests
|
|||||||
public AppServices Services { get; }
|
public AppServices Services { get; }
|
||||||
public SampleData Sample { get; }
|
public SampleData Sample { get; }
|
||||||
public ShellViewModel Shell { get; }
|
public ShellViewModel Shell { get; }
|
||||||
|
public MainWindow Window => _window;
|
||||||
|
|
||||||
public static async Task<SampleApp> StartAsync()
|
/// <param name="language">The UI language, applied before the window is created (as at start-up).</param>
|
||||||
|
public static async Task<SampleApp> StartAsync(string language = "en")
|
||||||
{
|
{
|
||||||
var environment = AppEnvironment.ForCapture();
|
var environment = AppEnvironment.ForCapture();
|
||||||
UiLanguage.Apply("en");
|
UiLanguage.Apply(language);
|
||||||
ThemeManager.Apply(AppTheme.Dark);
|
ThemeManager.Apply(AppTheme.Dark);
|
||||||
var services = new AppServices(environment, new AppSettings { Language = "en" }, () => { }, new NoDialogs());
|
var services = new AppServices(environment, new AppSettings { Language = language }, () => { }, new NoDialogs());
|
||||||
var sample = SampleData.Configure(services);
|
var sample = SampleData.Configure(services);
|
||||||
var shell = new ShellViewModel(services);
|
var shell = new ShellViewModel(services);
|
||||||
|
|
||||||
@@ -273,6 +387,19 @@ public sealed class ScreenSmokeTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<T> Descendants<T>(DependencyObject root)
|
||||||
|
where T : DependencyObject
|
||||||
|
{
|
||||||
|
var found = new List<T>();
|
||||||
|
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(root); i++)
|
||||||
|
{
|
||||||
|
var child = VisualTreeHelper.GetChild(root, i);
|
||||||
|
if (child is T match) found.Add(match);
|
||||||
|
found.AddRange(Descendants<T>(child));
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Dialogs that answer like a user who cancels everything.</summary>
|
/// <summary>Dialogs that answer like a user who cancels everything.</summary>
|
||||||
private sealed class NoDialogs : IAppDialogs
|
private sealed class NoDialogs : IAppDialogs
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user