Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea60d58ac7 | ||
|
|
f9eb5e19eb
|
||
|
|
e696b33196
|
||
|
|
de3a7a69ca
|
||
|
|
0e048d85ad
|
||
|
|
9c1e619880 | ||
|
|
cb9d818fc5
|
||
|
|
ded58c145f
|
||
|
|
36bc62d7ba
|
||
|
|
79670fbe6f
|
||
|
|
4507faa6b3
|
||
|
|
24cf5f04f7 | ||
|
|
d95db53a2e
|
||
|
|
7d9fe19023
|
||
|
|
cb1386cc9a
|
||
|
|
2741691c81
|
||
|
|
32f97fac69
|
||
|
|
47dae756d9
|
||
|
|
ee696465ad
|
||
|
|
d054902117
|
||
|
|
df3b9e3753 | ||
|
|
5724855f63 | ||
|
|
4de305d3ae | ||
|
|
3ab59b443f |
No files matched your search
@@ -10,11 +10,11 @@
|
||||
"rollForward": false
|
||||
},
|
||||
"dotnet-sonarscanner": {
|
||||
"version": "12.0.0",
|
||||
"version": "12.1.0",
|
||||
"commands": [
|
||||
"dotnet-sonarscanner"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,3 +32,73 @@ indent_size = 2
|
||||
# Generated files: relax style enforcement
|
||||
[*.{g,g.i,Designer}.cs]
|
||||
generated_code = true
|
||||
|
||||
# --- ReSharper inspections: what Qodana reads (qodana.yaml, .github/workflows/qodana.yml) ---
|
||||
# Qodana for .NET runs ReSharper's engine, and the engine reads these keys; so does Rider or ReSharper in the editor,
|
||||
# which is why they are here and not in qodana.yaml: the same list everywhere. An inspection is off only where it
|
||||
# argues with a choice this project made; each line says which. Everything else it reports is fixed. (What is NOT
|
||||
# ReSharper's - a whole severity, the IntelliJ platform's inspections, JetBrains' security rules, a file the engine
|
||||
# itself misreads - is in qodana.yaml.)
|
||||
[*.{cs,xaml}]
|
||||
# A code-behind class names its base so that the type reads whole without the half XAML generates.
|
||||
resharper_redundant_extends_list_entry_highlighting = none
|
||||
# An argument that repeats a default says which value the call relies on (updateAccent: true, Mica, Hide(None)).
|
||||
resharper_redundant_argument_default_value_highlighting = none
|
||||
# `partial void OnXChanged(T value)`: the signature is CommunityToolkit.Mvvm's generator's, used or not.
|
||||
resharper_unused_parameter_in_partial_method_highlighting = none
|
||||
# WPF UI's implicit styles (BasedOn {x:Type ui:Button}, ui:Card) arrive with ui:ControlsDictionary at run time, from
|
||||
# a package's compiled resources the inspection does not read. A key that does not exist fails as the page loads.
|
||||
resharper_xaml_static_resource_not_resolved_highlighting = none
|
||||
# Pages get their DataContext in code (ShellPageProvider) and item templates bind to view-models the XAML does not
|
||||
# declare, so the engine cannot resolve those bindings; it would ask for design-time types on every page. The
|
||||
# accessibility tests check what the bindings must provide (names for every control and list item).
|
||||
resharper_xaml_binding_with_context_not_resolved_highlighting = none
|
||||
# Proposals, not findings - ReSharper's suggestions for a style this project did not take. Its style is this file,
|
||||
# `dotnet format` and the analyzers the build treats as errors (SonarAnalyzer included).
|
||||
resharper_convert_to_primary_constructor_highlighting = none
|
||||
resharper_merge_into_pattern_highlighting = none
|
||||
resharper_use_utf8_string_literal_highlighting = none
|
||||
resharper_arrange_object_creation_when_type_evident_highlighting = none
|
||||
resharper_convert_closure_to_method_group_highlighting = none
|
||||
resharper_use_collection_expression_highlighting = none
|
||||
resharper_convert_to_auto_property_highlighting = none
|
||||
# The streams and pipes these name are closed synchronously on purpose; `await using` would add a ConfigureAwait to
|
||||
# every one without closing them any sooner.
|
||||
resharper_use_await_using_highlighting = none
|
||||
# A member's accessibility is what its type offers, not a count of today's callers.
|
||||
resharper_member_can_be_private_global_highlighting = none
|
||||
resharper_property_can_be_made_init_only_global_highlighting = none
|
||||
resharper_auto_property_can_be_made_get_only_global_highlighting = none
|
||||
# "Never used" across the solution is not what decides for a member other code can reach: a view-model's properties
|
||||
# and commands are read by XAML bindings the engine cannot resolve (above), the product links by x:Static, and a
|
||||
# model's members by System.Text.Json. The private kind (.Local) stays on.
|
||||
resharper_unused_member_global_highlighting = none
|
||||
resharper_unused_auto_property_accessor_global_highlighting = none
|
||||
resharper_unused_method_return_value_global_highlighting = none
|
||||
resharper_unused_parameter_global_highlighting = none
|
||||
resharper_class_never_instantiated_global_highlighting = none
|
||||
resharper_event_never_subscribed_to_global_highlighting = none
|
||||
resharper_collection_never_queried_global_highlighting = none
|
||||
# The compiler's nullable analysis is the gate (warnings are errors). These three go further and call a guard
|
||||
# redundant because an annotation promises non-null - where a JSON file read from disk, a dependency property or a
|
||||
# WPF event hands over null all the same (the corrupt-file tests rely on those guards).
|
||||
resharper_null_coalescing_condition_is_always_not_null_according_to_api_contract_highlighting = none
|
||||
resharper_conditional_access_qualifier_is_non_nullable_according_to_api_contract_highlighting = none
|
||||
resharper_condition_is_always_true_or_false_according_to_nullable_api_contract_highlighting = none
|
||||
# A record's positional property is part of its equality and of what it prints, and XAML binds to it by name.
|
||||
resharper_not_accessed_positional_property_global_highlighting = none
|
||||
resharper_not_accessed_positional_property_local_highlighting = none
|
||||
# `default: break;` is how a switch says the rest is left alone on purpose (and Sonar S131 asks for the default).
|
||||
resharper_redundant_empty_switch_section_highlighting = none
|
||||
# Async void only for event handlers (CLAUDE.md), which is what these are.
|
||||
resharper_async_void_event_handler_method_highlighting = none
|
||||
|
||||
[*.resx]
|
||||
# A vi, ja, zh-Hans or es value that equals the English one is deliberate: product, tool and command names (winget,
|
||||
# DISM, SFC), units and format strings are not translated.
|
||||
resharper_overridden_with_same_value_highlighting = none
|
||||
|
||||
[tests/**/*.cs]
|
||||
# A test's lambda runs inside the `using` scope it captures from, and reads a variable the test changes on purpose.
|
||||
resharper_access_to_disposed_closure_highlighting = none
|
||||
resharper_access_to_modified_closure_highlighting = none
|
||||
+42
-5
@@ -4,6 +4,32 @@ Thanks for your interest! CommandForge is a GPLv3, offline-first Windows tool th
|
||||
system-level commands, so **safety and clarity matter more than speed**. Please read this before
|
||||
opening an issue or pull request.
|
||||
|
||||
## Maintenance mode: what we accept
|
||||
|
||||
**CommandForge is stable and in maintenance mode** since version 2.2.0 (November 2026). It does
|
||||
what it set out to do — run vetted Windows maintenance commands from a safe, categorized window —
|
||||
so the work now goes into keeping it secure, correct and accessible, not into new features.
|
||||
|
||||
**Still done:**
|
||||
|
||||
1. **Dependency updates**, regularly.
|
||||
2. **Security fixes.** A High or Critical vulnerability in a dependency or in the toolchain — for
|
||||
example the .NET runtime the app ships with, or Node.js, which the build's GitHub Actions run
|
||||
on — gets an urgent patch release; a Moderate one goes into the next routine update. A new
|
||||
feature is added only when it is genuinely necessary, for example to keep the app safe or
|
||||
working on a new Windows build.
|
||||
3. **Major platform updates**, such as moving to a newer .NET.
|
||||
4. **Issues and pull requests** that add or remove catalog commands; fix bugs, UI/UX problems or
|
||||
accessibility barriers; or fix commands that are outdated, use the wrong syntax or could be
|
||||
harmful (a harmful one is reported privately, see [SECURITY.md](SECURITY.md)).
|
||||
5. **Translation fixes** for English, Vietnamese, Japanese, Simplified Chinese and Spanish: wording
|
||||
that doesn't suit the culture or the local tone, and spelling that could mislead.
|
||||
|
||||
**Not accepted:** issues and pull requests for new features, unless the feature clearly fits the
|
||||
project and is genuinely necessary; others are closed with a link to this section. Ideas are welcome
|
||||
in [Discussions › Ideas](https://github.com/poli0981/CommandForge/discussions/categories/ideas),
|
||||
without any commitment.
|
||||
|
||||
## Quick start
|
||||
|
||||
Requires Windows 10 22H2 / 11 and the .NET 10 SDK.
|
||||
@@ -19,12 +45,17 @@ See [BUILD.md](../BUILD.md) for packaging and CI.
|
||||
|
||||
## Reporting issues
|
||||
|
||||
- Use the issue templates (Bug report / Feature request).
|
||||
- Use the issue forms: **Bug report**, **Command — add, fix or remove**, **Translation fix**,
|
||||
**Accessibility problem**, and **Feature request** (within the policy above).
|
||||
- **Get straight to the point**: what you expected, what happened, exact steps, your Windows
|
||||
version/build and the app version (**More → About** in the app).
|
||||
- For **security vulnerabilities, do NOT open a public issue** — see [SECURITY.md](SECURITY.md).
|
||||
- Questions and ideas: [Discussions](https://github.com/poli0981/CommandForge/discussions), or
|
||||
email [code@poli0981.dev](mailto:code@poli0981.dev).
|
||||
- Questions: [Discussions](https://github.com/poli0981/CommandForge/discussions); ideas:
|
||||
[Discussions › Ideas](https://github.com/poli0981/CommandForge/discussions/categories/ideas),
|
||||
without commitment; or email [code@poli0981.dev](mailto:code@poli0981.dev).
|
||||
- An accessibility barrier can also go to
|
||||
[accessibility@poli0981.dev](mailto:accessibility@poli0981.dev) — see
|
||||
[ACCESSIBILITY.md](../ACCESSIBILITY.md).
|
||||
|
||||
## Pull requests
|
||||
|
||||
@@ -38,8 +69,9 @@ See [BUILD.md](../BUILD.md) for packaging and CI.
|
||||
messages follow [Conventional Commits](https://www.conventionalcommits.org/)
|
||||
(`fix(catalog): …`, `feat(ui): …`).
|
||||
- PRs need the required checks to pass: `build`, `package`, CodeQL (`Analyze (csharp)`,
|
||||
`Analyze (actions)`) and `dependency-review`. The SonarCloud quality gate is reported on PRs from
|
||||
this repository too (fork PRs don't get the analysis token).
|
||||
`Analyze (actions)`) and `dependency-review`. The SonarCloud quality gate and the Qodana report
|
||||
(zero problems expected) are shown on PRs from this repository too (fork PRs don't get the
|
||||
analysis tokens).
|
||||
- **Dependencies:** package versions live in each `.csproj` (GitHub's dependency graph doesn't read
|
||||
`Directory.Packages.props`). Discuss a new package before adding it; runtime dependencies must be
|
||||
GPLv3-compatible (dependency review enforces a license allow-list).
|
||||
@@ -47,6 +79,11 @@ See [BUILD.md](../BUILD.md) for packaging and CI.
|
||||
languages: `Strings.resx` (English), `Strings.vi.resx`, `Strings.ja.resx`, `Strings.zh-Hans.resx`
|
||||
and `Strings.es.resx`. A test fails when a key the UI uses is missing from any of them.
|
||||
Machine-translated text is fine if you say so; native-speaker fixes are very welcome.
|
||||
- **Accessibility:** every control that shows no text gets an `AutomationProperties.Name` from the
|
||||
`.resx`; list items are named by what they show (an `ItemContainerStyle`); icons are
|
||||
`ctl:DecorativeIcon`, which keeps their glyphs from screen readers; nothing is shown by colour
|
||||
alone. The accessibility tests check most of this; say in the PR what you tried with the keyboard
|
||||
alone and with Narrator ([ACCESSIBILITY.md](../ACCESSIBILITY.md#for-contributors)).
|
||||
- **Disclose AI assistance.** AI-assisted contributions are welcome — just say so in the PR
|
||||
description.
|
||||
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
# ACCESSIBILITY.md sends every accessibility barrier here. It is its own form rather than part of the
|
||||
# bug report because a barrier needs different facts: what the reporter uses to read or operate the
|
||||
# screen, and how far it stops them. Nothing here asks about the reporter themself.
|
||||
name: Accessibility problem
|
||||
description: Something in CommandForge can't be reached, read or seen — with the keyboard, a screen reader, a contrast theme, Magnifier, a larger text size or another aid
|
||||
labels: ["accessibility"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for telling us. **You never need to tell us anything about yourself or a disability** — what you use
|
||||
and what happened is enough. Screenshots and recordings help but are optional. Accessibility fixes are always
|
||||
in scope.
|
||||
|
||||
If you couldn't read or answer a **Caution or Dangerous confirmation**, say so below: it is a safety problem
|
||||
too, and it is handled first.
|
||||
|
||||
Rather not use GitHub, or not post in public? Write to **accessibility@poli0981.dev** instead. What CommandForge
|
||||
aims for and what it can't do yet: [ACCESSIBILITY.md](../blob/main/ACCESSIBILITY.md).
|
||||
|
||||
- type: textarea
|
||||
id: task
|
||||
attributes:
|
||||
label: What were you trying to do?
|
||||
placeholder: "e.g. run a command from the catalog, read a command's output, change the theme"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: What happened instead?
|
||||
description: What you heard, saw or could not do — and what you expected.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: How to get there
|
||||
placeholder: |
|
||||
1. Open the catalog (Ctrl+F)
|
||||
2. Tab to …
|
||||
3. …
|
||||
|
||||
- type: input
|
||||
id: app-version
|
||||
attributes:
|
||||
label: CommandForge version
|
||||
description: More (⋯) → About, or Settings → About
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: os
|
||||
attributes:
|
||||
label: Windows version
|
||||
placeholder: "Windows 11 24H2 (26100) — run winver"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: aid
|
||||
attributes:
|
||||
label: What do you use?
|
||||
multiple: true
|
||||
options:
|
||||
- Keyboard only
|
||||
- Narrator
|
||||
- NVDA
|
||||
- JAWS
|
||||
- Windows Magnifier
|
||||
- A Windows contrast theme
|
||||
- A larger text size or display scaling
|
||||
- Voice Access or other speech input
|
||||
- Something else (say below)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: aid-version
|
||||
attributes:
|
||||
label: Its version, if you know it
|
||||
placeholder: "e.g. NVDA 2026.1"
|
||||
|
||||
- type: dropdown
|
||||
id: severity
|
||||
attributes:
|
||||
label: How much does it stop you?
|
||||
description: Optional — the maintainer sets it when reading the report (ACCESSIBILITY.md, "How serious it is").
|
||||
options:
|
||||
- Not sure
|
||||
- Critical — I can't do the task at all
|
||||
- Serious — only with great difficulty or a workaround
|
||||
- Moderate — it is tiring or inconsistent
|
||||
- Minor — it barely gets in the way
|
||||
|
||||
- type: textarea
|
||||
id: more
|
||||
attributes:
|
||||
label: Anything else
|
||||
description: A screenshot, a recording, or the log file from More (⋯) → Report a bug (you review it before attaching).
|
||||
@@ -9,6 +9,10 @@ body:
|
||||
closed (see [CONTRIBUTING.md](../blob/main/.github/CONTRIBUTING.md)).
|
||||
**Do not report security vulnerabilities here** — use
|
||||
[private reporting](../security/advisories/new) instead.
|
||||
|
||||
A catalog command that is outdated or uses the wrong syntax has its own form (**Command — add,
|
||||
fix or remove**), and so does a barrier for the keyboard, a screen reader or larger text
|
||||
(**Accessibility problem**). In the app, **More (⋯) → Report a bug** fills this form in.
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
@@ -30,7 +34,7 @@ body:
|
||||
id: app-version
|
||||
attributes:
|
||||
label: CommandForge version
|
||||
description: More (⋯) → About, or Settings → About (e.g. 2.0.0)
|
||||
description: More (⋯) → About CommandForge (e.g. 2.2.0)
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
@@ -45,8 +49,8 @@ body:
|
||||
attributes:
|
||||
label: Logs (optional)
|
||||
description: |
|
||||
Optionally attach exported logs (Tools → Export logs). **Review them first** — they may
|
||||
contain machine-specific paths/names. Do not paste secrets.
|
||||
Optionally attach the log from **More (⋯) → Report a bug → Export log (.zip)**. **Review it
|
||||
first** — it may contain machine-specific paths and names. Do not paste secrets.
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
name: Command — add, fix or remove
|
||||
description: Propose a catalog command, or report one that is outdated or uses the wrong syntax
|
||||
labels: ["catalog"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Every command in CommandForge is a vetted entry of its read-only catalog. A request is checked
|
||||
against Microsoft's documentation and tried before it ships — see
|
||||
[Adding a command](../blob/main/.github/CONTRIBUTING.md#adding-a-command).
|
||||
|
||||
**A command that could cause harm** — it deletes what it shouldn't, weakens security, or does
|
||||
something other than it says — is a security problem: report it
|
||||
[privately](../security/advisories/new), not here.
|
||||
- type: dropdown
|
||||
id: request
|
||||
attributes:
|
||||
label: What should change?
|
||||
options:
|
||||
- Add a command
|
||||
- Fix a command (outdated, wrong syntax, wrong danger level)
|
||||
- Remove a command
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: command
|
||||
attributes:
|
||||
label: Command (to fix or remove)
|
||||
description: Its title as the app shows it, or its ID from the command's details.
|
||||
placeholder: e.g. Flush DNS cache (net.flushdns)
|
||||
- type: textarea
|
||||
id: command-line
|
||||
attributes:
|
||||
label: Command line
|
||||
description: The exact command line it should run (for a new or fixed command).
|
||||
render: shell
|
||||
- type: textarea
|
||||
id: purpose
|
||||
attributes:
|
||||
label: What it does and why
|
||||
description: What the command does and who needs it; for a fix, what goes wrong today.
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: danger-level
|
||||
attributes:
|
||||
label: Danger level
|
||||
description: |
|
||||
Safe: read-only or undone the way it was made. Caution: changes system state, recoverable.
|
||||
Dangerous: may lose data or leave Windows unstable.
|
||||
options:
|
||||
- Safe
|
||||
- Caution
|
||||
- Dangerous
|
||||
- Not sure
|
||||
- type: dropdown
|
||||
id: admin
|
||||
attributes:
|
||||
label: Needs administrator rights?
|
||||
options:
|
||||
- "Yes"
|
||||
- "No"
|
||||
- Not sure
|
||||
- type: input
|
||||
id: windows-versions
|
||||
attributes:
|
||||
label: Windows versions
|
||||
description: Where it works, or where it stopped working.
|
||||
placeholder: e.g. Windows 11 24H2 and later
|
||||
- type: textarea
|
||||
id: sources
|
||||
attributes:
|
||||
label: Sources
|
||||
description: Microsoft's documentation, or another reliable reference for the command and its syntax.
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: Confirmations
|
||||
options:
|
||||
- label: The command is a tool that comes with Windows (nothing downloaded from elsewhere).
|
||||
required: true
|
||||
- label: It is not a command that could cause harm (those go through private reporting).
|
||||
required: true
|
||||
@@ -1,8 +1,14 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Security vulnerability (private)
|
||||
- name: Security vulnerability or harmful command (private)
|
||||
url: https://github.com/poli0981/CommandForge/security/advisories/new
|
||||
about: Report security vulnerabilities privately — do NOT open a public issue.
|
||||
about: Report security vulnerabilities, and catalog commands that could cause harm, privately — do NOT open a public issue.
|
||||
- name: Idea (no commitment)
|
||||
url: https://github.com/poli0981/CommandForge/discussions/categories/ideas
|
||||
about: CommandForge is in maintenance mode; ideas are welcome in Discussions, without commitment.
|
||||
- name: Question / discussion
|
||||
url: https://github.com/poli0981/CommandForge/discussions
|
||||
about: Ask a question or discuss ideas before filing an issue.
|
||||
about: Ask a question before filing an issue.
|
||||
- name: Accessibility statement
|
||||
url: https://github.com/poli0981/CommandForge/blob/main/ACCESSIBILITY.md
|
||||
about: What works with the keyboard, screen readers and larger text, and the known limitations.
|
||||
@@ -1,13 +1,24 @@
|
||||
name: Feature request
|
||||
description: Suggest a feature or a new command for the catalog
|
||||
description: A new feature, only when it fits the project and is genuinely necessary (maintenance mode)
|
||||
labels: ["enhancement"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for the idea. Keep it concise and specific. For a **new command**, note that every
|
||||
command must be a vetted, read-only catalog entry (no arbitrary execution) — see
|
||||
[CONTRIBUTING.md](../blob/main/.github/CONTRIBUTING.md).
|
||||
**CommandForge is in maintenance mode.** A new feature is added only when it clearly fits the
|
||||
project and is genuinely necessary — for example, to keep the app safe or working on a new
|
||||
Windows build. Other requests are closed with a link to
|
||||
[the policy](../blob/main/.github/CONTRIBUTING.md#maintenance-mode-what-we-accept).
|
||||
|
||||
- A catalog command to add, fix or remove has its own form: **Command — add, fix or remove**.
|
||||
- An idea to share, without commitment: [Discussions › Ideas](../discussions/categories/ideas).
|
||||
- type: checkboxes
|
||||
id: scope
|
||||
attributes:
|
||||
label: Maintenance mode
|
||||
options:
|
||||
- label: I have read the maintenance-mode policy, and this is not a catalog command.
|
||||
required: true
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
@@ -15,11 +26,18 @@ body:
|
||||
description: What are you trying to do, and why is it hard today?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: necessity
|
||||
attributes:
|
||||
label: Why is it necessary?
|
||||
description: What breaks, or stays unsafe or out of reach, without it? An idea that is nice to have belongs in Discussions › Ideas.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: Proposed solution
|
||||
description: What should CommandForge do? For a new command, give the exact command line and its danger level.
|
||||
description: What should CommandForge do?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
name: Translation fix
|
||||
description: Wording that doesn't suit the culture or the local tone, or spelling that could mislead
|
||||
labels: ["translation"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
CommandForge is shown in English, Vietnamese, Japanese, Simplified Chinese and Spanish. The
|
||||
text other than English is AI-translated, so corrections from people who speak the language
|
||||
are very welcome.
|
||||
- type: dropdown
|
||||
id: language
|
||||
attributes:
|
||||
label: Language
|
||||
options:
|
||||
- English
|
||||
- Tiếng Việt
|
||||
- 日本語
|
||||
- 简体中文
|
||||
- Español
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: where
|
||||
attributes:
|
||||
label: Where in the app
|
||||
placeholder: e.g. Settings › Appearance, or the confirmation of a Dangerous command
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: current
|
||||
attributes:
|
||||
label: Text today
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: suggestion
|
||||
attributes:
|
||||
label: Suggested text
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: reason
|
||||
attributes:
|
||||
label: What is wrong with it?
|
||||
options:
|
||||
- It doesn't suit the culture or the local tone
|
||||
- The spelling or wording could mislead
|
||||
- The meaning is wrong
|
||||
- Something else
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: more
|
||||
attributes:
|
||||
label: Anything else
|
||||
description: Why the suggested text is better, or other places with the same wording.
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: Confirmations
|
||||
options:
|
||||
- label: I'm using the latest release (the text may have changed already).
|
||||
required: true
|
||||
@@ -11,6 +11,12 @@ Do NOT delete tests or use --no-verify to bypass hooks.
|
||||
|
||||
<!-- e.g. Closes #123 -->
|
||||
|
||||
## Scope
|
||||
|
||||
<!-- CommandForge is in maintenance mode: .github/CONTRIBUTING.md#maintenance-mode-what-we-accept -->
|
||||
|
||||
- [ ] This is within maintenance mode: a dependency or security update, a platform update, a catalog command added, fixed or removed, a bug, UI/UX or accessibility fix, or a translation fix — or a new feature agreed in an issue as genuinely necessary
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] `dotnet build -c Release` passes with **0 warnings**
|
||||
@@ -20,4 +26,5 @@ Do NOT delete tests or use --no-verify to bypass hooks.
|
||||
- [ ] My commits are signed (`main` requires verified signatures)
|
||||
- [ ] New or changed UI text is in all five `Strings*.resx` files (EN, VI, JA, zh-Hans, ES) — no hardcoded strings
|
||||
- [ ] If I added a command: it's a vetted catalog entry with correct `requiresAdmin`/`dangerLevel`, strings in all five languages, and no arbitrary-execution path
|
||||
- [ ] If I changed a screen: every control without text has an `AutomationProperties.Name` from the `.resx`, list items are named by what they show, icons are `ctl:DecorativeIcon`, and I tried it with the keyboard alone (and Narrator if I could) — see [ACCESSIBILITY.md](../ACCESSIBILITY.md#for-contributors)
|
||||
- [ ] **AI disclosure:** I have disclosed any AI assistance used (delete if none)
|
||||
+9
-3
@@ -6,11 +6,16 @@ CommandForge runs system-level commands, some as administrator, so security is a
|
||||
|
||||
| Version | Supported |
|
||||
|---|---|
|
||||
| 2.0.x (latest) | ✅ |
|
||||
| < 2.0 | ❌ — please update |
|
||||
| 2.2.x (latest) | ✅ |
|
||||
| < 2.2 | ❌ — please update |
|
||||
|
||||
Only the **latest release** receives security fixes. Please update before reporting.
|
||||
|
||||
CommandForge is in **maintenance mode** since 2.2.0, and security work goes on: a High or Critical
|
||||
vulnerability in CommandForge, a dependency or the toolchain (the .NET runtime it ships with, for
|
||||
example) gets an urgent patch release; a Moderate one goes into the next routine update. A catalog
|
||||
command that could cause harm is reported here too, privately.
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
**Do not open a public issue for security vulnerabilities.** Report privately in either of these ways:
|
||||
@@ -93,7 +98,8 @@ and some antivirus engines may show false positives (common for admin tools). In
|
||||
- The code is **not obfuscated** (obfuscation is a leading cause of false positives), and the
|
||||
source is public under the GPLv3.
|
||||
- CI runs **CodeQL** (C# and GitHub Actions), **dependency review**, **OpenSSF Scorecard**,
|
||||
**SonarCloud** and **Snyk**; every restore audits direct and transitive NuGet packages;
|
||||
**SonarCloud**, **Qodana** (JetBrains' inspections and security rules) and **Snyk**; every
|
||||
restore audits direct and transitive NuGet packages;
|
||||
Dependabot keeps dependencies and the SHA-pinned actions current; `main` only accepts pull
|
||||
requests that pass the required checks.
|
||||
|
||||
|
||||
+13
-3
@@ -8,10 +8,16 @@ updates:
|
||||
open-pull-requests-limit: 5
|
||||
commit-message:
|
||||
prefix: "deps"
|
||||
labels: ["dependencies", "nuget"]
|
||||
# Labels that exist in the repository (a missing label is silently dropped).
|
||||
labels: ["dependencies", ".NET"]
|
||||
cooldown:
|
||||
default-days: 3
|
||||
semver-major-days: 14
|
||||
# The app stays on the .NET 10 LTS line: Microsoft.Extensions.* majors follow .NET majors, and
|
||||
# moving to a new .NET major is a deliberate migration done by hand, not a Dependabot bump.
|
||||
ignore:
|
||||
- dependency-name: "Microsoft.Extensions.*"
|
||||
update-types: ["version-update:semver-major"]
|
||||
groups:
|
||||
microsoft-extensions:
|
||||
patterns: ["Microsoft.Extensions.*"]
|
||||
@@ -33,7 +39,11 @@ updates:
|
||||
day: monday
|
||||
commit-message:
|
||||
prefix: "build"
|
||||
labels: ["dependencies", "dotnet-sdk"]
|
||||
labels: ["dependencies", ".NET"]
|
||||
# Patch and feature-band SDKs only; a new .NET major (11, 12…) is moved to by hand.
|
||||
ignore:
|
||||
- dependency-name: "*"
|
||||
update-types: ["version-update:semver-major"]
|
||||
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
@@ -43,7 +53,7 @@ updates:
|
||||
open-pull-requests-limit: 5
|
||||
commit-message:
|
||||
prefix: "ci"
|
||||
labels: ["dependencies", "github-actions"]
|
||||
labels: ["dependencies", "github_actions"]
|
||||
cooldown:
|
||||
default-days: 3
|
||||
groups:
|
||||
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- if: matrix.language == 'csharp'
|
||||
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
@@ -62,6 +62,6 @@ jobs:
|
||||
run: dotnet build CommandForge.slnx -c Release -p:RunAnalyzers=false
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
|
||||
with:
|
||||
category: "/language:${{ matrix.language }}"
|
||||
@@ -1,11 +1,11 @@
|
||||
name: Notify CI Failure
|
||||
|
||||
# Posts a Discord alert when the Build or SonarCloud workflow fails on main (reuses the shared
|
||||
# workflow in poli0981/.github). Requires repo secret DISCORD_CI_WEBHOOK.
|
||||
# Posts a Discord alert when the Build, SonarCloud or Qodana workflow fails on main (reuses the
|
||||
# shared workflow in poli0981/.github). Requires repo secret DISCORD_CI_WEBHOOK.
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build", "SonarCloud"]
|
||||
workflows: ["Build", "SonarCloud", "Qodana"]
|
||||
types: [completed]
|
||||
|
||||
# The reusable workflow requests actions: read; without granting it here every run was a
|
||||
@@ -16,7 +16,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
notify:
|
||||
# Both workflows only run on `push` for main, so this limits alerts to main without trusting
|
||||
# The three workflows only run on `push` for main, so this limits alerts to main without trusting
|
||||
# forgeable values (branch names, actor logins) — and skips pull-request runs (including
|
||||
# Dependabot's), which have no access to the webhook secret anyway.
|
||||
if: >-
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
name: Qodana
|
||||
|
||||
# JetBrains Qodana for .NET (`qodana-dotnet`, Rider's engine, on the Ultimate licence of the Qodana
|
||||
# Cloud project): ReSharper's C#, XAML and .resx inspections, the IntelliJ platform's Markdown and XML
|
||||
# inspections and JetBrains' security rules, over the whole solution. Results go to Qodana Cloud, to
|
||||
# annotations and a summary comment on the pull request, and to the run's `qodana-report` artifact
|
||||
# (SARIF and the linter's logs, for a reader without a Qodana Cloud account).
|
||||
#
|
||||
# - Native mode on a Windows runner (qodana.yaml: `withinDocker: false`): WPF (net10.0-windows) only
|
||||
# loads on Windows, and the linter reads the projects with the SDK this job installs from
|
||||
# global.json. Every setting is in qodana.yaml; nothing is an action argument.
|
||||
# - The solution is built first, so a build that fails is one red step with the compiler's own
|
||||
# message rather than a report of unresolved symbols.
|
||||
# - `pr-mode: false`: the whole solution every time, so a pull request and `main` are judged by the
|
||||
# same list. The gate (qodana.yaml) is zero problems.
|
||||
# - Advisory: not a required check of the `main` ruleset, so a finding, a Qodana Cloud outage or a
|
||||
# lapsed licence is a red job beside a green build, never a blocked merge.
|
||||
# - No `contents: write`: the job never pushes quick-fixes.
|
||||
# Requires the repository secret QODANA_TOKEN.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
env:
|
||||
DOTNET_NOLOGO: true
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||
|
||||
jobs:
|
||||
token:
|
||||
# Pull requests from forks and from Dependabot get no repository secrets. Checking for the token
|
||||
# skips those runs without trusting actor or repository names from the event.
|
||||
name: Check for QODANA_TOKEN
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions: {}
|
||||
outputs:
|
||||
available: ${{ steps.check.outputs.available }}
|
||||
steps:
|
||||
- name: Check for QODANA_TOKEN
|
||||
id: check
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
run: |
|
||||
if [ -n "$QODANA_TOKEN" ]; then
|
||||
echo "available=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "available=false" >> "$GITHUB_OUTPUT"
|
||||
echo "::notice::QODANA_TOKEN is not available to this run (fork or Dependabot pull request); skipping the analysis."
|
||||
fi
|
||||
|
||||
qodana:
|
||||
name: Qodana
|
||||
needs: token
|
||||
if: needs.token.outputs.available == 'true'
|
||||
# WPF (net10.0-windows) only builds on Windows, and the linter runs natively beside the SDK.
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 60
|
||||
permissions:
|
||||
contents: read
|
||||
checks: write # the annotations
|
||||
pull-requests: write # the summary comment
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
# The pull request's own commit, not its merge commit (empty on a push or a dispatch, which
|
||||
# then check out the commit that started them).
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
fetch-depth: 0 # full history: Qodana's reports are VCS-aware
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
# Outside the workspace: the linter reads every file under the repository root.
|
||||
- name: Cache NuGet packages
|
||||
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: nuget-qodana-${{ runner.os }}-${{ hashFiles('global.json', 'Directory.Build.props', '**/*.csproj') }}
|
||||
restore-keys: nuget-qodana-${{ runner.os }}-
|
||||
|
||||
- name: Restore
|
||||
run: dotnet restore CommandForge.slnx
|
||||
|
||||
- name: Build what the linter loads
|
||||
run: dotnet build CommandForge.slnx -c Release --no-restore
|
||||
|
||||
# Caches are saved from `main` only (a pull request reads them), under keys of this job's own.
|
||||
- name: Qodana Scan
|
||||
uses: JetBrains/qodana-action@3e8d76ff0e0241618abd808682f426afe84bab3f # v2026.2.2
|
||||
with:
|
||||
pr-mode: false
|
||||
upload-result: true
|
||||
artifact-name: qodana-report
|
||||
cache-default-branch-only: true
|
||||
primary-cache-key: qodana-${{ github.ref_name }}-${{ github.sha }}
|
||||
additional-cache-key: qodana-main
|
||||
env:
|
||||
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
|
||||
QODANA_ENDPOINT: https://qodana.cloud
|
||||
@@ -44,7 +44,7 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
|
||||
@@ -40,6 +40,6 @@ jobs:
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
- uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
- uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
fetch-depth: 0 # full history: SonarCloud uses blame to tell new code from old
|
||||
persist-credentials: false
|
||||
|
||||
- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
|
||||
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
# Accessibility
|
||||
|
||||
CommandForge should be usable by everyone who maintains a Windows PC — with a keyboard alone, with
|
||||
a screen reader, with a Windows contrast theme or Magnifier, with larger text, and without telling
|
||||
colours apart. This page says what CommandForge aims for, what works today, how that is checked,
|
||||
what does not work yet and what to do instead, and how to tell us about a barrier. It is written
|
||||
for the person who has just met one.
|
||||
|
||||
CommandForge is a desktop program: its own window, its dialogs and the notifications it shows.
|
||||
The commands it runs are Windows' own tools (winget, DISM, PowerShell and others), so the text
|
||||
they print is theirs.
|
||||
|
||||
*Last reviewed on 2026-11-16 for version 2.2.0 by the maintainer, poli0981. In the app: More (⋯) ▸
|
||||
About CommandForge ▸ Accessibility.*
|
||||
|
||||
## What CommandForge aims for
|
||||
|
||||
- **WCAG 2.2 at level AA**, applied to desktop software as W3C's
|
||||
[WCAG2ICT](https://www.w3.org/TR/wcag2ict-22/) guidance explains. This is a goal that guides the
|
||||
work, not a claim: no formal evaluation has been made, and CommandForge does not say it conforms
|
||||
to any standard.
|
||||
- **Every task can be done with the keyboard alone.**
|
||||
- **A screen reader can read every control and every value**, in the language CommandForge is shown
|
||||
in, and hears what changes: a command starting, needing permission, finishing.
|
||||
- **Text and controls keep their contrast** in the light and the dark theme and under Windows
|
||||
contrast themes, and **colour is never the only way something is shown.**
|
||||
- **Text follows your size settings**: the app's own font size and Windows' Text size.
|
||||
|
||||
Accessibility fixes are always in scope, whatever else the project is or isn't taking on.
|
||||
|
||||
## What works today
|
||||
|
||||
### The keyboard
|
||||
|
||||
| Keys | What they do |
|
||||
|---|---|
|
||||
| **Tab** and **Shift+Tab** | Move through a page or a dialog in reading order. In a list, Tab moves into the buttons of the selected row (its star, Undo, Run again). |
|
||||
| The **arrow keys** | Move inside a list: commands, History, the console's output, the Log viewer, the Command Palette's results. On a splitter, they resize the panes. |
|
||||
| **F6** and **Shift+F6** | Jump between the navigation pane, the page and the console. |
|
||||
| **Enter** or **Space** | Press the button, switch or box that has the focus. **Enter** on a command in the catalog moves to its **Run** button; on a run in History it opens that command; in the Command Palette it opens the highlighted one. |
|
||||
| **Esc** | Closes a dialog the way its **Cancel** or **Close** button does: nothing is changed. |
|
||||
| **Ctrl+K**, **Ctrl+F**, **Ctrl+H**, **Ctrl+,**, **Ctrl+L** | Open the Command Palette, search the current list, Home, Settings, the Log viewer — and move the keyboard into that page. |
|
||||
|
||||
Every shortcut is in the user guide, under [Keyboard shortcuts](USAGE.md#keyboard-shortcuts), and in
|
||||
the app under More (⋯) ▸ Keyboard shortcuts.
|
||||
|
||||
- **A risky command can't be run by accident.** A Caution command asks first, with **Cancel**
|
||||
focused and as the default; a Dangerous one waits until its name or ID is typed — the ID is read
|
||||
out with the box.
|
||||
- **Ctrl+Q does nothing while you are typing** in a text box (other than a search box), so a slip
|
||||
can't close the app in the middle of an edit.
|
||||
|
||||
### Screen readers
|
||||
|
||||
- **Every button, switch, box and list item has a name**, from the same translations as the screen.
|
||||
A button repeated on every row names its row — *Undo: Flush DNS cache*, *Move up: Clean temporary
|
||||
files*, *Add to favorites: Check disk*.
|
||||
- **A command is read with its risk**: *Reset Windows Update, Caution, Requires admin, May require
|
||||
restart* — what a sighted user reads from the coloured dot and the badges.
|
||||
- **Every page has a heading**: its title is a heading of the first level, each section one of the
|
||||
second, so a screen reader's heading keys move from section to section.
|
||||
- **What appears is said as it appears**: a command starting, waiting for administrator permission,
|
||||
finishing (with its result, exit code and time, and whether Windows must restart), how many
|
||||
commands a search found, the highlighted result in the Command Palette (*Flush DNS cache, Safe, 2
|
||||
of 14*), every notification at the bottom of the window, and an update's progress.
|
||||
- **The console and the Log viewer can be read line by line**, and an error line starts with
|
||||
*Error*.
|
||||
- **Icons are left out**: they only decorate the word beside them, so a screen reader never stops on
|
||||
a symbol. A notice on a page is read in full with its kind first — *Warning: These commands are
|
||||
not part of the vetted catalog…*
|
||||
- **Dialogs say they are dialogs**, keep the focus inside them until they close, and give it back.
|
||||
|
||||
### Seeing the screen
|
||||
|
||||
- **Light, dark, or the same as Windows** (Settings ▸ Appearance ▸ Theme). Every colour comes from
|
||||
the theme.
|
||||
- **Windows contrast themes** (Settings ▸ Accessibility ▸ Contrast themes) always win over the app's
|
||||
own theme, as soon as you turn one on or off. Dimmed text and badge icons are drawn at full
|
||||
strength under a contrast theme.
|
||||
- **Text size**: the app's own font size (Small, Medium, Large) is multiplied by Windows' **Text
|
||||
size** (Settings ▸ Accessibility ▸ Text size, up to 225 %), picked up when you come back to the
|
||||
app; at the largest sizes the navigation pane widens to fit its labels. **Display scaling** works
|
||||
at any size, on every screen, and so does **Magnifier** (Windows logo key + Plus).
|
||||
- **Colour is never the only signal**: risk levels always come with their word or an icon, and an
|
||||
error line in the console has a bar at its left as well as its colour.
|
||||
- **Animations follow Windows' Animation effects setting**: with it off, pages switch at once.
|
||||
|
||||
### Languages
|
||||
|
||||
CommandForge is shown in English, Vietnamese, Japanese, Simplified Chinese or Spanish (Settings ▸
|
||||
Appearance ▸ Language), and the names a screen reader reads come from the same translations. The
|
||||
documents — the user guide, this page, the legal texts — are in English.
|
||||
|
||||
## How it is checked
|
||||
|
||||
- **On every build**, by the project's tests: every control that shows no text has a name; the
|
||||
items of a list are named by what they show, not by a program type; every page title is a
|
||||
heading; the app declares that it follows each screen's scaling; no colour is written into a
|
||||
screen; every icon is kept out of a screen reader's way; this page's links work and it never
|
||||
claims conformance. The key every name uses must exist in all five languages. Other tests run the
|
||||
fixes on real controls of the WPF-UI library the app is built with, so a library update that
|
||||
renames one of their parts is caught before a release.
|
||||
- **By an automated scan**: Axe.Windows, Microsoft's UI Automation rules (the engine of Accessibility
|
||||
Insights for Windows), over every page of the running app, the first-start terms and the console
|
||||
after a command, in the light and the dark theme and at Windows' largest Text size. Version 2.2.0
|
||||
passes it with no error.
|
||||
- **By hand**: the maintainer used CommandForge 2.1.0 with the keyboard alone (mouse disconnected)
|
||||
and with Narrator on Windows 11 in November 2026 and found no major problem. Version 2.2.0 then
|
||||
fixed everything a review of every screen found — the result of a command was not announced, the
|
||||
console could not be read line by line, the Command Palette's highlight was silent, and some lists
|
||||
read a program type instead of their text, among others. The 2.2.0 build was checked the same way
|
||||
before its release, and with a Windows contrast theme, a larger Text size and Animation effects
|
||||
off.
|
||||
- **Not tested yet**: NVDA, JAWS, Voice Access, touch, and Windows 10. They should work through the
|
||||
same Windows interface Narrator uses, but nobody has checked.
|
||||
|
||||
## Known limitations
|
||||
|
||||
Each one with what to do instead. A barrier that is not on this list is worth reporting.
|
||||
|
||||
- **A command's output is the text Windows' tool prints**, in Windows' language, sometimes with
|
||||
progress bars drawn out of characters. Read it line by line, or use **Copy all** or **Save** above
|
||||
the console to read it elsewhere.
|
||||
- **There are no access keys** (Alt with an underlined letter): with five languages they would clash.
|
||||
Use the shortcuts above, Tab and F6.
|
||||
- **The title bar's Minimize, Maximize and Close buttons are not Tab stops** (screen readers still
|
||||
find them by name). Use **Alt+F4** or **Ctrl+Q** to close, and Windows' own **Windows logo key +
|
||||
arrow** keys to maximize, restore or minimize.
|
||||
- **Expanding a card in Settings still animates** when Windows' Animation effects is off: the
|
||||
animation belongs to the WPF-UI library the app is built with.
|
||||
- **At the largest sizes** (Large font with Windows' Text size near 225 %), some pages and dialogs
|
||||
need scrolling, and the title bar's search box shows the start of its text (its tooltip and its
|
||||
name have all of it; Ctrl+K opens it).
|
||||
- **Icons keep their size**: Windows' Text size enlarges text only. Display scaling (Settings ▸
|
||||
System ▸ Display ▸ Scale) or Magnifier enlarges everything.
|
||||
- **The windows Windows itself shows** — the administrator (UAC) prompt, choosing a file — are
|
||||
Windows', not CommandForge's.
|
||||
|
||||
## Report an accessibility problem
|
||||
|
||||
1. Open an issue with the
|
||||
[Accessibility problem form](https://github.com/poli0981/CommandForge/issues/new?template=accessibility.yml),
|
||||
or write to **[accessibility@poli0981.dev](mailto:accessibility@poli0981.dev)** if you'd rather not
|
||||
use GitHub or not post in public.
|
||||
2. Say what you were trying to do and what happened instead; your CommandForge version (More ▸ About)
|
||||
and your Windows version; and what you use — the keyboard alone, Narrator, NVDA, JAWS, Magnifier,
|
||||
a contrast theme, a larger text size — with its version. The steps to get there help, and so does
|
||||
a screenshot or a recording, but neither is required. **You never need to tell us anything about
|
||||
yourself or a disability.**
|
||||
3. If you want to attach details from your PC, **More ▸ Report a bug** gathers them and exports the
|
||||
log as a file you review first; nothing is uploaded by itself.
|
||||
|
||||
**A safety prompt you could not perceive or answer** — a Caution or Dangerous confirmation — is a
|
||||
safety problem as well: say so in the report, and it is handled first.
|
||||
|
||||
### How serious it is
|
||||
|
||||
You do not have to choose; the maintainer sets it when reading the report.
|
||||
|
||||
| Severity | What it means | For example |
|
||||
|---|---|---|
|
||||
| **Critical** | A task cannot be done at all. | A Dangerous command's confirmation cannot be answered with the keyboard; the terms cannot be accepted on first start; a command's result is never conveyed. |
|
||||
| **Serious** | It can be done only with great difficulty or a workaround. | A command's output can be read only after saving it to a file. |
|
||||
| **Moderate** | It is tiring or inconsistent. | A name that differs from what the screen shows; an extra stop for Tab. |
|
||||
| **Minor** | It barely gets in the way. | A tooltip the keyboard cannot reach, when its words are shown elsewhere too. |
|
||||
|
||||
### What happens next
|
||||
|
||||
CommandForge has one maintainer, so there are no promised times. Every report is read and answered,
|
||||
without doubting what you describe. Critical problems come before other work; a workaround, when
|
||||
there is one, is written on the issue; the fix ships in a release, and the issue is closed once you
|
||||
say it works for you — or when a fix has been out for a while and nobody has answered.
|
||||
|
||||
## Who looks after this
|
||||
|
||||
The maintainer, poli0981, keeps this page and the checks behind it, and reviews both for each release
|
||||
that changes a screen. A change to CommandForge that moves anything on this page changes the page in
|
||||
the same pull request.
|
||||
|
||||
## For contributors
|
||||
|
||||
A change to the app keeps what the tests above hold: a name, from the translations in all five
|
||||
languages, for every control that shows no text and every list item; colours only from the theme.
|
||||
Say in the pull request what you checked with the keyboard and with Narrator (Accessibility Insights
|
||||
for Windows is a good companion). The rules are in [CONTRIBUTING.md](.github/CONTRIBUTING.md).
|
||||
|
||||
## Feedback
|
||||
|
||||
To improve this page, open an issue or a pull request. A barrier goes through the form above, so that
|
||||
it is not lost.
|
||||
@@ -54,7 +54,9 @@ dotnet test CommandForge.slnx --collect "XPlat Code Coverage;Format=opencover"
|
||||
`Directory.Packages.props`.
|
||||
- Every restore runs a **NuGet audit** of direct and transitive packages; moderate or higher
|
||||
advisories fail the build.
|
||||
- Dependabot groups updates (Velopack and the `vpk` tool move together) with a cooldown.
|
||||
- Dependabot groups updates (Velopack and the `vpk` tool move together) with a cooldown. It skips
|
||||
new major versions of the .NET SDK and of `Microsoft.Extensions.*`: moving to a new .NET major is
|
||||
a deliberate migration, done by hand.
|
||||
|
||||
## Publish (self-contained) + package
|
||||
|
||||
@@ -98,10 +100,11 @@ All workflows pin actions to full commit SHAs and use least-privilege permission
|
||||
| `build.yml` | `build`: restore, `dotnet format --verify-no-changes`, Release build, tests (results and coverage uploaded). `package`: publish and `vpk pack` exactly like a release. |
|
||||
| `codeql.yml` | CodeQL for C# (Windows, manual build) and for the workflows themselves (`actions`). |
|
||||
| `sonarcloud.yml` | SonarCloud analysis with test coverage: the SonarScanner for .NET (pinned in `.config/dotnet-tools.json`) wraps a Release build and an OpenCover test run, and the SonarCloud app reports the quality gate on the PR. Needs the `SONAR_TOKEN` secret, so PRs from forks and Dependabot are skipped. |
|
||||
| `qodana.yml` | JetBrains Qodana for .NET (Rider's inspections, native mode on Windows) over the whole solution, after a Release build; settings in `qodana.yaml`, and the gate is zero problems. Results go to Qodana Cloud, to annotations and a comment on the PR, and to the `qodana-report` artifact. Advisory (not a required check). Needs the `QODANA_TOKEN` secret, so PRs from forks and Dependabot are skipped. |
|
||||
| `dependency-review.yml` | Fails a PR that adds a dependency with a moderate+ vulnerability or a license outside the GPLv3-compatible allow-list. |
|
||||
| `scorecard.yml` | OpenSSF Scorecard, reported to code scanning. |
|
||||
| `release.yml` | Tag-triggered release — see [RELEASING.md](RELEASING.md). |
|
||||
| `notify-ci-failure.yml` | Posts a Discord alert when the Build or SonarCloud workflow fails on `main` (needs the `DISCORD_CI_WEBHOOK` secret). |
|
||||
| `notify-ci-failure.yml` | Posts a Discord alert when the Build, SonarCloud or Qodana workflow fails on `main` (needs the `DISCORD_CI_WEBHOOK` secret). |
|
||||
|
||||
The SonarCloud quality gate ("Sonar way") expects new code to be at least 80% covered by tests,
|
||||
with no new issues. XAML code-behind and the two entry points (`Program.cs` of the app and of the
|
||||
|
||||
+79
-1
@@ -7,6 +7,83 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.2.0] — 2026-11-16
|
||||
|
||||
CommandForge is now **stable and in maintenance mode** (see
|
||||
[Project status](https://github.com/poli0981/CommandForge#project-status)). This release brings an
|
||||
accessibility review of every screen, the November 2026 .NET security update and Qodana code
|
||||
analysis.
|
||||
|
||||
### Added
|
||||
- **Accessibility statement**: [ACCESSIBILITY.md](https://github.com/poli0981/CommandForge/blob/main/ACCESSIBILITY.md)
|
||||
says what works with the keyboard, screen readers, contrast themes and larger text, what doesn't
|
||||
yet, and how to report a barrier: an *Accessibility problem* issue form or
|
||||
accessibility@poli0981.dev. In the app: More (⋯) → About CommandForge → Accessibility.
|
||||
- **F6 / Shift+F6** move between the navigation pane, the page and the console.
|
||||
- **Windows' Text size** (Settings › Accessibility › Text size) now enlarges the app's text too, on
|
||||
top of its own Small / Medium / Large.
|
||||
|
||||
### Changed
|
||||
- **Maintenance mode**: the work now goes into security, dependency and platform updates, catalog
|
||||
commands, and bug, UI/UX, accessibility and translation fixes; a new feature only when it is
|
||||
genuinely necessary. The policy is in
|
||||
[CONTRIBUTING.md](https://github.com/poli0981/CommandForge/blob/main/.github/CONTRIBUTING.md#maintenance-mode-what-we-accept),
|
||||
and the issue forms follow it, with two new ones: *Command — add, fix or remove* and
|
||||
*Translation fix*.
|
||||
- Code quality: JetBrains Qodana for .NET now inspects `main` and every pull request from CI, next
|
||||
to SonarCloud: Rider's C#, XAML and resource inspections and JetBrains' security rules, run
|
||||
natively on Windows. The gate is zero problems. Its first report also fixed a process object that
|
||||
could be left undisposed when a command's program could not be found, and the command history
|
||||
being read outside the lock it is written under.
|
||||
- Dependencies: Microsoft.Extensions.DependencyInjection 10.0.15, CsWin32 0.3.371, SonarAnalyzer
|
||||
10.36, SonarScanner for .NET 12.1.0, xUnit v3 4.0.3, Microsoft.NET.Test.Sdk 18.12.0, coverlet
|
||||
10.1.1; in CI, setup-dotnet 6.1.0 and CodeQL action 4.39.3.
|
||||
- Dependabot no longer proposes new major versions of .NET or Microsoft.Extensions: moving to a
|
||||
new .NET major is a deliberate migration, done by hand.
|
||||
|
||||
### Fixed
|
||||
- **Screen readers** (Narrator, NVDA, JAWS) now hear what appears: a command starting, waiting for
|
||||
administrator permission and finishing — with its result, exit code, time and whether Windows must
|
||||
restart —, how many commands a search found, the Command Palette's highlighted result and its
|
||||
position, every notification, and an update's progress.
|
||||
- **The console and the Log viewer** can be read line by line with the arrow keys; an error line is
|
||||
read as an error and has a bar at its left, not only a colour.
|
||||
- **Lists, options and buttons** are read by their text instead of a program type name (the language
|
||||
lists, the Recipes command list, My commands, the Log viewer, the shortcuts list), commands with
|
||||
their risk level and badges, and a button repeated on every row names its row ("Undo: …").
|
||||
- **Keyboard**: after Ctrl+H, Ctrl+, or Ctrl+L, or choosing a page in the pane, the keyboard moves
|
||||
into that page; a command opened from Home, History or the palette gets the focus in the catalog;
|
||||
Enter opens the selected command in the catalog and in History; Tab reaches a row's star, Undo and
|
||||
Run again; the catalog's splitters move with the arrow keys; every window and dialog starts with
|
||||
the keyboard inside it, and a Caution confirmation on Cancel.
|
||||
- **Unnamed controls** got names: the navigation pane's toggle and its two lists, the title bar's
|
||||
buttons (Maximize is read as Restore down while the window is maximized), a search box's clear
|
||||
button, the Settings cards and expanders, the Debug panel's tabs and
|
||||
the four "Read on GitHub" links; the Dangerous confirmation also reads the command's ID, and
|
||||
Settings' theme and font size choices are read as groups. The log level list is translated.
|
||||
- **Icons are no longer read** as stray symbols: they only decorate the word beside them, so a
|
||||
screen reader skips them. A notice on a page is read in full with its kind ("Warning: These
|
||||
commands are not part of the vetted catalog…"); before, a screen reader could not reach its text.
|
||||
A blank line in the console is read as "Blank line", and the frame around each page is no longer
|
||||
an empty stop for Tab.
|
||||
- **Seeing the screen**: dimmed text and badge icons are drawn at full strength under a Windows
|
||||
contrast theme, low-contrast grey text is darker, cut-off text shows in full as a tooltip, page
|
||||
transitions follow Windows' Animation effects setting, and lists and cards no longer clip larger
|
||||
text. At the largest text sizes the navigation pane widens to fit its labels, the catalog's
|
||||
filters and a command's badges wrap instead of running off the edge, and the title bar's search
|
||||
box ends in "…" with its full text as a tooltip.
|
||||
- **Ctrl+Q** no longer closes the app while you are typing in a text box (a search box excepted).
|
||||
- **Report a bug** opens GitHub's *Bug report* form with the description, the crash code and the
|
||||
versions filled in. Before, GitHub showed anyone who isn't a collaborator the list of forms
|
||||
instead, and what the app had filled in was lost.
|
||||
|
||||
### Security
|
||||
- Built with the .NET 10.0.404 SDK, so the app ships the .NET 10.0.15 runtime (the November 2026
|
||||
security update).
|
||||
- Links and folders are opened only when they are `https:` or `mailto:` addresses or existing
|
||||
folders: Windows runs whatever the shell is handed, so a `file:` address or an unknown protocol is
|
||||
refused.
|
||||
|
||||
## [2.1.0] — 2026-10-26
|
||||
|
||||
Three new categories and 37 new commands (the catalog grows from 261 to 298), the October 2026
|
||||
@@ -297,7 +374,8 @@ Initial public release.
|
||||
checksums (and an optional VirusTotal scan). No telemetry — the only network use is checking
|
||||
GitHub for updates.
|
||||
|
||||
[Unreleased]: https://github.com/poli0981/CommandForge/compare/v2.1.0...HEAD
|
||||
[Unreleased]: https://github.com/poli0981/CommandForge/compare/v2.2.0...HEAD
|
||||
[2.2.0]: https://github.com/poli0981/CommandForge/compare/v2.1.0...v2.2.0
|
||||
[2.1.0]: https://github.com/poli0981/CommandForge/compare/v2.0.0...v2.1.0
|
||||
[2.0.0]: https://github.com/poli0981/CommandForge/compare/v1.5.1...v2.0.0
|
||||
[1.5.1]: https://github.com/poli0981/CommandForge/compare/v1.5.0...v1.5.1
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
- **Chỉ Windows 10 (22H2) và 11**, x64 (ARM64 nếu được).
|
||||
- **Open-source, GPLv3.**
|
||||
- Cài & cập nhật bằng **Velopack** (unpackaged, không qua Store).
|
||||
- **Trạng thái: ổn định, chế độ bảo trì** từ v2.2.0 (2026-11-16). Chỉ nhận: cập nhật dependency;
|
||||
vá bảo mật (High/Critical → bản vá khẩn, Moderate → đợt cập nhật định kỳ kế tiếp); nâng cấp nền
|
||||
tảng lớn (.NET mới); thêm/bớt/sửa lệnh catalog (lỗi thời, sai cú pháp, có thể gây hại — loại gây
|
||||
hại báo riêng qua Security Advisory); sửa lỗi, UI/UX, accessibility; sửa bản dịch. Tính năng mới
|
||||
chỉ khi thật sự phù hợp và cần thiết. Nguồn chuẩn của chính sách:
|
||||
`.github/CONTRIBUTING.md#maintenance-mode-what-we-accept`.
|
||||
|
||||
---
|
||||
|
||||
@@ -75,6 +81,11 @@ Phát hành thật: tag ký GPG `vX.Y.Z` trên `main` → `release.yml` (xem `RE
|
||||
|
||||
- Code, định danh, comment kỹ thuật: **tiếng Anh**. Chuỗi hiển thị cho người dùng: **`.resx` (EN/VI/JA/zh-Hans/ES)** — không hardcode chuỗi UI; mỗi key phải có ở cả 5 file (test `ResxKeyTests` quét UI để kiểm tra).
|
||||
- Namespace tầng giao diện là `CommandForge.Desktop` (project/assembly/exe vẫn tên `CommandForge.Wpf`): namespace `CommandForge.Wpf` che namespace gốc `Wpf` của WPF-UI trong code XAML sinh ra.
|
||||
- **Accessibility** (xem `ACCESSIBILITY.md`): control không có chữ phải có `AutomationProperties.Name`
|
||||
từ `.resx`; item của danh sách được đặt tên qua `ItemContainerStyle`; icon dùng `ctl:DecorativeIcon`
|
||||
(không dùng `ui:SymbolIcon`/`new SymbolIcon` — glyph vùng Unicode riêng bị Narrator đọc); không
|
||||
truyền thông tin chỉ bằng màu; thông báo cho Narrator qua `INotificationService.Announce`.
|
||||
`AccessibilityTests` và `WpfAccessibilityRuntimeTests` (STA, template WPF-UI thật) kiểm tra.
|
||||
- WPF-UI: mỗi trang (UserControl trong NavigationView) phải đặt `Foreground="{DynamicResource TextFillColorPrimaryBrush}"` ở gốc (Frame không truyền màu chữ xuống); lớp con của `ContentDialog` phải gọi `SetResourceReference(StyleProperty, typeof(ContentDialog))` — `XamlConventionsTests` kiểm tra cả hai. Cỡ chữ dùng `DynamicResource AppFontSize*`.
|
||||
- Version package đặt trong **từng `.csproj`** (không dùng Central Package Management — dependency graph của GitHub không đọc `Directory.Packages.props`).
|
||||
- Nullable reference types **bật**; `TreatWarningsAsErrors` **bật**; analyzers **bật**.
|
||||
@@ -113,6 +124,6 @@ Phát hành thật: tag ký GPG `vX.Y.Z` trên `main` → `release.yml` (xem `RE
|
||||
|
||||
> ⚠️ Thư mục `docs/` nằm trong `.gitignore` (tài liệu nội bộ, chỉ có trên máy).
|
||||
|
||||
**Tài liệu công khai (ở gốc repo, được commit):** `README.md`, `USAGE.md` (hướng dẫn người dùng — link "User guide" trong app), `CHANGELOG.md`, `BUILD.md`, `RELEASING.md`, `UPDATES.md`, `PRIVACY.md`, `EULA.md`, `DISCLAIMER.md`, `THIRD-PARTY-NOTICES.md`, `MAINTAINERS.md`, `LICENSE`, và trong `.github/`: `SECURITY.md`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`. Legal Gate trỏ tới EULA/PRIVACY/DISCLAIMER/LICENSE công khai.
|
||||
**Tài liệu công khai (ở gốc repo, được commit):** `README.md`, `ACCESSIBILITY.md` (tuyên bố trợ năng — mục tiêu WCAG 2.2 AA, không phải tuyên bố tuân thủ; link "Accessibility" trong About), `USAGE.md` (hướng dẫn người dùng — link "User guide" trong app), `CHANGELOG.md`, `BUILD.md`, `RELEASING.md`, `UPDATES.md`, `PRIVACY.md`, `EULA.md`, `DISCLAIMER.md`, `THIRD-PARTY-NOTICES.md`, `MAINTAINERS.md`, `LICENSE`, và trong `.github/`: `SECURITY.md`, `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`. Legal Gate trỏ tới EULA/PRIVACY/DISCLAIMER/LICENSE công khai.
|
||||
|
||||
**Email liên hệ (@poli0981.dev):** `security@` (lỗ hổng, cùng GitHub private vulnerability reporting) · `privacy@` · `legal@` · `copyright@` / `dmca@` / `takedown@` (bản quyền, DMCA, yêu cầu gỡ bỏ khác) · `code@` (mã nguồn, đóng góp, báo cáo Code of Conduct) · `collab@` · `press@` · `sponsor@`. Không dùng `games@` cho dự án này.
|
||||
**Email liên hệ (@poli0981.dev):** `security@` (lỗ hổng, cùng GitHub private vulnerability reporting) · `accessibility@` (rào cản trợ năng, cùng form *Accessibility problem*) · `privacy@` · `legal@` · `copyright@` / `dmca@` / `takedown@` (bản quyền, DMCA, yêu cầu gỡ bỏ khác) · `code@` (mã nguồn, đóng góp, báo cáo Code of Conduct) · `collab@` · `press@` · `sponsor@`. Không dùng `games@` cho dự án này.
|
||||
@@ -53,14 +53,14 @@
|
||||
<RepositoryUrl>https://github.com/poli0981/CommandForge</RepositoryUrl>
|
||||
<PackageProjectUrl>https://github.com/poli0981/CommandForge</PackageProjectUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<Version>2.1.0</Version>
|
||||
<Version>2.2.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Same rules SonarCloud applies, enforced at build time (warnings are errors). Package versions
|
||||
live in each .csproj: GitHub's dependency graph (Dependabot alerts, dependency review, the
|
||||
release SBOM) reads .csproj files but not Directory.Packages.props. -->
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.35.0.4138">
|
||||
<PackageReference Include="SonarAnalyzer.CSharp" Version="10.36.0.15337">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# CommandForge
|
||||
|
||||
[](https://github.com/poli0981/CommandForge/releases/latest)
|
||||
[](#project-status)
|
||||
[](https://github.com/poli0981/CommandForge/actions/workflows/build.yml)
|
||||
[](https://github.com/poli0981/CommandForge/actions/workflows/codeql.yml)
|
||||
[](https://sonarcloud.io/summary/new_code?id=poli0981_CommandForge)
|
||||
[](https://sonarcloud.io/summary/new_code?id=poli0981_CommandForge)
|
||||
[](https://github.com/poli0981/CommandForge/actions/workflows/qodana.yml)
|
||||
[](https://scorecard.dev/viewer/?uri=github.com/poli0981/CommandForge)
|
||||
[](ACCESSIBILITY.md)
|
||||

|
||||
[](LICENSE)
|
||||
|
||||
> Run powerful Windows maintenance commands from a clean, categorized GUI — no need to
|
||||
> memorize syntax.
|
||||
|
||||
@@ -19,6 +31,20 @@ clear danger level, a confirmation for anything risky, and an optional System Re
|
||||
|
||||
---
|
||||
|
||||
## Project status
|
||||
|
||||
**Stable, maintenance only** since version 2.2.0 (November 2026). CommandForge does what it set
|
||||
out to do, so the work now goes into keeping it secure, correct and accessible: dependency and
|
||||
security updates (a High or Critical vulnerability gets an urgent patch release), major platform
|
||||
updates such as a newer .NET, catalog commands added, fixed or removed, bug, UI/UX and
|
||||
accessibility fixes, and translation fixes. A new feature is added only when it is genuinely
|
||||
necessary. The whole policy is in
|
||||
[CONTRIBUTING.md](.github/CONTRIBUTING.md#maintenance-mode-what-we-accept); ideas are welcome in
|
||||
[Discussions › Ideas](https://github.com/poli0981/CommandForge/discussions/categories/ideas),
|
||||
without commitment.
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
|
||||
- **298 vetted commands in 15 categories** — System & Maintenance, Updates & Packages, Tweaks &
|
||||
@@ -47,6 +73,9 @@ clear danger level, a confirmation for anything risky, and an optional System Re
|
||||
restart.
|
||||
- **Diagnostics** — Log Viewer, Debug panel, local logs with retention, and a crash dialog with a
|
||||
"Report a bug" flow that never sends anything by itself.
|
||||
- **Accessible** — everything works with the keyboard alone (`F6` moves between the navigation
|
||||
pane, the page and the console), Narrator hears what each command does and how it ended, and the
|
||||
app follows Windows contrast themes and Text size. See [ACCESSIBILITY.md](ACCESSIBILITY.md).
|
||||
|
||||
New here? Read the **[user guide](USAGE.md)**.
|
||||
|
||||
@@ -59,8 +88,8 @@ New here? Read the **[user guide](USAGE.md)**.
|
||||
2. Run it. The app installs per-user (no admin rights needed) and updates itself from future
|
||||
releases.
|
||||
|
||||
Already on 1.x? The app offers 2.0 as a normal update; your settings, favorites, history, recipes
|
||||
and commands carry over.
|
||||
Already installed? The app offers each new release as a normal update; your settings, favorites,
|
||||
history, recipes and commands carry over.
|
||||
|
||||
### "Unknown publisher" and verifying your download
|
||||
|
||||
@@ -108,6 +137,7 @@ See [BUILD.md](BUILD.md) for packaging and CI, and [UPDATES.md](UPDATES.md) for
|
||||
| Topic | File |
|
||||
|---|---|
|
||||
| User guide | [USAGE.md](USAGE.md) |
|
||||
| Accessibility | [ACCESSIBILITY.md](ACCESSIBILITY.md) |
|
||||
| Release history | [CHANGELOG.md](CHANGELOG.md) |
|
||||
| Build, test, publish, release | [BUILD.md](BUILD.md) · [RELEASING.md](RELEASING.md) |
|
||||
| Update mechanism (Velopack) | [UPDATES.md](UPDATES.md) |
|
||||
@@ -124,13 +154,15 @@ See [BUILD.md](BUILD.md) for packaging and CI, and [UPDATES.md](UPDATES.md) for
|
||||
|
||||
## Contact
|
||||
|
||||
Bugs and feature requests go to [GitHub Issues](https://github.com/poli0981/CommandForge/issues),
|
||||
and questions to [Discussions](https://github.com/poli0981/CommandForge/discussions). For
|
||||
everything else:
|
||||
Bugs, catalog commands, translations and accessibility problems go to
|
||||
[GitHub Issues](https://github.com/poli0981/CommandForge/issues/new/choose) (see
|
||||
[Project status](#project-status) for what is accepted), and questions and ideas to
|
||||
[Discussions](https://github.com/poli0981/CommandForge/discussions). For everything else:
|
||||
|
||||
| Topic | Address |
|
||||
|---|---|
|
||||
| Security vulnerabilities (private) | security@poli0981.dev, or [private vulnerability reporting](https://github.com/poli0981/CommandForge/security/advisories/new) |
|
||||
| Accessibility barriers | accessibility@poli0981.dev, or the [Accessibility problem form](https://github.com/poli0981/CommandForge/issues/new?template=accessibility.yml) |
|
||||
| Privacy | privacy@poli0981.dev |
|
||||
| Terms, licensing and other legal questions | legal@poli0981.dev |
|
||||
| Copyright questions and permissions | copyright@poli0981.dev |
|
||||
|
||||
+2
-1
@@ -56,8 +56,9 @@ input; the upload step then creates the `vX.Y.Z` tag.
|
||||
| `VT_API_KEY` | VirusTotal scan + links | optional (step skipped if unset) |
|
||||
| `DISCORD_RELEASES_WEBHOOK` (or `DISCORD_REPO_WEBHOOK`) | Release announcement to Discord | optional |
|
||||
| `DISCORD_PING_ROLE_ID` | Role ping on stable releases | optional |
|
||||
| `DISCORD_CI_WEBHOOK` | Build/SonarCloud failure alerts to Discord | optional |
|
||||
| `DISCORD_CI_WEBHOOK` | Build/SonarCloud/Qodana failure alerts to Discord | optional |
|
||||
| `SONAR_TOKEN` | SonarCloud analysis and coverage (`sonarcloud.yml`) | for the SonarCloud workflow (runs without it are skipped) |
|
||||
| `QODANA_TOKEN` | Qodana Cloud project token; selects the Ultimate licence (`qodana.yml`) | for the Qodana workflow (runs without it are skipped) |
|
||||
|
||||
> `poli0981` is a user account (not an org), so secrets are set **per repository**
|
||||
> (Settings → Secrets and variables → Actions).
|
||||
|
||||
@@ -11,7 +11,7 @@ versions.
|
||||
|---|---|---|---|
|
||||
| WPF-UI (+ WPF-UI.Abstractions) | 4.3.0 | MIT | https://github.com/lepoco/wpfui |
|
||||
| CommunityToolkit.Mvvm | 8.4.2 | MIT | https://github.com/CommunityToolkit/dotnet |
|
||||
| Microsoft.Extensions.DependencyInjection (+ .Abstractions) | 10.0.14 | MIT | https://github.com/dotnet/runtime |
|
||||
| Microsoft.Extensions.DependencyInjection (+ .Abstractions) | 10.0.15 | MIT | https://github.com/dotnet/runtime |
|
||||
| Serilog | 4.4.0 | Apache-2.0 | https://github.com/serilog/serilog |
|
||||
| Serilog.Sinks.File | 7.0.0 | Apache-2.0 | https://github.com/serilog/serilog-sinks-file |
|
||||
| Serilog.Sinks.Async | 2.1.0 | Apache-2.0 | https://github.com/serilog/serilog-sinks-async |
|
||||
@@ -25,14 +25,14 @@ and the Fluent System Icons (below); see the `ThirdPartyNotices.txt` in the WPF-
|
||||
|
||||
| Component | Version | License | Project |
|
||||
|---|---|---|---|
|
||||
| Microsoft.Windows.CsWin32 | 0.3.367 | MIT | https://github.com/microsoft/CsWin32 |
|
||||
| SonarAnalyzer.CSharp | 10.35.0.4138 | SONAR Source-Available License v1.0 | https://github.com/SonarSource/sonar-dotnet |
|
||||
| dotnet-sonarscanner (SonarScanner for .NET, CI only) | 12.0.0 | LGPL-3.0 | https://github.com/SonarSource/sonar-scanner-msbuild |
|
||||
| Microsoft.Windows.CsWin32 | 0.3.371 | MIT | https://github.com/microsoft/CsWin32 |
|
||||
| SonarAnalyzer.CSharp | 10.36.0.15337 | SONAR Source-Available License v1.0 | https://github.com/SonarSource/sonar-dotnet |
|
||||
| dotnet-sonarscanner (SonarScanner for .NET, CI only) | 12.1.0 | LGPL-3.0 | https://github.com/SonarSource/sonar-scanner-msbuild |
|
||||
| vpk (Velopack CLI) | 1.2.161 | MIT | https://github.com/velopack/velopack |
|
||||
| xunit.v3 (`xunit.v3.mtp-off`) | 4.0.2 | Apache-2.0 | https://github.com/xunit/xunit |
|
||||
| xunit.v3 (`xunit.v3.mtp-off`) | 4.0.3 | Apache-2.0 | https://github.com/xunit/xunit |
|
||||
| xunit.runner.visualstudio | 4.0.1 | Apache-2.0 | https://github.com/xunit/visualstudio.xunit |
|
||||
| Microsoft.NET.Test.Sdk | 18.11.0 | MIT | https://github.com/microsoft/vstest |
|
||||
| coverlet.collector | 10.1.0 | MIT | https://github.com/coverlet-coverage/coverlet |
|
||||
| Microsoft.NET.Test.Sdk | 18.12.0 | MIT | https://github.com/microsoft/vstest |
|
||||
| coverlet.collector | 10.1.1 | MIT | https://github.com/coverlet-coverage/coverlet |
|
||||
|
||||
## Runtime & platform
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# CommandForge user guide
|
||||
|
||||
CommandForge runs Windows maintenance commands for you: pick a command, read what it will do, and
|
||||
run it. This guide covers version 2.0. For installing and verifying downloads, see the
|
||||
run it. This guide covers version 2.2. For installing and verifying downloads, see the
|
||||
[README](README.md#install).
|
||||
|
||||
- [First start](#first-start)
|
||||
@@ -15,6 +15,7 @@ run it. This guide covers version 2.0. For installing and verifying downloads, s
|
||||
- [Settings](#settings)
|
||||
- [Log viewer and Debug panel](#log-viewer-and-debug-panel)
|
||||
- [Keyboard shortcuts](#keyboard-shortcuts)
|
||||
- [Accessibility](#accessibility)
|
||||
- [Updates](#updates)
|
||||
- [Your data and uninstalling](#your-data-and-uninstalling)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
@@ -181,7 +182,7 @@ Under **My commands** you can save your own command lines, such as a `ping` you
|
||||
|
||||
| Section | Options |
|
||||
|---|---|
|
||||
| **Appearance** | Theme (System, Light, Dark), Language, Font size (Small, Medium, Large). |
|
||||
| **Appearance** | Theme (System, Light, Dark), Language, Font size (Small, Medium, Large; Windows' own Text size enlarges it further). |
|
||||
| **Behavior & Safety** | Collapse the navigation pane by default; show Admin/Restart badges in lists; confirm before Caution commands; confirm before Dangerous commands (always on); tick "create a restore point" by default for risky admin commands; auto-scroll the console; warn before closing while a command is running. |
|
||||
| **Updates** | Check for updates on startup, the current version, the last check and **Check now**. |
|
||||
| **Backup & profiles** | **Export…** / **Import…** your appearance, behavior and favorites as a `.json` file, and save named profiles (for example "Gaming PC" or "Office") that you can **Apply** or **Delete**. |
|
||||
@@ -211,17 +212,35 @@ Theme, language and font size change immediately; no restart needed.
|
||||
| `Ctrl+F` | Search the current list |
|
||||
| `Ctrl+H` | Home |
|
||||
| `Ctrl+B` | Show or hide the navigation pane |
|
||||
| `F6` / `Shift+F6` | Move between the navigation pane, the page and the console |
|
||||
| `Ctrl+,` | Settings |
|
||||
| `Ctrl+L` | Log viewer |
|
||||
| `F5` | Check for updates |
|
||||
| `Ctrl+Q` | Exit |
|
||||
| `↑` / `↓` | Move the selection (lists and palette) |
|
||||
| `Enter` | Open the selected command |
|
||||
| `↑` / `↓` | Move the selection (lists and palette); `Tab` then reaches the buttons of the selected row |
|
||||
| `Enter` | Open the selected command: in the catalog, go to its **Run** button; in History, open it in the catalog; in the palette, open it |
|
||||
| `Esc` | Close a dialog or cancel |
|
||||
|
||||
Shortcuts are paused while a dialog is open, and `AltGr` combinations never trigger them, so
|
||||
typing characters like `@` on international keyboards is safe. The list is also under **More →
|
||||
Keyboard shortcuts**.
|
||||
typing characters like `@` on international keyboards is safe. `Ctrl+Q` does nothing while you are
|
||||
typing in a text box (other than a search box), so a slip can't close the app mid-edit. The list is
|
||||
also under **More → Keyboard shortcuts**.
|
||||
|
||||
## Accessibility
|
||||
|
||||
- **Keyboard:** everything works without a mouse. After `Ctrl+H`, `Ctrl+,`, `Ctrl+L` or choosing a
|
||||
page in the navigation pane, the keyboard moves into that page; `F6` jumps between the pane, the
|
||||
page and the console. The console and the Log viewer can be read line by line with the arrow
|
||||
keys.
|
||||
- **Screen readers:** Narrator (and other screen readers) hear when a command starts, needs
|
||||
administrator permission, finishes (with its result and whether Windows must restart), how many
|
||||
commands a search found, and each notification.
|
||||
- **Seeing the screen:** the app follows Windows' contrast themes, its light/dark setting and its
|
||||
**Text size** setting (Settings › Accessibility › Text size), on top of the app's own font size.
|
||||
Risk levels are always shown with words or icons, never by color alone.
|
||||
|
||||
What works, what doesn't yet, and how to report a barrier:
|
||||
[ACCESSIBILITY.md](ACCESSIBILITY.md).
|
||||
|
||||
## Updates
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "10.0.403",
|
||||
"version": "10.0.404",
|
||||
"rollForward": "latestFeature"
|
||||
}
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
# Qodana's settings for .github/workflows/qodana.yml.
|
||||
#
|
||||
# The linter is Qodana for .NET (`qodana-dotnet`: Rider's engine) in NATIVE mode, on the job's own
|
||||
# Windows runner with the .NET SDK that global.json names: the WPF projects (net10.0-windows) load
|
||||
# only on Windows. It needs the Ultimate licence of the Qodana Cloud project; the token is the
|
||||
# QODANA_TOKEN repository secret.
|
||||
#
|
||||
# Everything a run needs is here and nothing is an action argument, so `qodana scan` in the
|
||||
# repository root of a developer's PC (with QODANA_TOKEN set) reads the same settings. The linter's
|
||||
# version is the action's: the workflow pins the action, the action its CLI, the CLI its linter.
|
||||
version: "1.0"
|
||||
linter: qodana-dotnet
|
||||
withinDocker: false
|
||||
|
||||
# WHERE AN INSPECTION IS SWITCHED OFF: one of ReSharper's (C#, XAML, .resx) in .editorconfig
|
||||
# (`resharper_*_highlighting`), where Rider and ReSharper read it too. Here only what has no key
|
||||
# there: a whole severity, and the IntelliJ platform's own inspections (Markdown, XML). Each one with
|
||||
# its reason above it.
|
||||
profile:
|
||||
base:
|
||||
name: qodana.recommended
|
||||
groups:
|
||||
# A HINT is what the editor offers without underlining anything (ReSharper's lowest level; this
|
||||
# linter files it as TYPO, Qodana as Low): "invert if", "convert to LINQ", a trailing comma, and
|
||||
# every Roslyn analyzer message below the level this build makes an error. They are suggestions,
|
||||
# not problems, and the build already fails on every warning.
|
||||
- groupId: Hints
|
||||
groups:
|
||||
- "severity:TYPO"
|
||||
inspections:
|
||||
- group: Hints
|
||||
enabled: false
|
||||
# Windows application manifests: the linter has no schema for urn:schemas-microsoft-com:asm.v1
|
||||
# and reports every element of the file as undeclared.
|
||||
- inspection: XmlHighlighting
|
||||
ignore:
|
||||
- "src/CommandForge.Wpf/app.manifest"
|
||||
- "helper/CommandForge.Elevator/app.manifest"
|
||||
|
||||
dotnet:
|
||||
solution: CommandForge.slnx
|
||||
configuration: Release
|
||||
|
||||
# What is not CommandForge's code, or not in the repository: build, package and test output, local
|
||||
# tool caches, and the git-ignored local folders a developer's PC has (internal notes, IDE state).
|
||||
exclude:
|
||||
- name: All
|
||||
paths:
|
||||
- Releases
|
||||
- publish
|
||||
- TestResults
|
||||
- .nuget
|
||||
- .sonarqube
|
||||
- docs
|
||||
- .claude
|
||||
- .idea
|
||||
- .vs
|
||||
# JETBRAINS' SECURITY RULES (the OpenGrep plugin) stay on, and the files their results were READ in
|
||||
# are listed here - so a new file that starts a process is reported. "A process started with
|
||||
# something that is not a literal" fired 11 times on the first run (2026-11-16): starting processes
|
||||
# is what CommandForge is for. What each file starts, and where its path and arguments come from,
|
||||
# is in tests/CommandForge.Tests/ProcessStartSitesTests.cs, which also fails on a new file. The
|
||||
# name is the plugin's one inspection, not a rule's: a rule's own id is honoured nowhere, so a
|
||||
# listed file is left out of all of the plugin's rules - the price.
|
||||
- name: OpenGrepInspection
|
||||
paths:
|
||||
- src/CommandForge.Infrastructure/Execution/SystemProcessRunner.cs
|
||||
- src/CommandForge.Infrastructure/Elevation/BrokerElevationService.cs
|
||||
- src/CommandForge.Wpf/Services/ShellService.cs
|
||||
# The tests start what they test (a read-only PowerShell, the echo of the executor test).
|
||||
- tests
|
||||
# THE LINTER'S OWN FAULT, not the file's: resolving PInvoke.CreateJobObject(null, null) - CsWin32's
|
||||
# null-to-PCWSTR conversion - the engine loses the constructor and reports its locals, its field,
|
||||
# the class and the file's usings as unused. The compiler builds the file with warnings as errors
|
||||
# (IDE0005 fails a redundant using). The same engine fault is known from PInvoke.EnumDisplaySettings
|
||||
# (null, ...). To be removed when a linter build reads the file.
|
||||
- name: RedundantUsingDirective
|
||||
paths:
|
||||
- src/CommandForge.Infrastructure/Execution/ProcessJob.cs
|
||||
- name: UnusedVariable.Compiler
|
||||
paths:
|
||||
- src/CommandForge.Infrastructure/Execution/ProcessJob.cs
|
||||
- name: NotAccessedField.Compiler
|
||||
paths:
|
||||
- src/CommandForge.Infrastructure/Execution/ProcessJob.cs
|
||||
- name: UnusedField.Compiler
|
||||
paths:
|
||||
- src/CommandForge.Infrastructure/Execution/ProcessJob.cs
|
||||
- name: ClassCannotBeInstantiated
|
||||
paths:
|
||||
- src/CommandForge.Infrastructure/Execution/ProcessJob.cs
|
||||
# The cancellation callback's token source: the registration that captures it is declared after
|
||||
# it, so it is disposed first, and disposing a registration waits for a callback that is running -
|
||||
# the source is never used after its disposal.
|
||||
- name: AccessToDisposedClosure
|
||||
paths:
|
||||
- src/CommandForge.Infrastructure/Elevation/BrokerElevationService.cs
|
||||
|
||||
# The gate: no problem at all. What the linter reports is settled where it is found — fixed, or its
|
||||
# inspection switched off with the reason beside it — so a count above zero is something new.
|
||||
failureConditions:
|
||||
severityThresholds:
|
||||
any: 0
|
||||
@@ -28,6 +28,12 @@ public static class ProductLinks
|
||||
/// <summary>Questions about the code and contributions.</summary>
|
||||
public const string CodeEmail = "code@poli0981.dev";
|
||||
|
||||
/// <summary>The accessibility statement: what works, the known limitations, how to report a barrier.</summary>
|
||||
public const string AccessibilityStatement = Repository + "/blob/main/ACCESSIBILITY.md";
|
||||
|
||||
/// <summary>Accessibility barriers by email (the alternative to the issue form).</summary>
|
||||
public const string AccessibilityEmail = "accessibility@poli0981.dev";
|
||||
|
||||
/// <summary>Full text of the GNU GPL v3.</summary>
|
||||
public const string License = "https://www.gnu.org/licenses/gpl-3.0.html";
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.14" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.367">
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.15" />
|
||||
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.371">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -34,25 +34,27 @@ internal sealed class SystemProcessRunner : IProcessRunner
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(output);
|
||||
|
||||
using var process = new Process
|
||||
// The start info is built first: if resolving the executable throws, there is no Process yet
|
||||
// to leak (an object initializer would run after `new Process()` and outside the `using`).
|
||||
var startInfo = new ProcessStartInfo
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = ExecutableResolver.Resolve(fileName),
|
||||
Arguments = arguments,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
// Redirect stdin so we can close it immediately: a process that reads input (e.g. an
|
||||
// interactive "cmd" with no /c) gets EOF and exits instead of hanging forever.
|
||||
RedirectStandardInput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
// Pin the working directory to System32 so nothing is resolved from an
|
||||
// attacker-controlled current directory — this runner also serves elevated commands.
|
||||
WorkingDirectory = SystemPaths.System32,
|
||||
},
|
||||
FileName = ExecutableResolver.Resolve(fileName),
|
||||
Arguments = arguments,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
// Redirect stdin so we can close it immediately: a process that reads input (e.g. an
|
||||
// interactive "cmd" with no /c) gets EOF and exits instead of hanging forever.
|
||||
RedirectStandardInput = true,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
// Pin the working directory to System32 so nothing is resolved from an
|
||||
// attacker-controlled current directory — this runner also serves elevated commands.
|
||||
WorkingDirectory = SystemPaths.System32,
|
||||
};
|
||||
_configureEnvironment?.Invoke(process.StartInfo.Environment);
|
||||
_configureEnvironment?.Invoke(startInfo.Environment);
|
||||
|
||||
using var process = new Process();
|
||||
process.StartInfo = startInfo;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -29,7 +29,15 @@ public sealed class JsonExecutionHistoryService : IExecutionHistoryService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<ExecutionRecord> GetRecent() => _records;
|
||||
public IReadOnlyList<ExecutionRecord> GetRecent()
|
||||
{
|
||||
// The list is replaced, never changed, under the gate; reading the reference under it too
|
||||
// makes the newest one visible to every thread.
|
||||
lock (_gate)
|
||||
{
|
||||
return _records;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Record(ExecutionRecord record)
|
||||
|
||||
@@ -86,7 +86,7 @@ public sealed class SingleInstanceGuard : IDisposable
|
||||
|
||||
private void ListenLoop(Action onActivateRequested)
|
||||
{
|
||||
var handles = new WaitHandle[] { _activateEvent, _stopEvent.WaitHandle };
|
||||
WaitHandle[] handles = [_activateEvent, _stopEvent.WaitHandle];
|
||||
while (true)
|
||||
{
|
||||
if (WaitHandle.WaitAny(handles) == 1)
|
||||
|
||||
@@ -80,6 +80,9 @@ public partial class App : System.Windows.Application
|
||||
_services.GetRequiredService<CrashHandlingService>().Hook();
|
||||
_guard?.StartListening(OnActivationRequested);
|
||||
|
||||
// Before the first window: names WPF-UI's unnamed template parts for screen readers.
|
||||
Behaviors.WpfUiAccessibility.Register();
|
||||
|
||||
ApplyUserPreferences();
|
||||
|
||||
var legalGate = _services.GetRequiredService<LegalGateService>();
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CommandForge.Desktop.Behaviors;
|
||||
|
||||
/// <summary>
|
||||
/// Where the window's own shortcuts may fire. Ctrl+Q (exit) does nothing while the keyboard is in a
|
||||
/// text box being edited, so a slip of the finger can't discard what is being typed; a search box
|
||||
/// opts back in with <c>beh:ShortcutScope.AllowExit="True"</c>, since its text is cheap to retype.
|
||||
/// </summary>
|
||||
public static class ShortcutScope
|
||||
{
|
||||
public static readonly DependencyProperty AllowExitProperty = DependencyProperty.RegisterAttached(
|
||||
"AllowExit", typeof(bool), typeof(ShortcutScope), new PropertyMetadata(false));
|
||||
|
||||
public static bool GetAllowExit(DependencyObject element)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(element);
|
||||
return (bool)element.GetValue(AllowExitProperty);
|
||||
}
|
||||
|
||||
public static void SetAllowExit(DependencyObject element, bool value)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(element);
|
||||
element.SetValue(AllowExitProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>Whether Ctrl+Q may close the window with <paramref name="focused"/> holding the keyboard.</summary>
|
||||
public static bool CanExitFrom(IInputElement? focused) => focused switch
|
||||
{
|
||||
TextBox { IsReadOnly: false } box => GetAllowExit(box) || FindTemplatedTextBox(box) is { } owner && GetAllowExit(owner),
|
||||
_ => true,
|
||||
};
|
||||
|
||||
// WPF-UI's TextBox is the TextBox itself; a plain TextBox inside another control's template
|
||||
// (an editable ComboBox) answers for its templated parent.
|
||||
private static DependencyObject? FindTemplatedTextBox(TextBox box) => box.TemplatedParent;
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using CommandForge.Desktop.Controls;
|
||||
using CommandForge.Desktop.Resources;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace CommandForge.Desktop.Behaviors;
|
||||
|
||||
/// <summary>
|
||||
/// WPF-UI gives some parts of its control templates an AutomationId but no name, so Narrator says only
|
||||
/// "button" or "list": the navigation pane's toggle and its two lists, the title bar's caption buttons,
|
||||
/// a text box's clear (×) button and a card expander's header. Its templates also draw icons as font
|
||||
/// glyphs that UI Automation lists as text: the arrow of a navigation item that has sub-items, a check
|
||||
/// box's tick and an info bar's severity icon. Registered once at startup, these class handlers name
|
||||
/// those parts from the app's strings (live, so a language switch renames them), keep the arrow and
|
||||
/// the tick out of the tree (the item and the check box already say expanded or checked) and make the
|
||||
/// severity icon read the whole info bar, whose own text the tree leaves out.
|
||||
/// </summary>
|
||||
public static class WpfUiAccessibility
|
||||
{
|
||||
/// <summary>The controls <see cref="Apply"/> fixes.</summary>
|
||||
private static readonly Type[] HandledTypes =
|
||||
[
|
||||
typeof(NavigationView), typeof(TitleBar), typeof(Wpf.Ui.Controls.TextBox), typeof(CardExpander),
|
||||
typeof(NavigationViewItem), typeof(CheckBox), typeof(InfoBar),
|
||||
];
|
||||
|
||||
private static bool _registered;
|
||||
|
||||
/// <summary>
|
||||
/// Registers the handlers for every window the app opens. Call once, before the first window.
|
||||
/// <see cref="Apply"/> runs when one of the controls loads and whenever its size changes. Loaded
|
||||
/// alone is not enough: WPF raises it only on elements that have a Loaded handler of their own, and
|
||||
/// some WPF-UI controls (CardExpander) have none, so a class handler never hears it. SizeChanged is
|
||||
/// raised on every element after its first layout, when its template is applied.
|
||||
/// </summary>
|
||||
public static void Register()
|
||||
{
|
||||
if (_registered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_registered = true;
|
||||
var handler = new RoutedEventHandler((sender, _) => Apply(sender));
|
||||
foreach (var type in HandledTypes)
|
||||
{
|
||||
EventManager.RegisterClassHandler(type, FrameworkElement.LoadedEvent, handler);
|
||||
EventManager.RegisterClassHandler(type, FrameworkElement.SizeChangedEvent, handler);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Names the parts of <paramref name="element"/>'s template, or keeps its glyph out of the
|
||||
/// automation tree, when it is one of the WPF-UI controls this class fixes; does nothing for
|
||||
/// anything else, or for a part already fixed. Its template must be applied (it is by layout).
|
||||
/// </summary>
|
||||
public static void Apply(object? element)
|
||||
{
|
||||
switch (element)
|
||||
{
|
||||
case NavigationView navigation:
|
||||
NameNavigationParts(navigation);
|
||||
break;
|
||||
case TitleBar titleBar:
|
||||
NamePart(titleBar, "PART_MinimizeButton", "A11y_Minimize");
|
||||
NameMaximizeButton(titleBar);
|
||||
NamePart(titleBar, "PART_CloseButton", "A11y_Close");
|
||||
break;
|
||||
case Wpf.Ui.Controls.TextBox textBox:
|
||||
NamePart(textBox, "ClearButton", "A11y_ClearText");
|
||||
break;
|
||||
case CardExpander expander:
|
||||
NameExpanderHeader(expander);
|
||||
break;
|
||||
case NavigationViewItem item:
|
||||
HideGlyph(item, "ChevronIcon");
|
||||
break;
|
||||
case CheckBox box:
|
||||
HideGlyph(box, "ControlIcon");
|
||||
break;
|
||||
case InfoBar bar:
|
||||
NameSeverityIcon(bar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void NameNavigationParts(NavigationView navigation)
|
||||
{
|
||||
NamePart(navigation, "PART_ToggleButton", "MenuToggleSidebar", withToolTip: true);
|
||||
NamePart(navigation, "PART_MenuItemsItemsControl", "A11y_NavigationPages");
|
||||
NamePart(navigation, "PART_FooterMenuItemsItemsControl", "A11y_NavigationFooter");
|
||||
|
||||
// The frame that shows the page is a Tab stop of its own with nothing to operate: Tab from the
|
||||
// pane went to an invisible, unnamed "pane" before the page's first control.
|
||||
if (FindPart(navigation, "PART_NavigationViewContentPresenter") is { Focusable: true } presenter)
|
||||
{
|
||||
presenter.Focusable = false;
|
||||
}
|
||||
}
|
||||
|
||||
private static void NamePart(Control control, string partName, string key, bool withToolTip = false)
|
||||
{
|
||||
if (FindPart(control, partName) is not { } part || part.GetValue(AutomationProperties.NameProperty) is string { Length: > 0 })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
part.SetBinding(AutomationProperties.NameProperty, LocalizationManager.Bind(key));
|
||||
if (withToolTip)
|
||||
{
|
||||
part.SetBinding(FrameworkElement.ToolTipProperty, LocalizationManager.Bind(key));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WPF-UI has one button for Maximize and Restore down: it draws Restore while the window is
|
||||
/// maximized, and its name follows.
|
||||
/// </summary>
|
||||
private static void NameMaximizeButton(TitleBar titleBar)
|
||||
{
|
||||
if (FindPart(titleBar, "PART_MaximizeButton") is { } button && !BindingOperations.IsDataBound(button, AutomationProperties.NameProperty))
|
||||
{
|
||||
var name = new MultiBinding { Converter = MaximizeNameConverter.Instance };
|
||||
name.Bindings.Add(new Binding(nameof(TitleBar.IsMaximized)) { Source = titleBar });
|
||||
name.Bindings.Add(LocalizationManager.Bind("A11y_Maximize"));
|
||||
name.Bindings.Add(LocalizationManager.Bind("A11y_Restore"));
|
||||
button.SetBinding(AutomationProperties.NameProperty, name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The header toggle speaks the expander's own name (set in XAML), so "Logs size, expanded".</summary>
|
||||
private static void NameExpanderHeader(CardExpander expander)
|
||||
{
|
||||
if (FindPart(expander, "ExpanderToggleButton") is { } toggle && !BindingOperations.IsDataBound(toggle, AutomationProperties.NameProperty))
|
||||
{
|
||||
toggle.SetBinding(AutomationProperties.NameProperty, new Binding { Path = new PropertyPath(AutomationProperties.NameProperty), Source = expander });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Moves a template icon's glyph into a <see cref="GlyphHost"/>, out of the automation tree.</summary>
|
||||
private static void HideGlyph(Control control, string iconPart)
|
||||
{
|
||||
if (FindPart(control, iconPart) is IconElement icon && Glyph(icon) is { Parent: Panel panel } glyph)
|
||||
{
|
||||
var index = panel.Children.IndexOf(glyph);
|
||||
panel.Children.RemoveAt(index);
|
||||
panel.Children.Insert(index, new GlyphHost { Child = glyph });
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An info bar's title and message are TextBlocks of its template, which WPF leaves out of the
|
||||
/// control view, so Narrator never read them; the severity icon's glyph is the bar's one element
|
||||
/// there. It is named with the whole bar: "Warning: These commands are not part of the vetted…".
|
||||
/// </summary>
|
||||
private static void NameSeverityIcon(InfoBar bar)
|
||||
{
|
||||
if (FindPart(bar, "SymbolIcon") is IconElement icon && Glyph(icon) is { } glyph && !BindingOperations.IsDataBound(glyph, AutomationProperties.NameProperty))
|
||||
{
|
||||
var name = new MultiBinding { Converter = InfoBarNameConverter.Instance };
|
||||
name.Bindings.Add(new Binding(nameof(InfoBar.Severity)) { Source = bar });
|
||||
name.Bindings.Add(LocalizationManager.Bind("A11y_SeverityInfo"));
|
||||
name.Bindings.Add(LocalizationManager.Bind("A11y_SeveritySuccess"));
|
||||
name.Bindings.Add(LocalizationManager.Bind("A11y_SeverityWarning"));
|
||||
name.Bindings.Add(LocalizationManager.Bind("A11y_SeverityError"));
|
||||
name.Bindings.Add(LocalizationManager.Bind("A11y_InfoBar"));
|
||||
name.Bindings.Add(new Binding(nameof(InfoBar.Title)) { Source = bar });
|
||||
name.Bindings.Add(new Binding(nameof(InfoBar.Message)) { Source = bar });
|
||||
glyph.SetBinding(AutomationProperties.NameProperty, name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pure: what an info bar is read as, from its translated severity, the "{0}: {1}" pattern and its
|
||||
/// title and message (either may be empty).
|
||||
/// </summary>
|
||||
public static string InfoBarText(string severity, string pattern, string? title, string? message)
|
||||
{
|
||||
var text = string.Join(' ', new[] { title, message }.Where(part => !string.IsNullOrWhiteSpace(part)));
|
||||
return text.Length == 0 ? severity : string.Format(CultureInfo.CurrentCulture, pattern, severity, text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The TextBlock that draws an icon's glyph: WPF-UI's FontIcon puts it in a panel, its only visual
|
||||
/// child. Null when it is not there (an image icon, already moved into a GlyphHost, a WPF-UI that
|
||||
/// draws icons another way), so nothing changes.
|
||||
/// </summary>
|
||||
private static System.Windows.Controls.TextBlock? Glyph(IconElement icon)
|
||||
=> VisualTreeHelper.GetChildrenCount(icon) == 1
|
||||
&& VisualTreeHelper.GetChild(icon, 0) is Panel { Children: [System.Windows.Controls.TextBlock glyph] }
|
||||
? glyph
|
||||
: null;
|
||||
|
||||
private static FrameworkElement? FindPart(Control control, string partName)
|
||||
{
|
||||
control.ApplyTemplate();
|
||||
return control.Template?.FindName(partName, control) as FrameworkElement;
|
||||
}
|
||||
|
||||
/// <summary>The values: whether the window is maximized; the translated Maximize and Restore down.</summary>
|
||||
private sealed class MaximizeNameConverter : IMultiValueConverter
|
||||
{
|
||||
public static readonly MaximizeNameConverter Instance = new();
|
||||
|
||||
public object Convert(object[] values, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (values is not [bool maximized, string maximize, string restore])
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return maximized ? restore : maximize;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The values: the bar's <see cref="InfoBarSeverity"/>; the translated names of information,
|
||||
/// success, warning and error; the pattern; the bar's title and message.
|
||||
/// </summary>
|
||||
private sealed class InfoBarNameConverter : IMultiValueConverter
|
||||
{
|
||||
public static readonly InfoBarNameConverter Instance = new();
|
||||
|
||||
public object Convert(object[] values, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (values is not [InfoBarSeverity severity, string info, string success, string warning, string error, string pattern, var title, var message])
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var name = severity switch
|
||||
{
|
||||
InfoBarSeverity.Success => success,
|
||||
InfoBarSeverity.Warning => warning,
|
||||
InfoBarSeverity.Error => error,
|
||||
_ => info,
|
||||
};
|
||||
return InfoBarText(name, pattern, title as string, message as string);
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.14" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.15" />
|
||||
<PackageReference Include="Serilog" Version="4.4.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="2.1.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
|
||||
namespace CommandForge.Desktop.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// The automation peer of an element that only decorates (<see cref="DecorativeIcon"/>,
|
||||
/// <see cref="GlyphHost"/>): it has no children, so a font glyph inside it - a private-use character
|
||||
/// a screen reader can't say - is not in the tree. Unnamed, it is in the raw view only; given an
|
||||
/// <c>AutomationProperties.Name</c>, it is an image with that name.
|
||||
/// </summary>
|
||||
internal sealed class DecorativeAutomationPeer(FrameworkElement owner) : FrameworkElementAutomationPeer(owner)
|
||||
{
|
||||
private bool IsNamed => !string.IsNullOrEmpty(AutomationProperties.GetName(Owner));
|
||||
|
||||
protected override List<AutomationPeer>? GetChildrenCore() => null;
|
||||
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Image;
|
||||
|
||||
protected override string GetClassNameCore() => Owner.GetType().Name;
|
||||
|
||||
protected override bool IsControlElementCore() => IsNamed && base.IsControlElementCore();
|
||||
|
||||
protected override bool IsContentElementCore() => IsNamed && base.IsContentElementCore();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Windows.Automation.Peers;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace CommandForge.Desktop.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// WPF-UI's <see cref="SymbolIcon"/> for an icon that decorates the text beside it, as every icon in
|
||||
/// this app does. Its glyph is a character from the icon font's private Unicode range, drawn by a plain
|
||||
/// TextBlock, so UI Automation exposed it as text and a screen reader could read that character. This
|
||||
/// icon's automation peer has no children, which keeps the glyph out of the tree. An icon that means
|
||||
/// something on its own gets an <c>AutomationProperties.Name</c> and is then an image with that name.
|
||||
/// </summary>
|
||||
public sealed class DecorativeIcon : SymbolIcon
|
||||
{
|
||||
public DecorativeIcon()
|
||||
{
|
||||
}
|
||||
|
||||
public DecorativeIcon(SymbolRegular symbol, double fontSize = 14, bool filled = false)
|
||||
: base(symbol, fontSize, filled)
|
||||
{
|
||||
}
|
||||
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new DecorativeAutomationPeer(this);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CommandForge.Desktop.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// Holds the glyph of an icon that a WPF-UI control template draws (a check box's tick, a navigation
|
||||
/// item's arrow), where <see cref="DecorativeIcon"/> can't be used: <see cref="Behaviors.WpfUiAccessibility"/>
|
||||
/// moves the glyph's TextBlock in here, and this element's automation peer keeps it out of the tree.
|
||||
/// The control itself already says what the mark shows (checked, expanded).
|
||||
/// </summary>
|
||||
public sealed class GlyphHost : Decorator
|
||||
{
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new DecorativeAutomationPeer(this);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CommandForge.Desktop.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="StackPanel"/> that screen readers announce as a named group, like an HTML fieldset:
|
||||
/// set <c>AutomationProperties.Name</c> and Narrator says "Theme, group" when focus moves into one of
|
||||
/// its radio buttons. A plain panel has no automation peer, so its name would never be heard.
|
||||
/// </summary>
|
||||
public sealed class LabeledGroup : StackPanel
|
||||
{
|
||||
protected override AutomationPeer OnCreateAutomationPeer() => new LabeledGroupAutomationPeer(this);
|
||||
|
||||
private sealed class LabeledGroupAutomationPeer(LabeledGroup owner) : FrameworkElementAutomationPeer(owner)
|
||||
{
|
||||
protected override AutomationControlType GetAutomationControlTypeCore() => AutomationControlType.Group;
|
||||
|
||||
protected override string GetClassNameCore() => nameof(LabeledGroup);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace CommandForge.Desktop.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// True when the value is null, empty or only white space, e.g. a blank console line, which a screen
|
||||
/// reader would otherwise read by its type name or not at all.
|
||||
/// </summary>
|
||||
public sealed class BlankToBooleanConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> value is null || (value is string text && string.IsNullOrWhiteSpace(text));
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider) => this;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace CommandForge.Desktop.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// Fills a localized composite format with the other bound values: the first binding is the format
|
||||
/// (for example <c>{res:Loc}</c>'s indexer binding to "Move {0} up"), the rest are its arguments.
|
||||
/// Used for accessible names that must say which row a repeated button acts on.
|
||||
/// </summary>
|
||||
public sealed class FormatConverter : MarkupExtension, IMultiValueConverter
|
||||
{
|
||||
public override object ProvideValue(IServiceProvider serviceProvider) => this;
|
||||
|
||||
public object Convert(object?[] values, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (values is not [string format, .. var rest])
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var args = rest.Select(v => v == DependencyProperty.UnsetValue ? string.Empty : v).ToArray();
|
||||
return string.Format(CultureInfo.CurrentCulture, format, args);
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object? value, Type[] targetTypes, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Markup;
|
||||
using CommandForge.Application.Logging;
|
||||
using CommandForge.Desktop.Resources;
|
||||
|
||||
namespace CommandForge.Desktop.Converters;
|
||||
|
||||
/// <summary>Shows a <see cref="LogLevel"/> by its localized name instead of the raw enum name.</summary>
|
||||
public sealed class LogLevelToTextConverter : MarkupExtension, IValueConverter
|
||||
{
|
||||
public override object ProvideValue(IServiceProvider serviceProvider) => this;
|
||||
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> value is LogLevel level ? Text(level) : string.Empty;
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
|
||||
/// <summary>Pure: the localized name of <paramref name="level"/>.</summary>
|
||||
public static string Text(LogLevel level) => Strings.Get(level switch
|
||||
{
|
||||
LogLevel.Verbose => "LogLevel_Verbose",
|
||||
LogLevel.Debug => "LogLevel_Debug",
|
||||
LogLevel.Warning => "LogLevel_Warning",
|
||||
LogLevel.Error or LogLevel.Fatal => "LogLevel_Error",
|
||||
_ => "LogLevel_Info",
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using CommandForge.Desktop.Resources;
|
||||
|
||||
namespace CommandForge.Desktop.Converters;
|
||||
|
||||
/// <summary>
|
||||
/// The accessible name of a button repeated on every row of a list: its visible label first, then the
|
||||
/// row it acts on ("Undo: Flush DNS cache"), so a screen reader user knows which row a "Undo" is for
|
||||
/// and the name still starts with what is shown. Bind the row's title; set <see cref="LabelKey"/> to
|
||||
/// the button's own label key.
|
||||
/// </summary>
|
||||
public sealed class RowActionNameConverter : IValueConverter
|
||||
{
|
||||
/// <summary>The resource key of the button's visible label (for example <c>History_Undo</c>).</summary>
|
||||
public string LabelKey { get; set; } = string.Empty;
|
||||
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> Format(Strings.Get(LabelKey), value as string ?? string.Empty);
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
|
||||
/// <summary>Pure: joins a button label and the row title with the localized pattern.</summary>
|
||||
public static string Format(string label, string rowTitle)
|
||||
=> string.IsNullOrEmpty(rowTitle) ? label : string.Format(CultureInfo.CurrentCulture, Strings.Get("A11y_RowAction"), label, rowTitle);
|
||||
}
|
||||
@@ -22,6 +22,10 @@ public sealed class LocalizationManager : INotifyPropertyChanged
|
||||
/// <summary>Resolves <paramref name="key"/> for the current UI culture.</summary>
|
||||
public string this[string key] => Strings.Get(key);
|
||||
|
||||
/// <summary>A one-way binding to <paramref name="key"/>'s text that follows culture changes (the C# twin of <see cref="LocExtension"/>).</summary>
|
||||
public static System.Windows.Data.Binding Bind(string key)
|
||||
=> new($"[{key}]") { Source = Instance, Mode = System.Windows.Data.BindingMode.OneWay };
|
||||
|
||||
/// <summary>The active UI culture.</summary>
|
||||
public CultureInfo CurrentCulture { get; private set; } = CultureInfo.CurrentUICulture;
|
||||
|
||||
|
||||
@@ -1287,7 +1287,7 @@
|
||||
<value>Mover la selección (listas y paleta)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_OpenSelected" xml:space="preserve">
|
||||
<value>Abrir el comando seleccionado</value>
|
||||
<value>Abrir el comando seleccionado (catálogo, Historial, paleta de comandos)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_CloseDialog" xml:space="preserve">
|
||||
<value>Cerrar diálogo / cancelar</value>
|
||||
@@ -2813,4 +2813,118 @@ Los detalles se escribieron en la carpeta de registros:
|
||||
<data name="Cmd_net.vpn.settings_Desc" xml:space="preserve">
|
||||
<value>Abre Configuración para agregar, conectar o quitar las conexiones VPN integradas de Windows.</value>
|
||||
</data>
|
||||
<data name="A11y_RunStarted" xml:space="preserve">
|
||||
<value>Ejecutando {0}</value>
|
||||
</data>
|
||||
<data name="A11y_RunResult" xml:space="preserve">
|
||||
<value>{0}: {1}. Código de salida {2}, {3}.</value>
|
||||
</data>
|
||||
<data name="A11y_RestartRequired" xml:space="preserve">
|
||||
<value>Reinicia Windows para terminar.</value>
|
||||
</data>
|
||||
<data name="A11y_CanUndo" xml:space="preserve">
|
||||
<value>Se puede deshacer</value>
|
||||
</data>
|
||||
<data name="A11y_Favorite" xml:space="preserve">
|
||||
<value>Favorito</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCount" xml:space="preserve">
|
||||
<value>{0} comandos encontrados</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCountOne" xml:space="preserve">
|
||||
<value>1 comando encontrado</value>
|
||||
</data>
|
||||
<data name="A11y_PaletteItem" xml:space="preserve">
|
||||
<value>{0}, {1}, {2} de {3}</value>
|
||||
</data>
|
||||
<data name="A11y_Percent" xml:space="preserve">
|
||||
<value>{0} % descargado</value>
|
||||
</data>
|
||||
<data name="A11y_Minimize" xml:space="preserve">
|
||||
<value>Minimizar</value>
|
||||
</data>
|
||||
<data name="A11y_Maximize" xml:space="preserve">
|
||||
<value>Maximizar</value>
|
||||
</data>
|
||||
<data name="A11y_Restore" xml:space="preserve">
|
||||
<value>Restaurar</value>
|
||||
</data>
|
||||
<data name="A11y_Close" xml:space="preserve">
|
||||
<value>Cerrar</value>
|
||||
</data>
|
||||
<data name="A11y_ClearText" xml:space="preserve">
|
||||
<value>Borrar</value>
|
||||
</data>
|
||||
<data name="A11y_RowAction" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
<data name="A11y_LabelValue" xml:space="preserve">
|
||||
<value>{0} {1}</value>
|
||||
</data>
|
||||
<data name="A11y_LogEntry" xml:space="preserve">
|
||||
<value>{0}, {1}: {2}</value>
|
||||
</data>
|
||||
<data name="A11y_HistoryEntry" xml:space="preserve">
|
||||
<value>{0}, {1}, {2}</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterList" xml:space="preserve">
|
||||
<value>Cambiar el tamaño de la lista de comandos</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterConsole" xml:space="preserve">
|
||||
<value>Cambiar el tamaño de la consola</value>
|
||||
</data>
|
||||
<data name="A11y_RecipeSteps" xml:space="preserve">
|
||||
<value>Pasos de la receta</value>
|
||||
</data>
|
||||
<data name="A11y_CommandId" xml:space="preserve">
|
||||
<value>ID del comando: {0}</value>
|
||||
</data>
|
||||
<data name="Console_ErrorLine" xml:space="preserve">
|
||||
<value>Error: {0}</value>
|
||||
</data>
|
||||
<data name="Favorite_Add" xml:space="preserve">
|
||||
<value>Añadir a favoritos</value>
|
||||
</data>
|
||||
<data name="Favorite_Remove" xml:space="preserve">
|
||||
<value>Quitar de favoritos</value>
|
||||
</data>
|
||||
<data name="LogLevel_Verbose" xml:space="preserve">
|
||||
<value>Detallado</value>
|
||||
</data>
|
||||
<data name="Shortcuts_Regions" xml:space="preserve">
|
||||
<value>Moverse entre el panel de navegación, la página y la consola</value>
|
||||
</data>
|
||||
<data name="About_Accessibility" xml:space="preserve">
|
||||
<value>Accesibilidad</value>
|
||||
</data>
|
||||
<data name="About_AccessibilityContact" xml:space="preserve">
|
||||
<value>Barreras de accesibilidad</value>
|
||||
</data>
|
||||
<data name="A11y_CurrentPage" xml:space="preserve">
|
||||
<value>Página actual</value>
|
||||
</data>
|
||||
<data name="A11y_BlankLine" xml:space="preserve">
|
||||
<value>Línea en blanco</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationPages" xml:space="preserve">
|
||||
<value>Páginas</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationFooter" xml:space="preserve">
|
||||
<value>Herramientas y configuración</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityInfo" xml:space="preserve">
|
||||
<value>Información</value>
|
||||
</data>
|
||||
<data name="A11y_SeveritySuccess" xml:space="preserve">
|
||||
<value>Éxito</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityWarning" xml:space="preserve">
|
||||
<value>Advertencia</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityError" xml:space="preserve">
|
||||
<value>Error</value>
|
||||
</data>
|
||||
<data name="A11y_InfoBar" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1287,7 +1287,7 @@
|
||||
<value>選択を移動(一覧とパレット)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_OpenSelected" xml:space="preserve">
|
||||
<value>選択したコマンドを開く</value>
|
||||
<value>選択したコマンドを開く(カタログ、履歴、コマンドパレット)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_CloseDialog" xml:space="preserve">
|
||||
<value>ダイアログを閉じる / キャンセル</value>
|
||||
@@ -2813,4 +2813,118 @@
|
||||
<data name="Cmd_net.vpn.settings_Desc" xml:space="preserve">
|
||||
<value>設定を開いて、Windows 組み込みの VPN 接続を追加、接続、削除します。</value>
|
||||
</data>
|
||||
<data name="A11y_RunStarted" xml:space="preserve">
|
||||
<value>{0} を実行中</value>
|
||||
</data>
|
||||
<data name="A11y_RunResult" xml:space="preserve">
|
||||
<value>{0}: {1}。終了コード {2}、{3}。</value>
|
||||
</data>
|
||||
<data name="A11y_RestartRequired" xml:space="preserve">
|
||||
<value>完了するには Windows を再起動してください。</value>
|
||||
</data>
|
||||
<data name="A11y_CanUndo" xml:space="preserve">
|
||||
<value>元に戻せます</value>
|
||||
</data>
|
||||
<data name="A11y_Favorite" xml:space="preserve">
|
||||
<value>お気に入り</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCount" xml:space="preserve">
|
||||
<value>{0} 件のコマンドが見つかりました</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCountOne" xml:space="preserve">
|
||||
<value>1 件のコマンドが見つかりました</value>
|
||||
</data>
|
||||
<data name="A11y_PaletteItem" xml:space="preserve">
|
||||
<value>{0}、{1}、{3} 件中 {2} 件目</value>
|
||||
</data>
|
||||
<data name="A11y_Percent" xml:space="preserve">
|
||||
<value>{0}% ダウンロード済み</value>
|
||||
</data>
|
||||
<data name="A11y_Minimize" xml:space="preserve">
|
||||
<value>最小化</value>
|
||||
</data>
|
||||
<data name="A11y_Maximize" xml:space="preserve">
|
||||
<value>最大化</value>
|
||||
</data>
|
||||
<data name="A11y_Restore" xml:space="preserve">
|
||||
<value>元のサイズに戻す</value>
|
||||
</data>
|
||||
<data name="A11y_Close" xml:space="preserve">
|
||||
<value>閉じる</value>
|
||||
</data>
|
||||
<data name="A11y_ClearText" xml:space="preserve">
|
||||
<value>クリア</value>
|
||||
</data>
|
||||
<data name="A11y_RowAction" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
<data name="A11y_LabelValue" xml:space="preserve">
|
||||
<value>{0} {1}</value>
|
||||
</data>
|
||||
<data name="A11y_LogEntry" xml:space="preserve">
|
||||
<value>{0}、{1}: {2}</value>
|
||||
</data>
|
||||
<data name="A11y_HistoryEntry" xml:space="preserve">
|
||||
<value>{0}、{1}、{2}</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterList" xml:space="preserve">
|
||||
<value>コマンド一覧のサイズを変更</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterConsole" xml:space="preserve">
|
||||
<value>コンソールのサイズを変更</value>
|
||||
</data>
|
||||
<data name="A11y_RecipeSteps" xml:space="preserve">
|
||||
<value>レシピの手順</value>
|
||||
</data>
|
||||
<data name="A11y_CommandId" xml:space="preserve">
|
||||
<value>コマンド ID: {0}</value>
|
||||
</data>
|
||||
<data name="Console_ErrorLine" xml:space="preserve">
|
||||
<value>エラー: {0}</value>
|
||||
</data>
|
||||
<data name="Favorite_Add" xml:space="preserve">
|
||||
<value>お気に入りに追加</value>
|
||||
</data>
|
||||
<data name="Favorite_Remove" xml:space="preserve">
|
||||
<value>お気に入りから削除</value>
|
||||
</data>
|
||||
<data name="LogLevel_Verbose" xml:space="preserve">
|
||||
<value>詳細</value>
|
||||
</data>
|
||||
<data name="Shortcuts_Regions" xml:space="preserve">
|
||||
<value>ナビゲーション ウィンドウ、ページ、コンソールの間を移動</value>
|
||||
</data>
|
||||
<data name="About_Accessibility" xml:space="preserve">
|
||||
<value>アクセシビリティ</value>
|
||||
</data>
|
||||
<data name="About_AccessibilityContact" xml:space="preserve">
|
||||
<value>アクセシビリティの問題</value>
|
||||
</data>
|
||||
<data name="A11y_CurrentPage" xml:space="preserve">
|
||||
<value>現在のページ</value>
|
||||
</data>
|
||||
<data name="A11y_BlankLine" xml:space="preserve">
|
||||
<value>空白行</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationPages" xml:space="preserve">
|
||||
<value>ページ</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationFooter" xml:space="preserve">
|
||||
<value>ツールと設定</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityInfo" xml:space="preserve">
|
||||
<value>情報</value>
|
||||
</data>
|
||||
<data name="A11y_SeveritySuccess" xml:space="preserve">
|
||||
<value>成功</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityWarning" xml:space="preserve">
|
||||
<value>警告</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityError" xml:space="preserve">
|
||||
<value>エラー</value>
|
||||
</data>
|
||||
<data name="A11y_InfoBar" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1287,7 +1287,7 @@ Continue?</value>
|
||||
<value>Move selection (lists & palette)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_OpenSelected" xml:space="preserve">
|
||||
<value>Open the selected command</value>
|
||||
<value>Open the selected command (catalog, History, Command Palette)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_CloseDialog" xml:space="preserve">
|
||||
<value>Close dialog / cancel</value>
|
||||
@@ -2813,4 +2813,118 @@ Details were written to the log folder:
|
||||
<data name="Cmd_net.vpn.settings_Desc" xml:space="preserve">
|
||||
<value>Open Settings to add, connect to or remove the built-in Windows VPN connections.</value>
|
||||
</data>
|
||||
<data name="A11y_RunStarted" xml:space="preserve">
|
||||
<value>Running {0}</value>
|
||||
</data>
|
||||
<data name="A11y_RunResult" xml:space="preserve">
|
||||
<value>{0}: {1}. Exit code {2}, {3}.</value>
|
||||
</data>
|
||||
<data name="A11y_RestartRequired" xml:space="preserve">
|
||||
<value>Restart Windows to finish.</value>
|
||||
</data>
|
||||
<data name="A11y_CanUndo" xml:space="preserve">
|
||||
<value>Can be undone</value>
|
||||
</data>
|
||||
<data name="A11y_Favorite" xml:space="preserve">
|
||||
<value>Favorite</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCount" xml:space="preserve">
|
||||
<value>{0} commands found</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCountOne" xml:space="preserve">
|
||||
<value>1 command found</value>
|
||||
</data>
|
||||
<data name="A11y_PaletteItem" xml:space="preserve">
|
||||
<value>{0}, {1}, {2} of {3}</value>
|
||||
</data>
|
||||
<data name="A11y_Percent" xml:space="preserve">
|
||||
<value>{0}% downloaded</value>
|
||||
</data>
|
||||
<data name="A11y_Minimize" xml:space="preserve">
|
||||
<value>Minimize</value>
|
||||
</data>
|
||||
<data name="A11y_Maximize" xml:space="preserve">
|
||||
<value>Maximize</value>
|
||||
</data>
|
||||
<data name="A11y_Restore" xml:space="preserve">
|
||||
<value>Restore down</value>
|
||||
</data>
|
||||
<data name="A11y_Close" xml:space="preserve">
|
||||
<value>Close</value>
|
||||
</data>
|
||||
<data name="A11y_ClearText" xml:space="preserve">
|
||||
<value>Clear</value>
|
||||
</data>
|
||||
<data name="A11y_RowAction" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
<data name="A11y_LabelValue" xml:space="preserve">
|
||||
<value>{0} {1}</value>
|
||||
</data>
|
||||
<data name="A11y_LogEntry" xml:space="preserve">
|
||||
<value>{0}, {1}: {2}</value>
|
||||
</data>
|
||||
<data name="A11y_HistoryEntry" xml:space="preserve">
|
||||
<value>{0}, {1}, {2}</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterList" xml:space="preserve">
|
||||
<value>Resize the command list</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterConsole" xml:space="preserve">
|
||||
<value>Resize the console</value>
|
||||
</data>
|
||||
<data name="A11y_RecipeSteps" xml:space="preserve">
|
||||
<value>Recipe steps</value>
|
||||
</data>
|
||||
<data name="A11y_CommandId" xml:space="preserve">
|
||||
<value>Command ID: {0}</value>
|
||||
</data>
|
||||
<data name="Console_ErrorLine" xml:space="preserve">
|
||||
<value>Error: {0}</value>
|
||||
</data>
|
||||
<data name="Favorite_Add" xml:space="preserve">
|
||||
<value>Add to favorites</value>
|
||||
</data>
|
||||
<data name="Favorite_Remove" xml:space="preserve">
|
||||
<value>Remove from favorites</value>
|
||||
</data>
|
||||
<data name="LogLevel_Verbose" xml:space="preserve">
|
||||
<value>Verbose</value>
|
||||
</data>
|
||||
<data name="Shortcuts_Regions" xml:space="preserve">
|
||||
<value>Move between the navigation pane, the page and the console</value>
|
||||
</data>
|
||||
<data name="About_Accessibility" xml:space="preserve">
|
||||
<value>Accessibility</value>
|
||||
</data>
|
||||
<data name="About_AccessibilityContact" xml:space="preserve">
|
||||
<value>Accessibility barriers</value>
|
||||
</data>
|
||||
<data name="A11y_CurrentPage" xml:space="preserve">
|
||||
<value>Current page</value>
|
||||
</data>
|
||||
<data name="A11y_BlankLine" xml:space="preserve">
|
||||
<value>Blank line</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationPages" xml:space="preserve">
|
||||
<value>Pages</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationFooter" xml:space="preserve">
|
||||
<value>Tools and settings</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityInfo" xml:space="preserve">
|
||||
<value>Information</value>
|
||||
</data>
|
||||
<data name="A11y_SeveritySuccess" xml:space="preserve">
|
||||
<value>Success</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityWarning" xml:space="preserve">
|
||||
<value>Warning</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityError" xml:space="preserve">
|
||||
<value>Error</value>
|
||||
</data>
|
||||
<data name="A11y_InfoBar" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1287,7 +1287,7 @@ Tiếp tục?</value>
|
||||
<value>Di chuyển lựa chọn (danh sách & palette)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_OpenSelected" xml:space="preserve">
|
||||
<value>Mở lệnh đang chọn</value>
|
||||
<value>Mở lệnh đang chọn (danh mục lệnh, Lịch sử, Command Palette)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_CloseDialog" xml:space="preserve">
|
||||
<value>Đóng hộp thoại / hủy</value>
|
||||
@@ -2813,4 +2813,118 @@ Chi tiết đã được ghi vào thư mục log:
|
||||
<data name="Cmd_net.vpn.settings_Desc" xml:space="preserve">
|
||||
<value>Mở Cài đặt để thêm, kết nối hoặc xóa kết nối VPN tích hợp của Windows.</value>
|
||||
</data>
|
||||
<data name="A11y_RunStarted" xml:space="preserve">
|
||||
<value>Đang chạy {0}</value>
|
||||
</data>
|
||||
<data name="A11y_RunResult" xml:space="preserve">
|
||||
<value>{0}: {1}. Mã thoát {2}, {3}.</value>
|
||||
</data>
|
||||
<data name="A11y_RestartRequired" xml:space="preserve">
|
||||
<value>Hãy khởi động lại Windows để hoàn tất.</value>
|
||||
</data>
|
||||
<data name="A11y_CanUndo" xml:space="preserve">
|
||||
<value>Có thể hoàn tác</value>
|
||||
</data>
|
||||
<data name="A11y_Favorite" xml:space="preserve">
|
||||
<value>Yêu thích</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCount" xml:space="preserve">
|
||||
<value>Tìm thấy {0} lệnh</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCountOne" xml:space="preserve">
|
||||
<value>Tìm thấy 1 lệnh</value>
|
||||
</data>
|
||||
<data name="A11y_PaletteItem" xml:space="preserve">
|
||||
<value>{0}, {1}, {2} trên {3}</value>
|
||||
</data>
|
||||
<data name="A11y_Percent" xml:space="preserve">
|
||||
<value>Đã tải {0}%</value>
|
||||
</data>
|
||||
<data name="A11y_Minimize" xml:space="preserve">
|
||||
<value>Thu nhỏ</value>
|
||||
</data>
|
||||
<data name="A11y_Maximize" xml:space="preserve">
|
||||
<value>Phóng to</value>
|
||||
</data>
|
||||
<data name="A11y_Restore" xml:space="preserve">
|
||||
<value>Khôi phục kích thước</value>
|
||||
</data>
|
||||
<data name="A11y_Close" xml:space="preserve">
|
||||
<value>Đóng</value>
|
||||
</data>
|
||||
<data name="A11y_ClearText" xml:space="preserve">
|
||||
<value>Xóa</value>
|
||||
</data>
|
||||
<data name="A11y_RowAction" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
<data name="A11y_LabelValue" xml:space="preserve">
|
||||
<value>{0} {1}</value>
|
||||
</data>
|
||||
<data name="A11y_LogEntry" xml:space="preserve">
|
||||
<value>{0}, {1}: {2}</value>
|
||||
</data>
|
||||
<data name="A11y_HistoryEntry" xml:space="preserve">
|
||||
<value>{0}, {1}, {2}</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterList" xml:space="preserve">
|
||||
<value>Đổi kích thước danh sách lệnh</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterConsole" xml:space="preserve">
|
||||
<value>Đổi kích thước bảng điều khiển</value>
|
||||
</data>
|
||||
<data name="A11y_RecipeSteps" xml:space="preserve">
|
||||
<value>Các bước của chuỗi lệnh</value>
|
||||
</data>
|
||||
<data name="A11y_CommandId" xml:space="preserve">
|
||||
<value>ID lệnh: {0}</value>
|
||||
</data>
|
||||
<data name="Console_ErrorLine" xml:space="preserve">
|
||||
<value>Lỗi: {0}</value>
|
||||
</data>
|
||||
<data name="Favorite_Add" xml:space="preserve">
|
||||
<value>Thêm vào yêu thích</value>
|
||||
</data>
|
||||
<data name="Favorite_Remove" xml:space="preserve">
|
||||
<value>Bỏ khỏi yêu thích</value>
|
||||
</data>
|
||||
<data name="LogLevel_Verbose" xml:space="preserve">
|
||||
<value>Chi tiết</value>
|
||||
</data>
|
||||
<data name="Shortcuts_Regions" xml:space="preserve">
|
||||
<value>Chuyển giữa ngăn điều hướng, trang và bảng điều khiển</value>
|
||||
</data>
|
||||
<data name="About_Accessibility" xml:space="preserve">
|
||||
<value>Trợ năng</value>
|
||||
</data>
|
||||
<data name="About_AccessibilityContact" xml:space="preserve">
|
||||
<value>Vấn đề trợ năng</value>
|
||||
</data>
|
||||
<data name="A11y_CurrentPage" xml:space="preserve">
|
||||
<value>Trang hiện tại</value>
|
||||
</data>
|
||||
<data name="A11y_BlankLine" xml:space="preserve">
|
||||
<value>Dòng trống</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationPages" xml:space="preserve">
|
||||
<value>Các trang</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationFooter" xml:space="preserve">
|
||||
<value>Công cụ và cài đặt</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityInfo" xml:space="preserve">
|
||||
<value>Thông tin</value>
|
||||
</data>
|
||||
<data name="A11y_SeveritySuccess" xml:space="preserve">
|
||||
<value>Thành công</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityWarning" xml:space="preserve">
|
||||
<value>Cảnh báo</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityError" xml:space="preserve">
|
||||
<value>Lỗi</value>
|
||||
</data>
|
||||
<data name="A11y_InfoBar" xml:space="preserve">
|
||||
<value>{0}: {1}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1287,7 +1287,7 @@
|
||||
<value>移动选择(列表与面板)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_OpenSelected" xml:space="preserve">
|
||||
<value>打开所选命令</value>
|
||||
<value>打开所选命令(命令目录、历史记录、命令面板)</value>
|
||||
</data>
|
||||
<data name="Shortcuts_CloseDialog" xml:space="preserve">
|
||||
<value>关闭对话框 / 取消</value>
|
||||
@@ -2813,4 +2813,118 @@
|
||||
<data name="Cmd_net.vpn.settings_Desc" xml:space="preserve">
|
||||
<value>打开设置以添加、连接或删除 Windows 内置的 VPN 连接。</value>
|
||||
</data>
|
||||
<data name="A11y_RunStarted" xml:space="preserve">
|
||||
<value>正在运行 {0}</value>
|
||||
</data>
|
||||
<data name="A11y_RunResult" xml:space="preserve">
|
||||
<value>{0}:{1}。退出代码 {2},{3}。</value>
|
||||
</data>
|
||||
<data name="A11y_RestartRequired" xml:space="preserve">
|
||||
<value>请重启 Windows 以完成。</value>
|
||||
</data>
|
||||
<data name="A11y_CanUndo" xml:space="preserve">
|
||||
<value>可撤消</value>
|
||||
</data>
|
||||
<data name="A11y_Favorite" xml:space="preserve">
|
||||
<value>已收藏</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCount" xml:space="preserve">
|
||||
<value>找到 {0} 个命令</value>
|
||||
</data>
|
||||
<data name="A11y_ResultCountOne" xml:space="preserve">
|
||||
<value>找到 1 个命令</value>
|
||||
</data>
|
||||
<data name="A11y_PaletteItem" xml:space="preserve">
|
||||
<value>{0},{1},第 {2} 个,共 {3} 个</value>
|
||||
</data>
|
||||
<data name="A11y_Percent" xml:space="preserve">
|
||||
<value>已下载 {0}%</value>
|
||||
</data>
|
||||
<data name="A11y_Minimize" xml:space="preserve">
|
||||
<value>最小化</value>
|
||||
</data>
|
||||
<data name="A11y_Maximize" xml:space="preserve">
|
||||
<value>最大化</value>
|
||||
</data>
|
||||
<data name="A11y_Restore" xml:space="preserve">
|
||||
<value>向下还原</value>
|
||||
</data>
|
||||
<data name="A11y_Close" xml:space="preserve">
|
||||
<value>关闭</value>
|
||||
</data>
|
||||
<data name="A11y_ClearText" xml:space="preserve">
|
||||
<value>清除</value>
|
||||
</data>
|
||||
<data name="A11y_RowAction" xml:space="preserve">
|
||||
<value>{0}:{1}</value>
|
||||
</data>
|
||||
<data name="A11y_LabelValue" xml:space="preserve">
|
||||
<value>{0}{1}</value>
|
||||
</data>
|
||||
<data name="A11y_LogEntry" xml:space="preserve">
|
||||
<value>{0},{1}:{2}</value>
|
||||
</data>
|
||||
<data name="A11y_HistoryEntry" xml:space="preserve">
|
||||
<value>{0},{1},{2}</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterList" xml:space="preserve">
|
||||
<value>调整命令列表大小</value>
|
||||
</data>
|
||||
<data name="A11y_SplitterConsole" xml:space="preserve">
|
||||
<value>调整控制台大小</value>
|
||||
</data>
|
||||
<data name="A11y_RecipeSteps" xml:space="preserve">
|
||||
<value>配方步骤</value>
|
||||
</data>
|
||||
<data name="A11y_CommandId" xml:space="preserve">
|
||||
<value>命令 ID:{0}</value>
|
||||
</data>
|
||||
<data name="Console_ErrorLine" xml:space="preserve">
|
||||
<value>错误:{0}</value>
|
||||
</data>
|
||||
<data name="Favorite_Add" xml:space="preserve">
|
||||
<value>添加到收藏</value>
|
||||
</data>
|
||||
<data name="Favorite_Remove" xml:space="preserve">
|
||||
<value>从收藏中移除</value>
|
||||
</data>
|
||||
<data name="LogLevel_Verbose" xml:space="preserve">
|
||||
<value>详细</value>
|
||||
</data>
|
||||
<data name="Shortcuts_Regions" xml:space="preserve">
|
||||
<value>在导航窗格、页面和控制台之间切换</value>
|
||||
</data>
|
||||
<data name="About_Accessibility" xml:space="preserve">
|
||||
<value>辅助功能</value>
|
||||
</data>
|
||||
<data name="About_AccessibilityContact" xml:space="preserve">
|
||||
<value>辅助功能问题</value>
|
||||
</data>
|
||||
<data name="A11y_CurrentPage" xml:space="preserve">
|
||||
<value>当前页面</value>
|
||||
</data>
|
||||
<data name="A11y_BlankLine" xml:space="preserve">
|
||||
<value>空行</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationPages" xml:space="preserve">
|
||||
<value>页面</value>
|
||||
</data>
|
||||
<data name="A11y_NavigationFooter" xml:space="preserve">
|
||||
<value>工具和设置</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityInfo" xml:space="preserve">
|
||||
<value>信息</value>
|
||||
</data>
|
||||
<data name="A11y_SeveritySuccess" xml:space="preserve">
|
||||
<value>成功</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityWarning" xml:space="preserve">
|
||||
<value>警告</value>
|
||||
</data>
|
||||
<data name="A11y_SeverityError" xml:space="preserve">
|
||||
<value>错误</value>
|
||||
</data>
|
||||
<data name="A11y_InfoBar" xml:space="preserve">
|
||||
<value>{0}:{1}</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using CommandForge.Desktop.Controls;
|
||||
using CommandForge.Desktop.Resources;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
@@ -72,7 +73,7 @@ public sealed class FluentDialogService : IDialogService
|
||||
_ => (SymbolRegular.Info24, "AccentTextFillColorPrimaryBrush"),
|
||||
};
|
||||
|
||||
var icon = new SymbolIcon(symbol, 24, filled: false)
|
||||
var icon = new DecorativeIcon(symbol, 24)
|
||||
{
|
||||
VerticalAlignment = VerticalAlignment.Top,
|
||||
Margin = new Thickness(0, 0, 12, 0),
|
||||
|
||||
@@ -3,6 +3,17 @@ namespace CommandForge.Desktop.Services;
|
||||
/// <summary>Short, non-blocking notifications (snackbars at the bottom of the main window).</summary>
|
||||
public interface INotificationService
|
||||
{
|
||||
/// <summary>Shows <paramref name="message"/>; safe to call from any thread, a no-op before the main window exists.</summary>
|
||||
public void Show(string message, NotificationKind kind = NotificationKind.Information);
|
||||
/// <summary>
|
||||
/// Shows <paramref name="message"/> and, unless <paramref name="announce"/> is false (because the
|
||||
/// same news was already said), reads it to screen readers. Safe to call from any thread; a no-op
|
||||
/// before the main window exists.
|
||||
/// </summary>
|
||||
public void Show(string message, NotificationKind kind = NotificationKind.Information, bool announce = true);
|
||||
|
||||
/// <summary>
|
||||
/// Reads <paramref name="message"/> to screen readers without showing anything, for a change the
|
||||
/// screen already shows (a run's result, its status). <paramref name="important"/> messages
|
||||
/// interrupt what is being read. Safe to call from any thread.
|
||||
/// </summary>
|
||||
public void Announce(string message, bool important = false);
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using Serilog;
|
||||
|
||||
namespace CommandForge.Desktop.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Says short status messages to screen readers (Narrator, NVDA, JAWS) through a UI Automation
|
||||
/// notification event raised on the active window. WPF does not raise anything for
|
||||
/// <c>AutomationProperties.LiveSetting</c> by itself, so changes that appear on screen (a run's
|
||||
/// result, a search's result count, a snackbar) are announced through here.
|
||||
/// </summary>
|
||||
public static class ScreenReader
|
||||
{
|
||||
// One activity: a newer message replaces one the screen reader has not started to read yet.
|
||||
private const string ActivityId = "CommandForge.Status";
|
||||
|
||||
/// <summary>
|
||||
/// Announces <paramref name="message"/>. <paramref name="important"/> messages (a finished run,
|
||||
/// "restart required") interrupt what is being read; others wait their turn. Safe from any
|
||||
/// thread; a no-op without an application, a window or a listening screen reader.
|
||||
/// </summary>
|
||||
public static void Announce(string? message, bool important = false)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(message) || System.Windows.Application.Current is not { } app)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
app.Dispatcher.InvokeAsync(() => RaiseOnActiveWindow(app.Windows.OfType<Window>(), app.MainWindow, message, important));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When a screen reader listens, raises the notification on the active window of
|
||||
/// <paramref name="windows"/>, else on <paramref name="mainWindow"/>. False when nothing was raised.
|
||||
/// </summary>
|
||||
public static bool RaiseOnActiveWindow(IEnumerable<Window> windows, Window? mainWindow, string message, bool important)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(windows);
|
||||
return AutomationPeer.ListenerExists(AutomationEvents.Notification)
|
||||
&& Raise(windows.FirstOrDefault(w => w.IsActive) ?? mainWindow, message, important);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the notification on <paramref name="window"/>'s automation peer, on its thread. False when
|
||||
/// there is no window or no peer, or UI Automation refused it.
|
||||
/// </summary>
|
||||
public static bool Raise(Window? window, string message, bool important)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(message);
|
||||
if (window is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var peer = UIElementAutomationPeer.FromElement(window) ?? UIElementAutomationPeer.CreatePeerForElement(window);
|
||||
if (peer is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
peer.RaiseNotificationEvent(
|
||||
important ? AutomationNotificationKind.ActionCompleted : AutomationNotificationKind.Other,
|
||||
important ? AutomationNotificationProcessing.ImportantMostRecent : AutomationNotificationProcessing.MostRecent,
|
||||
message,
|
||||
ActivityId);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) when (ex is InvalidOperationException or NotSupportedException)
|
||||
{
|
||||
Log.Debug(ex, "Could not raise a screen-reader notification.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,13 +5,23 @@ using Serilog;
|
||||
|
||||
namespace CommandForge.Desktop.Services;
|
||||
|
||||
/// <summary><see cref="IShellService"/> backed by ShellExecute.</summary>
|
||||
/// <summary>
|
||||
/// <see cref="IShellService"/> backed by ShellExecute — for the project's own web pages and mail
|
||||
/// addresses and the app's own folders only. ShellExecute runs whatever it is handed: a <c>file:</c>
|
||||
/// address or an unknown protocol handler is a program, so anything else is refused.
|
||||
/// </summary>
|
||||
public sealed class ShellService : IShellService
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public bool TryOpen(string target)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(target);
|
||||
if (!IsAllowedTarget(target, Directory.Exists))
|
||||
{
|
||||
Log.Warning("Refused to open {Target}: only https and mailto addresses and existing folders are opened.", target);
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using var process = Process.Start(new ProcessStartInfo(target) { UseShellExecute = true });
|
||||
@@ -39,4 +49,22 @@ public sealed class ShellService : IShellService
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pure: whether <paramref name="target"/> is a web page (<c>https:</c>), a mail address
|
||||
/// (<c>mailto:</c>) or an existing folder given by its full path.
|
||||
/// </summary>
|
||||
public static bool IsAllowedTarget(string target, Func<string, bool> folderExists)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
ArgumentNullException.ThrowIfNull(folderExists);
|
||||
|
||||
// "C:\Users\…" parses as a file: URI too, so a path is checked as a path.
|
||||
if (Uri.TryCreate(target, UriKind.Absolute, out var uri) && !uri.IsFile && !uri.IsUnc)
|
||||
{
|
||||
return uri.Scheme == Uri.UriSchemeHttps || uri.Scheme == Uri.UriSchemeMailto;
|
||||
}
|
||||
|
||||
return Path.IsPathFullyQualified(target) && folderExists(target);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using CommandForge.Desktop.Controls;
|
||||
using Serilog;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Controls;
|
||||
@@ -9,6 +10,9 @@ public sealed class SnackbarNotificationService : INotificationService
|
||||
{
|
||||
private static readonly TimeSpan Duration = TimeSpan.FromSeconds(4);
|
||||
|
||||
// A message that names a file or folder ("Saved to C:\…") needs longer to read than a status.
|
||||
private static readonly TimeSpan LongDuration = TimeSpan.FromSeconds(10);
|
||||
|
||||
private readonly ISnackbarService _snackbars;
|
||||
private bool _presenterReady;
|
||||
|
||||
@@ -27,9 +31,14 @@ public sealed class SnackbarNotificationService : INotificationService
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Show(string message, NotificationKind kind = NotificationKind.Information)
|
||||
public void Show(string message, NotificationKind kind = NotificationKind.Information, bool announce = true)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(message);
|
||||
if (announce)
|
||||
{
|
||||
ScreenReader.Announce(message, important: kind is NotificationKind.Error or NotificationKind.Warning);
|
||||
}
|
||||
|
||||
System.Windows.Application.Current?.Dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
if (!_presenterReady)
|
||||
@@ -46,7 +55,23 @@ public sealed class SnackbarNotificationService : INotificationService
|
||||
_ => (ControlAppearance.Secondary, SymbolRegular.Info24),
|
||||
};
|
||||
|
||||
_snackbars.Show(message, string.Empty, appearance, new SymbolIcon(symbol, 20, filled: false), Duration);
|
||||
_snackbars.Show(message, string.Empty, appearance, new DecorativeIcon(symbol, 20), DurationFor(message));
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Announce(string message, bool important = false)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(message);
|
||||
ScreenReader.Announce(message, important);
|
||||
}
|
||||
|
||||
/// <summary>Pure: how long a snackbar stays, longer when it names a path the user may want to read.</summary>
|
||||
public static TimeSpan DurationFor(string message)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(message);
|
||||
return message.Contains(":\\", StringComparison.Ordinal) || message.Contains("\\\\", StringComparison.Ordinal)
|
||||
? LongDuration
|
||||
: Duration;
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,16 @@
|
||||
<sys:Double x:Key="AppFontSizeSubtitle">20</sys:Double>
|
||||
<sys:Double x:Key="AppFontSizeTitle">28</sys:Double>
|
||||
<sys:Double x:Key="AppFontSizeConsole">12.5</sys:Double>
|
||||
<!-- The navigation pane's open width: FontScaleService widens it when the text is very large. -->
|
||||
<sys:Double x:Key="AppNavigationPaneWidth">290</sys:Double>
|
||||
|
||||
<FontFamily x:Key="ConsoleFontFamily">Cascadia Mono, Consolas, Courier New</FontFamily>
|
||||
|
||||
<!-- How much dimmed text and badge icons fade. ThemeService sets both to 1 under a Windows
|
||||
contrast theme, where blending colors is not allowed. -->
|
||||
<sys:Double x:Key="AppDimOpacity">0.78</sys:Double>
|
||||
<sys:Double x:Key="AppBadgeOpacity">0.75</sys:Double>
|
||||
|
||||
<!-- ===== Text ===== -->
|
||||
|
||||
<Style x:Key="PageTitleTextStyle" TargetType="TextBlock">
|
||||
@@ -52,10 +59,12 @@
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||
</Style>
|
||||
|
||||
<!-- Selectable, read-only monospace text (command lines, paths, environment details). -->
|
||||
<!-- Selectable, read-only monospace text (command lines, paths, environment details). Its bare
|
||||
template has no border, so keyboard focus is drawn with WPF-UI's focus rectangle. -->
|
||||
<Style x:Key="ReadOnlyCodeTextBoxStyle" TargetType="TextBox">
|
||||
<Setter Property="IsReadOnly" Value="True" />
|
||||
<Setter Property="IsReadOnlyCaretVisible" Value="False" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
@@ -113,6 +122,20 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- A console line's frame: an error (stderr) line also gets a bar on its left, so it is not told
|
||||
apart by color alone. -->
|
||||
<Style x:Key="ConsoleLineBorderStyle" TargetType="Border">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsError}" Value="True">
|
||||
<Setter Property="BorderThickness" Value="3,0,0,0" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource SystemFillColorCautionBrush}" />
|
||||
<Setter Property="Padding" Value="6,0,0,0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="ConsoleBorderStyle" TargetType="Border">
|
||||
<Setter Property="Background" Value="{DynamicResource ControlAltFillColorSecondaryBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ControlStrokeColorDefaultBrush}" />
|
||||
@@ -122,19 +145,32 @@
|
||||
|
||||
<!-- ===== Lists ===== -->
|
||||
|
||||
<!-- Row text in command lists: title + one-line description. -->
|
||||
<!-- Row text in command lists: title + one-line description. Cut-off text shows in full as a
|
||||
tooltip (screen readers get the full text anyway). -->
|
||||
<Style x:Key="ListTitleTextStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="{DynamicResource AppFontSize}" />
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
<Setter Property="ToolTip" Value="{Binding Text, RelativeSource={RelativeSource Self}}" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Text" Value="">
|
||||
<Setter Property="ToolTip" Value="{x:Null}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- Dimmed rather than recolored: it keeps the row's own text color, so it stays readable on a
|
||||
selected (accent) row in both themes. -->
|
||||
selected (accent) row in both themes; full strength under a contrast theme. -->
|
||||
<Style x:Key="ListDescriptionTextStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="{DynamicResource AppFontSizeCaption}" />
|
||||
<Setter Property="Opacity" Value="0.78" />
|
||||
<Setter Property="Opacity" Value="{DynamicResource AppDimOpacity}" />
|
||||
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
||||
<Setter Property="ToolTip" Value="{Binding Text, RelativeSource={RelativeSource Self}}" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Text" Value="">
|
||||
<Setter Property="ToolTip" Value="{x:Null}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- Placeholder shown in an empty list. -->
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Windows;
|
||||
using CommandForge.Application.Settings;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace CommandForge.Desktop.Theming;
|
||||
|
||||
@@ -6,33 +8,141 @@ namespace CommandForge.Desktop.Theming;
|
||||
/// <see cref="IFontScaleService"/> that rewrites the app-level font size resources. Text binds to
|
||||
/// them as DynamicResource (<c>AppFontSize</c> and its caption/subtitle/title/console companions),
|
||||
/// and WPF-UI controls read <c>ControlContentThemeFontSize</c>, so the whole UI rescales live.
|
||||
/// The user's Small / Medium / Large choice is multiplied by Windows' own Text size setting
|
||||
/// (<see cref="WindowsTextScale"/>), re-read when Windows reports a preference change or the app
|
||||
/// comes to the foreground.
|
||||
/// </summary>
|
||||
public sealed class FontScaleService : IFontScaleService
|
||||
public sealed class FontScaleService : IFontScaleService, IDisposable
|
||||
{
|
||||
/// <summary>The <see cref="System.Windows.Application.Resources"/> key holding the body font size (a <see cref="double"/>).</summary>
|
||||
public const string ResourceKey = "AppFontSize";
|
||||
|
||||
/// <summary>The resource key of the navigation pane's open width (a <see cref="double"/>).</summary>
|
||||
public const string PaneWidthKey = "AppNavigationPaneWidth";
|
||||
|
||||
private const double PaneWidth = 290;
|
||||
|
||||
private readonly Func<double> _readTextScale;
|
||||
private readonly Func<ResourceDictionary?> _resources;
|
||||
private FontScale _scale = FontScale.Medium;
|
||||
private double _textScale = WindowsTextScale.Minimum;
|
||||
private bool _subscribed;
|
||||
|
||||
/// <summary>Rewrites the application's resources, with Windows' own Text size.</summary>
|
||||
public FontScaleService()
|
||||
: this(WindowsTextScale.Read, static () => System.Windows.Application.Current?.Resources)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rewrites the resources <paramref name="resources"/> returns (none: nothing to do), with the text
|
||||
/// size factor <paramref name="readTextScale"/> returns.
|
||||
/// </summary>
|
||||
public FontScaleService(Func<double> readTextScale, Func<ResourceDictionary?> resources)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(readTextScale);
|
||||
ArgumentNullException.ThrowIfNull(resources);
|
||||
_readTextScale = readTextScale;
|
||||
_resources = resources;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(FontScale scale)
|
||||
{
|
||||
double body = scale switch
|
||||
_scale = scale;
|
||||
_textScale = _readTextScale();
|
||||
Subscribe();
|
||||
ApplyResources();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Re-reads Windows' text size and rescales only when it changed: when Windows reports a
|
||||
/// preference change, and when the app comes back to the foreground.
|
||||
/// </summary>
|
||||
public void Refresh()
|
||||
{
|
||||
var factor = _readTextScale();
|
||||
if (Math.Abs(factor - _textScale) < 0.001)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_textScale = factor;
|
||||
ApplyResources();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose() => Unsubscribe();
|
||||
|
||||
/// <summary>Pure: the body font size for a choice and Windows' text size factor.</summary>
|
||||
public static double BodySize(FontScale scale, double textScale)
|
||||
{
|
||||
double baseSize = scale switch
|
||||
{
|
||||
FontScale.Small => 12d,
|
||||
FontScale.Large => 16d,
|
||||
_ => 14d,
|
||||
};
|
||||
|
||||
if (System.Windows.Application.Current is not { } app)
|
||||
return Math.Round(baseSize * WindowsTextScale.Clamp(textScale), 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pure: the navigation pane's open width for a body font size. Its labels fit the usual width up
|
||||
/// to one and a half times the Medium size; beyond that the pane widens with the text, so "Command
|
||||
/// catalog" and the category names are not cut off at the largest Windows text sizes.
|
||||
/// </summary>
|
||||
public static double NavigationPaneWidth(double bodySize)
|
||||
=> Math.Round(PaneWidth * Math.Max(1d, bodySize / 14d * 2d / 3d));
|
||||
|
||||
private void ApplyResources()
|
||||
{
|
||||
if (_resources() is not { } resources)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var resources = app.Resources;
|
||||
var body = BodySize(_scale, _textScale);
|
||||
resources[ResourceKey] = body;
|
||||
resources["ControlContentThemeFontSize"] = body;
|
||||
resources["AppFontSizeCaption"] = body - 2;
|
||||
resources["AppFontSizeSubtitle"] = Math.Round(body * 10 / 7);
|
||||
resources["AppFontSizeTitle"] = body * 2;
|
||||
resources["AppFontSizeConsole"] = body - 1.5;
|
||||
resources[PaneWidthKey] = NavigationPaneWidth(body);
|
||||
}
|
||||
|
||||
private void Subscribe()
|
||||
{
|
||||
if (_subscribed || System.Windows.Application.Current is not { } app)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SystemEvents.UserPreferenceChanged += OnUserPreferenceChanged;
|
||||
app.Activated += OnAppActivated;
|
||||
_subscribed = true;
|
||||
}
|
||||
|
||||
private void Unsubscribe()
|
||||
{
|
||||
if (!_subscribed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SystemEvents.UserPreferenceChanged -= OnUserPreferenceChanged;
|
||||
if (System.Windows.Application.Current is { } app)
|
||||
{
|
||||
app.Activated -= OnAppActivated;
|
||||
}
|
||||
|
||||
_subscribed = false;
|
||||
}
|
||||
|
||||
// SystemEvents fires off the UI thread; the resources live on it.
|
||||
private void OnUserPreferenceChanged(object sender, UserPreferenceChangedEventArgs e)
|
||||
=> System.Windows.Application.Current?.Dispatcher.InvokeAsync(Refresh);
|
||||
|
||||
private void OnAppActivated(object? sender, EventArgs e) => Refresh();
|
||||
}
|
||||
@@ -34,10 +34,26 @@ public sealed class ThemeService : IThemeService, IDisposable
|
||||
updateAccent: true);
|
||||
}
|
||||
|
||||
if (System.Windows.Application.Current is { } app)
|
||||
{
|
||||
ApplyDimming(app.Resources, SystemParameters.HighContrast);
|
||||
}
|
||||
|
||||
// Keep listening in every mode: High Contrast can be switched on while the app runs.
|
||||
Subscribe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dimmed text (list descriptions) and badge icons blend the colors under them, which a Windows
|
||||
/// contrast theme forbids: there they are drawn at full strength (see AppStyles.xaml).
|
||||
/// </summary>
|
||||
public static void ApplyDimming(ResourceDictionary resources, bool highContrast)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(resources);
|
||||
resources["AppDimOpacity"] = highContrast ? 1d : 0.78d;
|
||||
resources["AppBadgeOpacity"] = highContrast ? 1d : 0.75d;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose() => Unsubscribe();
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.IO;
|
||||
using System.Security;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace CommandForge.Desktop.Theming;
|
||||
|
||||
/// <summary>
|
||||
/// Windows' "Text size" accessibility setting (Settings › Accessibility › Text size, 100–225 %),
|
||||
/// which WPF does not apply by itself. Only read, never changed.
|
||||
/// </summary>
|
||||
public static class WindowsTextScale
|
||||
{
|
||||
/// <summary>Windows' default: no enlargement.</summary>
|
||||
public const double Minimum = 1.0;
|
||||
|
||||
/// <summary>The largest text size Windows offers (225 %).</summary>
|
||||
public const double Maximum = 2.25;
|
||||
|
||||
/// <summary>The current factor, or <see cref="Minimum"/> when the setting is unset or unreadable.</summary>
|
||||
public static double Read()
|
||||
{
|
||||
#if DEBUG
|
||||
// Lets a developer check layouts at large sizes without changing the Windows setting.
|
||||
if (double.TryParse(
|
||||
Environment.GetEnvironmentVariable("COMMANDFORGE_TEXT_SCALE"),
|
||||
System.Globalization.NumberStyles.Float,
|
||||
System.Globalization.CultureInfo.InvariantCulture,
|
||||
out var developerFactor))
|
||||
{
|
||||
return Clamp(developerFactor);
|
||||
}
|
||||
#endif
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Accessibility");
|
||||
return FromRegistryValue(key?.GetValue("TextScaleFactor"));
|
||||
}
|
||||
catch (Exception ex) when (ex is SecurityException or UnauthorizedAccessException or IOException)
|
||||
{
|
||||
return Minimum;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Pure: the stored DWORD percentage (100–225) as a factor, clamped; anything else is 1.0.</summary>
|
||||
public static double FromRegistryValue(object? value) => value is int percent ? Clamp(percent / 100d) : Minimum;
|
||||
|
||||
/// <summary>Pure: keeps a factor within what Windows offers.</summary>
|
||||
public static double Clamp(double factor) => double.IsFinite(factor) ? Math.Clamp(factor, Minimum, Maximum) : Minimum;
|
||||
}
|
||||
@@ -38,12 +38,47 @@ public sealed partial class CommandItemViewModel : ObservableObject
|
||||
|
||||
/// <summary>Whether this command is pinned to Favorites (drives the star icon's filled/outline state).</summary>
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(AccessibleStatus))]
|
||||
private bool _isFavorite;
|
||||
|
||||
/// <summary>
|
||||
/// What a screen reader hears after the title (the row's UI Automation ItemStatus): the risk
|
||||
/// level and the badges a sighted user sees as a colored dot and icons.
|
||||
/// </summary>
|
||||
public string AccessibleStatus => StatusText(DangerLevel, RequiresAdmin, RequiresRestart, IsRevertable, IsFavorite);
|
||||
|
||||
/// <summary>Re-resolves the localized title/description (after a culture change).</summary>
|
||||
public void Refresh()
|
||||
{
|
||||
Title = Strings.Get(Command.TitleKey);
|
||||
Description = Strings.Get(Command.DescriptionKey);
|
||||
OnPropertyChanged(nameof(AccessibleStatus));
|
||||
}
|
||||
|
||||
/// <summary>Pure: "Caution, Requires admin, May require restart, Can be undone, Favorite".</summary>
|
||||
public static string StatusText(DangerLevel level, bool requiresAdmin, bool requiresRestart, bool revertable, bool favorite)
|
||||
{
|
||||
var parts = new List<string>(5) { Strings.Get($"Danger_{level}") };
|
||||
if (requiresAdmin)
|
||||
{
|
||||
parts.Add(Strings.Get("Detail_RequiresAdmin"));
|
||||
}
|
||||
|
||||
if (requiresRestart)
|
||||
{
|
||||
parts.Add(Strings.Get("Detail_MayRestart"));
|
||||
}
|
||||
|
||||
if (revertable)
|
||||
{
|
||||
parts.Add(Strings.Get("A11y_CanUndo"));
|
||||
}
|
||||
|
||||
if (favorite)
|
||||
{
|
||||
parts.Add(Strings.Get("A11y_Favorite"));
|
||||
}
|
||||
|
||||
return string.Join(", ", parts);
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public sealed partial class ExecutionViewModel : ObservableObject
|
||||
private readonly INotificationService _notifications;
|
||||
private readonly ILogger _log = Log.ForContext<ExecutionViewModel>();
|
||||
private CancellationTokenSource? _cancellation;
|
||||
private bool _droppedLinesAnnounced;
|
||||
|
||||
public ExecutionViewModel(
|
||||
RunCommandUseCase run,
|
||||
@@ -318,8 +319,10 @@ public sealed partial class ExecutionViewModel : ObservableObject
|
||||
private CancellationToken Begin()
|
||||
{
|
||||
OutputLines.Clear();
|
||||
_droppedLinesAnnounced = false;
|
||||
HasResult = false;
|
||||
IsRunning = true;
|
||||
_notifications.Announce(string.Format(CultureInfo.CurrentCulture, Strings.Get("A11y_RunStarted"), LastRunTitle));
|
||||
_cancellation = new CancellationTokenSource();
|
||||
return _cancellation.Token;
|
||||
}
|
||||
@@ -340,6 +343,24 @@ public sealed partial class ExecutionViewModel : ObservableObject
|
||||
RequiresRestart = result.RequiresRestart;
|
||||
DurationText = FormatDuration(result.Duration);
|
||||
HasResult = true;
|
||||
|
||||
// The console shows the result; screen readers hear it (WPF raises nothing for it by itself).
|
||||
_notifications.Announce(ResultAnnouncement(LastRunTitle, StatusText, ExitCode, DurationText, RequiresRestart), important: true);
|
||||
}
|
||||
|
||||
/// <summary>Pure: what a screen reader hears when a run ends ("Flush DNS: Succeeded. Exit code 0, 0.4 s.").</summary>
|
||||
public static string ResultAnnouncement(string title, string status, int exitCode, string duration, bool requiresRestart)
|
||||
{
|
||||
var text = string.Format(CultureInfo.CurrentCulture, Strings.Get("A11y_RunResult"), title, status, exitCode, duration);
|
||||
return requiresRestart ? text + " " + Strings.Get("A11y_RestartRequired") : text;
|
||||
}
|
||||
|
||||
partial void OnIsWaitingForElevationChanged(bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_notifications.Announce(Strings.Get("Console_WaitingForAdmin"));
|
||||
}
|
||||
}
|
||||
|
||||
private void LogSummary(CommandDefinition command, ExecutionResult result)
|
||||
@@ -428,6 +449,13 @@ public sealed partial class ExecutionViewModel : ObservableObject
|
||||
{
|
||||
OnPropertyChanged(nameof(HasDroppedLines));
|
||||
OnPropertyChanged(nameof(DroppedLinesText));
|
||||
|
||||
// Once per run: the caption above the console appears silently otherwise.
|
||||
if (HasDroppedLines && !_droppedLinesAnnounced)
|
||||
{
|
||||
_droppedLinesAnnounced = true;
|
||||
_notifications.Announce(DroppedLinesText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -323,8 +323,15 @@ public sealed partial class MainViewModel : ObservableObject
|
||||
{
|
||||
Catalog.SelectCommandById(commandId);
|
||||
CurrentSection = ShellSection.Catalog;
|
||||
CommandOpened?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised after a command was opened in the catalog from elsewhere (Home, History, the palette),
|
||||
/// so the window can move keyboard focus to its row: the control that opened it is gone.
|
||||
/// </summary>
|
||||
public event EventHandler? CommandOpened;
|
||||
|
||||
private void OnSettingsChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(SettingsViewModel.AutoScrollConsole))
|
||||
|
||||
@@ -20,6 +20,9 @@ public sealed partial class ReportBugViewModel : ObservableObject
|
||||
// Browsers and GitHub cap URL length; the body beyond this is left for the user to paste.
|
||||
private const int MaxBodyCharsInUrl = 4000;
|
||||
|
||||
/// <summary>The issue form the report opens (its file name under .github/ISSUE_TEMPLATE).</summary>
|
||||
public const string BugReportForm = "bug_report.yml";
|
||||
|
||||
private readonly ILogMaintenance _maintenance;
|
||||
private readonly IDialogService _dialogs;
|
||||
private readonly IFileDialogService _files;
|
||||
@@ -82,9 +85,42 @@ public sealed partial class ReportBugViewModel : ObservableObject
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenIssue()
|
||||
=> _shell.TryOpen(BuildIssueUrl(
|
||||
BuildTitle(),
|
||||
AppVersion(),
|
||||
$"{RuntimeInformation.OSDescription} ({RuntimeInformation.OSArchitecture})",
|
||||
Description,
|
||||
_errorCode));
|
||||
|
||||
/// <summary>
|
||||
/// Pure: the address of a new issue on the Bug report form (.github/ISSUE_TEMPLATE/bug_report.yml),
|
||||
/// its fields filled in by their ids. GitHub ignores a plain <c>body</c> in a repository with
|
||||
/// issue forms, and shows anyone who isn't a collaborator the list of forms instead.
|
||||
/// </summary>
|
||||
public static string BuildIssueUrl(string title, string appVersion, string windowsVersion, string? userDescription, string? errorCode)
|
||||
{
|
||||
var body = TruncateForUrl(BuildIssueBody(EnvironmentText, Description, _errorCode));
|
||||
_shell.TryOpen($"{ProductLinks.NewIssue}?title={Uri.EscapeDataString(BuildTitle())}&body={Uri.EscapeDataString(body)}");
|
||||
ArgumentNullException.ThrowIfNull(title);
|
||||
ArgumentNullException.ThrowIfNull(appVersion);
|
||||
ArgumentNullException.ThrowIfNull(windowsVersion);
|
||||
(string Field, string Value)[] fields =
|
||||
[
|
||||
("template", BugReportForm),
|
||||
("title", title),
|
||||
("what-happened", TruncateForUrl(BuildWhatHappened(userDescription, errorCode))),
|
||||
("app-version", appVersion),
|
||||
("windows-version", windowsVersion),
|
||||
("logs", "_Attach the exported .zip here. Review its contents first — it may contain command output._"),
|
||||
];
|
||||
return ProductLinks.NewIssue + "?" + string.Join('&', fields.Select(field => field.Field + "=" + Uri.EscapeDataString(field.Value)));
|
||||
}
|
||||
|
||||
/// <summary>Pure: the form's "What happened?" text: the user's words (or a prompt) and a crash's error code.</summary>
|
||||
public static string BuildWhatHappened(string? userDescription, string? errorCode)
|
||||
{
|
||||
var text = string.IsNullOrWhiteSpace(userDescription) ? "_Describe what happened._" : userDescription.Trim();
|
||||
return string.IsNullOrWhiteSpace(errorCode)
|
||||
? text
|
||||
: text + Environment.NewLine + Environment.NewLine + "Error code: " + errorCode;
|
||||
}
|
||||
|
||||
/// <summary>Pure: keeps a prefilled issue body within URL limits (a full stack trace can exceed them).</summary>
|
||||
@@ -109,29 +145,6 @@ public sealed partial class ReportBugViewModel : ObservableObject
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Pure: assembles the GitHub issue body template (testable).</summary>
|
||||
public static string BuildIssueBody(string environment, string? userDescription, string? errorCode = null)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
builder.AppendLine("## Description");
|
||||
builder.AppendLine(string.IsNullOrWhiteSpace(userDescription) ? "_Describe what happened._" : userDescription);
|
||||
builder.AppendLine();
|
||||
if (!string.IsNullOrWhiteSpace(errorCode))
|
||||
{
|
||||
builder.AppendLine($"Error code: {errorCode}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
builder.AppendLine("## Environment");
|
||||
builder.AppendLine("```");
|
||||
builder.Append(environment);
|
||||
builder.AppendLine("```");
|
||||
builder.AppendLine();
|
||||
builder.AppendLine("## Logs");
|
||||
builder.AppendLine("_Attach the exported .zip here. Review its contents first — it may contain command output._");
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private string BuildTitle() => _errorCode is null ? "[Bug] " : $"[Crash {_errorCode}] ";
|
||||
|
||||
private static string AppVersion()
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:app="clr-namespace:CommandForge.Application;assembly=CommandForge.Application">
|
||||
<!-- Shown in an in-window dialog: name, version, privacy note, links, contact addresses. -->
|
||||
<StackPanel MinWidth="380" MaxWidth="520">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="WindowConsole20" FontSize="32" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
|
||||
<ctl:DecorativeIcon Symbol="WindowConsole20" FontSize="32" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,0" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="{res:Loc AppTitle}" Style="{StaticResource SubtitleTextStyle}" />
|
||||
@@ -22,6 +23,7 @@
|
||||
<ui:HyperlinkButton Content="{res:Loc Settings_GitHub}" Click="OnGitHubClick" Margin="0,0,8,4" />
|
||||
<ui:HyperlinkButton Content="{res:Loc Menu_UserGuide}" Click="OnUserGuideClick" Margin="0,0,8,4" />
|
||||
<ui:HyperlinkButton Content="{res:Loc Menu_Terms}" Click="OnTermsClick" Margin="0,0,8,4" />
|
||||
<ui:HyperlinkButton Content="{res:Loc About_Accessibility}" Click="OnAccessibilityClick" Margin="0,0,8,4" />
|
||||
</WrapPanel>
|
||||
|
||||
<TextBlock Text="{res:Loc About_Contact}" Style="{StaticResource BodyStrongTextStyle}" Margin="0,12,0,4" />
|
||||
@@ -33,15 +35,20 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{res:Loc About_SecurityContact}" Style="{StaticResource SecondaryTextStyle}"
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="{res:Loc About_SecurityContact}" Style="{StaticResource SecondaryTextStyle}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,0" />
|
||||
<ui:HyperlinkButton Grid.Column="1" Content="{x:Static app:ProductLinks.SecurityEmail}" Click="OnSecurityEmailClick"
|
||||
<ui:HyperlinkButton Grid.Row="0" Grid.Column="1" Content="{x:Static app:ProductLinks.SecurityEmail}" Click="OnSecurityEmailClick"
|
||||
HorizontalAlignment="Left" AutomationProperties.HelpText="{res:Loc About_SecurityContact}" />
|
||||
<TextBlock Grid.Row="1" Text="{res:Loc About_CodeContact}" Style="{StaticResource SecondaryTextStyle}"
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="{res:Loc About_CodeContact}" Style="{StaticResource SecondaryTextStyle}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,0" />
|
||||
<ui:HyperlinkButton Grid.Row="1" Grid.Column="1" Content="{x:Static app:ProductLinks.CodeEmail}" Click="OnCodeEmailClick"
|
||||
HorizontalAlignment="Left" AutomationProperties.HelpText="{res:Loc About_CodeContact}" />
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="{res:Loc About_AccessibilityContact}" Style="{StaticResource SecondaryTextStyle}"
|
||||
VerticalAlignment="Center" Margin="0,0,12,0" />
|
||||
<ui:HyperlinkButton Grid.Row="2" Grid.Column="1" Content="{x:Static app:ProductLinks.AccessibilityEmail}" Click="OnAccessibilityEmailClick"
|
||||
HorizontalAlignment="Left" AutomationProperties.HelpText="{res:Loc About_AccessibilityContact}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -34,7 +34,11 @@ public partial class AboutView : UserControl
|
||||
|
||||
private void OnTermsClick(object sender, RoutedEventArgs e) => _showTerms();
|
||||
|
||||
private void OnAccessibilityClick(object sender, RoutedEventArgs e) => _shell.TryOpen(ProductLinks.AccessibilityStatement);
|
||||
|
||||
private void OnSecurityEmailClick(object sender, RoutedEventArgs e) => _shell.TryOpen("mailto:" + ProductLinks.SecurityEmail);
|
||||
|
||||
private void OnCodeEmailClick(object sender, RoutedEventArgs e) => _shell.TryOpen("mailto:" + ProductLinks.CodeEmail);
|
||||
|
||||
private void OnAccessibilityEmailClick(object sender, RoutedEventArgs e) => _shell.TryOpen("mailto:" + ProductLinks.AccessibilityEmail);
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
xmlns:beh="clr-namespace:CommandForge.Desktop.Behaviors"
|
||||
@@ -12,6 +13,28 @@
|
||||
<conv:DangerLevelToTextConverter x:Key="DangerText" />
|
||||
<conv:MultiBoolToVisibilityConverter x:Key="MultiBoolVis" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
<conv:RowActionNameConverter x:Key="RowActionFavoriteAdd" LabelKey="Favorite_Add" />
|
||||
<conv:RowActionNameConverter x:Key="RowActionFavoriteRemove" LabelKey="Favorite_Remove" />
|
||||
|
||||
<!-- A star that pins a command: named after what pressing it does now, and the command. -->
|
||||
<Style x:Key="RowFavoriteButtonStyle" TargetType="ui:Button" BasedOn="{StaticResource IconButtonStyle}">
|
||||
<Setter Property="ToolTip" Value="{res:Loc Favorite_Add}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title, Converter={StaticResource RowActionFavoriteAdd}}" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsFavorite}" Value="True">
|
||||
<Setter Property="ToolTip" Value="{res:Loc Favorite_Remove}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title, Converter={StaticResource RowActionFavoriteRemove}}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<!-- A splitter that Tab reaches and the arrow keys move. -->
|
||||
<Style x:Key="KeyboardSplitterStyle" TargetType="GridSplitter">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Focusable" Value="True" />
|
||||
<Setter Property="IsTabStop" Value="True" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
</Style>
|
||||
|
||||
<!-- A risk-filter chip: a toggle with the level's dot and name. -->
|
||||
<Style x:Key="FilterChipStyle" TargetType="ToggleButton" BasedOn="{StaticResource {x:Type ToggleButton}}">
|
||||
@@ -31,19 +54,22 @@
|
||||
<!-- Heading: what is being browsed -->
|
||||
<TextBlock Grid.Row="0" Text="{Binding PageTitle}" Style="{StaticResource PageTitleTextStyle}" Margin="0,0,0,12" />
|
||||
|
||||
<!-- Search + risk filters -->
|
||||
<!-- Search + risk filters. The filters share the row, so they wrap onto a second line when the
|
||||
text is large instead of running off the edge. -->
|
||||
<Grid Grid.Row="1" Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="220" MaxWidth="560" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBox Grid.Column="0" x:Name="SearchBox"
|
||||
<ui:TextBox Grid.Column="0" x:Name="SearchBox" VerticalAlignment="Top"
|
||||
PlaceholderText="{res:Loc Search_Placeholder}"
|
||||
ClearButtonEnabled="True"
|
||||
AutomationProperties.Name="{res:Loc Search_Placeholder}"
|
||||
AutomationProperties.AcceleratorKey="Ctrl+F"
|
||||
beh:ShortcutScope.AllowExit="True"
|
||||
Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}">
|
||||
<ui:TextBox.Icon>
|
||||
<ui:SymbolIcon Symbol="Search24" />
|
||||
<ctl:DecorativeIcon Symbol="Search24" />
|
||||
</ui:TextBox.Icon>
|
||||
</ui:TextBox>
|
||||
|
||||
@@ -72,7 +98,7 @@
|
||||
<ToggleButton Style="{StaticResource FilterChipStyle}" IsChecked="{Binding AdminOnly}"
|
||||
AutomationProperties.Name="{res:Loc Filter_AdminOnly}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="Shield24" FontSize="14" Margin="0,0,6,0" />
|
||||
<ctl:DecorativeIcon Symbol="Shield24" FontSize="14" Margin="0,0,6,0" />
|
||||
<TextBlock Text="{res:Loc Filter_AdminOnly}" />
|
||||
</StackPanel>
|
||||
</ToggleButton>
|
||||
@@ -87,6 +113,16 @@
|
||||
<ui:Button.Style>
|
||||
<Style TargetType="ui:Button" BasedOn="{StaticResource {x:Type ui:Button}}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<!-- Read as it reads: "Did you mean: dns" -->
|
||||
<Setter Property="AutomationProperties.Name">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{conv:FormatConverter}">
|
||||
<Binding Source="{x:Static res:LocalizationManager.Instance}" Path="[A11y_LabelValue]" />
|
||||
<Binding Source="{x:Static res:LocalizationManager.Instance}" Path="[Search_Suggestion]" />
|
||||
<Binding Path="SearchSuggestion" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SearchSuggestion}" Value="{x:Null}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
@@ -95,7 +131,7 @@
|
||||
</Style>
|
||||
</ui:Button.Style>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="Lightbulb24" Margin="0,0,6,0" />
|
||||
<ctl:DecorativeIcon Symbol="Lightbulb24" Margin="0,0,6,0" />
|
||||
<TextBlock Text="{res:Loc Search_Suggestion}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding SearchSuggestion}" FontWeight="SemiBold" Margin="4,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
@@ -123,6 +159,10 @@
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="AutomationProperties.HelpText" Value="{Binding Description}" />
|
||||
<!-- Risk and badges, which sighted users read from the dot and icons. -->
|
||||
<Setter Property="AutomationProperties.ItemStatus" Value="{Binding AccessibleStatus}" />
|
||||
<!-- Arrow keys move between rows; Tab moves into the selected row's star. -->
|
||||
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
@@ -133,7 +173,7 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:SymbolIcon Grid.Column="0" Symbol="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
<ctl:DecorativeIcon Grid.Column="0" Symbol="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
FontSize="20" VerticalAlignment="Center" Margin="2,0,12,0" />
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource ListTitleTextStyle}"
|
||||
@@ -142,37 +182,36 @@
|
||||
<TextBlock Text="{Binding Description}" Style="{StaticResource ListDescriptionTextStyle}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center" Margin="8,0,0,0">
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" Margin="0,0,2,0"
|
||||
<ui:Button Style="{StaticResource RowFavoriteButtonStyle}" Margin="0,0,2,0"
|
||||
Command="{Binding DataContext.ToggleFavoriteCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip="{res:Loc Favorite_Toggle}" AutomationProperties.Name="{res:Loc Favorite_Toggle}">
|
||||
CommandParameter="{Binding}">
|
||||
<!-- Filled = pinned; the row's own color keeps it visible on a selected row. -->
|
||||
<ui:SymbolIcon Symbol="Star24" FontSize="16" Filled="{Binding IsFavorite}" />
|
||||
<ctl:DecorativeIcon Symbol="Star24" FontSize="16" Filled="{Binding IsFavorite}" />
|
||||
</ui:Button>
|
||||
<ui:SymbolIcon Symbol="Shield24" FontSize="15" Margin="3,0"
|
||||
Opacity="0.75"
|
||||
<ctl:DecorativeIcon Symbol="Shield24" FontSize="15" Margin="3,0"
|
||||
Opacity="{DynamicResource AppBadgeOpacity}"
|
||||
ToolTip="{res:Loc Detail_RequiresAdmin}">
|
||||
<ui:SymbolIcon.Visibility>
|
||||
<ctl:DecorativeIcon.Visibility>
|
||||
<MultiBinding Converter="{StaticResource MultiBoolVis}">
|
||||
<Binding Path="RequiresAdmin" />
|
||||
<Binding Path="DataContext.Settings.ShowAdminRestartBadges"
|
||||
RelativeSource="{RelativeSource AncestorType=UserControl}" />
|
||||
</MultiBinding>
|
||||
</ui:SymbolIcon.Visibility>
|
||||
</ui:SymbolIcon>
|
||||
<ui:SymbolIcon Symbol="ArrowClockwise24" FontSize="15" Margin="3,0"
|
||||
Opacity="0.75"
|
||||
</ctl:DecorativeIcon.Visibility>
|
||||
</ctl:DecorativeIcon>
|
||||
<ctl:DecorativeIcon Symbol="ArrowClockwise24" FontSize="15" Margin="3,0"
|
||||
Opacity="{DynamicResource AppBadgeOpacity}"
|
||||
ToolTip="{res:Loc Detail_MayRestart}">
|
||||
<ui:SymbolIcon.Visibility>
|
||||
<ctl:DecorativeIcon.Visibility>
|
||||
<MultiBinding Converter="{StaticResource MultiBoolVis}">
|
||||
<Binding Path="RequiresRestart" />
|
||||
<Binding Path="DataContext.Settings.ShowAdminRestartBadges"
|
||||
RelativeSource="{RelativeSource AncestorType=UserControl}" />
|
||||
</MultiBinding>
|
||||
</ui:SymbolIcon.Visibility>
|
||||
</ui:SymbolIcon>
|
||||
<ui:SymbolIcon Symbol="ArrowUndo24" FontSize="15" Margin="3,0"
|
||||
Opacity="0.75"
|
||||
</ctl:DecorativeIcon.Visibility>
|
||||
</ctl:DecorativeIcon>
|
||||
<ctl:DecorativeIcon Symbol="ArrowUndo24" FontSize="15" Margin="3,0"
|
||||
Opacity="{DynamicResource AppBadgeOpacity}"
|
||||
ToolTip="{res:Loc Detail_Revert}"
|
||||
Visibility="{Binding IsRevertable, Converter={StaticResource BoolToVis}}" />
|
||||
<Ellipse Style="{StaticResource DangerDotStyle}" Margin="6,0,2,0"
|
||||
@@ -195,7 +234,8 @@
|
||||
</Grid>
|
||||
|
||||
<GridSplitter Grid.Column="1" Width="6" Margin="6,0" HorizontalAlignment="Center" VerticalAlignment="Stretch"
|
||||
Background="Transparent" Focusable="False" />
|
||||
Style="{StaticResource KeyboardSplitterStyle}"
|
||||
AutomationProperties.Name="{res:Loc A11y_SplitterList}" />
|
||||
|
||||
<!-- Detail (top) + console (bottom), split evenly once something ran; the splitter resizes them. -->
|
||||
<Grid Grid.Column="2">
|
||||
@@ -207,50 +247,50 @@
|
||||
|
||||
<ui:Card Grid.Row="0" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" Padding="20,16">
|
||||
<Grid>
|
||||
<ScrollViewer DataContext="{Binding Detail}" VerticalScrollBarVisibility="Auto"
|
||||
<ScrollViewer DataContext="{Binding Detail}" VerticalScrollBarVisibility="Auto" Focusable="False"
|
||||
Visibility="{Binding DataContext.Detail, RelativeSource={RelativeSource AncestorType=UserControl}, Converter={conv:NullToVisibilityConverter}}">
|
||||
<StackPanel>
|
||||
<DockPanel>
|
||||
<ui:Button DockPanel.Dock="Right" Style="{StaticResource IconButtonStyle}" VerticalAlignment="Top"
|
||||
<ui:Button DockPanel.Dock="Right" Style="{StaticResource RowFavoriteButtonStyle}" VerticalAlignment="Top"
|
||||
DataContext="{Binding DataContext.SelectedCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Command="{Binding DataContext.ToggleFavoriteCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding DataContext.SelectedCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
ToolTip="{res:Loc Favorite_Toggle}" AutomationProperties.Name="{res:Loc Favorite_Toggle}">
|
||||
<ui:SymbolIcon Symbol="Star24" FontSize="20"
|
||||
Filled="{Binding DataContext.SelectedCommand.IsFavorite, RelativeSource={RelativeSource AncestorType=UserControl}}" />
|
||||
CommandParameter="{Binding}">
|
||||
<ctl:DecorativeIcon Symbol="Star24" FontSize="20" Filled="{Binding IsFavorite}" />
|
||||
</ui:Button>
|
||||
<TextBlock Text="{Binding Title}" Style="{StaticResource SubtitleTextStyle}" Margin="0,0,8,0" />
|
||||
</DockPanel>
|
||||
|
||||
<WrapPanel Margin="0,8,0,0">
|
||||
<views:DangerBadge Level="{Binding DangerLevel}" Margin="0,0,8,4" />
|
||||
<!-- A badge's text wraps inside it when it is wider than the pane (large text sizes). -->
|
||||
<Border CornerRadius="4" Padding="8,3" Margin="0,0,8,4" BorderThickness="1"
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}">
|
||||
<TextBlock Text="{Binding CategoryTitle}" FontSize="{DynamicResource AppFontSizeCaption}" />
|
||||
<TextBlock Text="{Binding CategoryTitle}" FontSize="{DynamicResource AppFontSizeCaption}" TextWrapping="Wrap" />
|
||||
</Border>
|
||||
<Border CornerRadius="4" Padding="8,3" Margin="0,0,8,4" BorderThickness="1"
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
||||
Visibility="{Binding RequiresAdmin, Converter={StaticResource BoolToVis}}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="Shield24" FontSize="13" Margin="0,0,5,0" />
|
||||
<TextBlock Text="{res:Loc Detail_RequiresAdmin}" FontSize="{DynamicResource AppFontSizeCaption}" />
|
||||
</StackPanel>
|
||||
<DockPanel>
|
||||
<ctl:DecorativeIcon DockPanel.Dock="Left" Symbol="Shield24" FontSize="13" Margin="0,0,5,0" />
|
||||
<TextBlock Text="{res:Loc Detail_RequiresAdmin}" FontSize="{DynamicResource AppFontSizeCaption}" TextWrapping="Wrap" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Border CornerRadius="4" Padding="8,3" Margin="0,0,8,4" BorderThickness="1"
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
||||
Visibility="{Binding RequiresRestart, Converter={StaticResource BoolToVis}}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="ArrowClockwise24" FontSize="13" Margin="0,0,5,0" />
|
||||
<TextBlock Text="{res:Loc Detail_MayRestart}" FontSize="{DynamicResource AppFontSizeCaption}" />
|
||||
</StackPanel>
|
||||
<DockPanel>
|
||||
<ctl:DecorativeIcon DockPanel.Dock="Left" Symbol="ArrowClockwise24" FontSize="13" Margin="0,0,5,0" />
|
||||
<TextBlock Text="{res:Loc Detail_MayRestart}" FontSize="{DynamicResource AppFontSizeCaption}" TextWrapping="Wrap" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Border CornerRadius="4" Padding="8,3" Margin="0,0,8,4" BorderThickness="1"
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="Timer24" FontSize="13" Margin="0,0,5,0" />
|
||||
<TextBlock FontSize="{DynamicResource AppFontSizeCaption}">
|
||||
<DockPanel>
|
||||
<ctl:DecorativeIcon DockPanel.Dock="Left" Symbol="Timer24" FontSize="13" Margin="0,0,5,0" />
|
||||
<TextBlock FontSize="{DynamicResource AppFontSizeCaption}" TextWrapping="Wrap">
|
||||
<Run Text="{res:Loc Detail_Duration}" /><Run Text=": " /><Run Text="{Binding EstimatedDurationText, Mode=OneWay}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
|
||||
@@ -263,28 +303,28 @@
|
||||
</Border>
|
||||
|
||||
<WrapPanel Margin="0,16,0,0">
|
||||
<ui:Button Appearance="Primary" Margin="0,0,8,8" Content="{res:Loc Detail_Run}"
|
||||
<ui:Button x:Name="RunButton" Appearance="Primary" Margin="0,0,8,8" Content="{res:Loc Detail_Run}"
|
||||
Command="{Binding DataContext.RunSelectedCommand, RelativeSource={RelativeSource AncestorType=UserControl}}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Play24" />
|
||||
<ctl:DecorativeIcon Symbol="Play24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<ui:Button Margin="0,0,8,8" Content="{res:Loc Detail_Revert}"
|
||||
Command="{Binding DataContext.RevertSelectedCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
Visibility="{Binding HasRevert, Converter={StaticResource BoolToVis}}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="ArrowUndo24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowUndo24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<ui:Button Margin="0,0,8,8" Content="{res:Loc Detail_Copy}" Command="{Binding CopyCommand}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Copy24" />
|
||||
<ctl:DecorativeIcon Symbol="Copy24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<ui:Button Margin="0,0,8,8" Content="{res:Loc Detail_Doc}" Command="{Binding OpenDocCommand}"
|
||||
Visibility="{Binding HasDoc, Converter={StaticResource BoolToVis}}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="BookOpen24" />
|
||||
<ctl:DecorativeIcon Symbol="BookOpen24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
</WrapPanel>
|
||||
@@ -297,8 +337,9 @@
|
||||
</ui:Card>
|
||||
|
||||
<GridSplitter Grid.Row="1" Height="12" HorizontalAlignment="Stretch" VerticalAlignment="Center"
|
||||
ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" Background="Transparent"
|
||||
Focusable="False"
|
||||
ResizeDirection="Rows" ResizeBehavior="PreviousAndNext"
|
||||
Style="{StaticResource KeyboardSplitterStyle}"
|
||||
AutomationProperties.Name="{res:Loc A11y_SplitterConsole}"
|
||||
Visibility="{Binding Execution.ShowConsole, Converter={StaticResource BoolToVis}}" />
|
||||
|
||||
<views:ConsoleView Grid.Row="2" DataContext="{Binding Execution}" MinHeight="140"
|
||||
|
||||
@@ -1,11 +1,31 @@
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using CommandForge.Desktop.Resources;
|
||||
using CommandForge.Desktop.Services;
|
||||
using CommandForge.Desktop.ViewModels;
|
||||
|
||||
namespace CommandForge.Desktop.Views;
|
||||
|
||||
/// <summary>The catalog browse/run page: search and risk filters, command list, detail and console.</summary>
|
||||
public partial class CatalogView : UserControl
|
||||
{
|
||||
public CatalogView() => InitializeComponent();
|
||||
// Long enough that typing a word announces once, at the end.
|
||||
private static readonly TimeSpan ResultCountDelay = TimeSpan.FromMilliseconds(800);
|
||||
|
||||
private readonly DispatcherTimer _resultCountTimer;
|
||||
private CatalogViewModel? _viewModel;
|
||||
|
||||
public CatalogView()
|
||||
{
|
||||
InitializeComponent();
|
||||
_resultCountTimer = new DispatcherTimer(DispatcherPriority.Background) { Interval = ResultCountDelay };
|
||||
_resultCountTimer.Tick += OnResultCountTick;
|
||||
DataContextChanged += (_, _) => Attach(DataContext as CatalogViewModel);
|
||||
CommandList.KeyDown += OnCommandListKeyDown;
|
||||
}
|
||||
|
||||
/// <summary>Puts the cursor in the search box (Ctrl+F, or after navigating here from the search box).</summary>
|
||||
public void FocusSearch()
|
||||
@@ -13,4 +33,83 @@ public partial class CatalogView : UserControl
|
||||
SearchBox.Focus();
|
||||
SearchBox.SelectAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves keyboard focus to the selected command's row, so that after opening a command from Home,
|
||||
/// History or the palette a screen reader reads it and the arrow keys continue from there.
|
||||
/// </summary>
|
||||
public void FocusSelectedCommand()
|
||||
{
|
||||
if (CommandList.SelectedItem is not { } item)
|
||||
{
|
||||
FocusSearch();
|
||||
return;
|
||||
}
|
||||
|
||||
CommandList.ScrollIntoView(item);
|
||||
CommandList.UpdateLayout();
|
||||
if (CommandList.ItemContainerGenerator.ContainerFromItem(item) is ListBoxItem row)
|
||||
{
|
||||
row.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Enter on a command row opens it: the keyboard moves to its Run button in the detail pane.</summary>
|
||||
private void OnCommandListKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Handled || e.Key != Key.Enter || Keyboard.Modifiers != ModifierKeys.None || e.OriginalSource is not ListBoxItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RunButton.IsVisible && RunButton.Focus())
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Pure: what a screen reader hears after a search or a filter change.</summary>
|
||||
public static string ResultCountText(int count) => count switch
|
||||
{
|
||||
0 => Strings.Get("NoSearchResults"),
|
||||
1 => Strings.Get("A11y_ResultCountOne"),
|
||||
_ => string.Format(CultureInfo.CurrentCulture, Strings.Get("A11y_ResultCount"), count),
|
||||
};
|
||||
|
||||
private void Attach(CatalogViewModel? viewModel)
|
||||
{
|
||||
if (_viewModel is not null)
|
||||
{
|
||||
_viewModel.PropertyChanged -= OnViewModelPropertyChanged;
|
||||
}
|
||||
|
||||
_viewModel = viewModel;
|
||||
if (_viewModel is not null)
|
||||
{
|
||||
_viewModel.PropertyChanged += OnViewModelPropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
// The list is already refiltered when these change; announce once typing pauses.
|
||||
if (e.PropertyName is nameof(CatalogViewModel.SearchText)
|
||||
or nameof(CatalogViewModel.ShowSafe)
|
||||
or nameof(CatalogViewModel.ShowCaution)
|
||||
or nameof(CatalogViewModel.ShowDangerous)
|
||||
or nameof(CatalogViewModel.AdminOnly))
|
||||
{
|
||||
_resultCountTimer.Stop();
|
||||
_resultCountTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnResultCountTick(object? sender, EventArgs e)
|
||||
{
|
||||
_resultCountTimer.Stop();
|
||||
if (IsVisible && _viewModel is not null)
|
||||
{
|
||||
ScreenReader.Announce(ResultCountText(_viewModel.FilteredCommands.Count));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
xmlns:beh="clr-namespace:CommandForge.Desktop.Behaviors"
|
||||
@@ -27,7 +28,7 @@
|
||||
FontSize="{DynamicResource AppFontSizeSubtitle}"
|
||||
AutomationProperties.Name="{res:Loc Palette_Placeholder}">
|
||||
<ui:TextBox.Icon>
|
||||
<ui:SymbolIcon Symbol="Search24" />
|
||||
<ctl:DecorativeIcon Symbol="Search24" />
|
||||
</ui:TextBox.Icon>
|
||||
</ui:TextBox>
|
||||
|
||||
@@ -44,6 +45,7 @@
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="AutomationProperties.ItemStatus" Value="{Binding AccessibleStatus}" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
@@ -54,7 +56,7 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:SymbolIcon Grid.Column="0" Symbol="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
<ctl:DecorativeIcon Grid.Column="0" Symbol="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
FontSize="18" VerticalAlignment="Center" Margin="2,0,12,0" />
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource ListTitleTextStyle}"
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using CommandForge.Desktop.Resources;
|
||||
using CommandForge.Desktop.Services;
|
||||
using CommandForge.Desktop.ViewModels;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace CommandForge.Desktop.Views;
|
||||
|
||||
/// <summary>Command Palette overlay (Ctrl+K). Returns the chosen command id via <see cref="ChosenCommandId"/>.</summary>
|
||||
/// <summary>
|
||||
/// Command Palette overlay (Ctrl+K). Returns the chosen command id via <see cref="ChosenCommandId"/>.
|
||||
/// The cursor stays in the search box while the arrow keys move the highlight, so screen readers are
|
||||
/// told the highlighted command and the result count (they would hear nothing otherwise).
|
||||
/// </summary>
|
||||
public partial class CommandPaletteWindow : FluentWindow
|
||||
{
|
||||
private static readonly TimeSpan ResultCountDelay = TimeSpan.FromMilliseconds(700);
|
||||
|
||||
private readonly CommandPaletteViewModel _viewModel;
|
||||
private readonly DispatcherTimer _resultCountTimer;
|
||||
private bool _closing;
|
||||
|
||||
public CommandPaletteWindow(CommandPaletteViewModel viewModel)
|
||||
@@ -16,6 +28,9 @@ public partial class CommandPaletteWindow : FluentWindow
|
||||
_viewModel = viewModel;
|
||||
DataContext = viewModel;
|
||||
viewModel.CommandChosen += OnCommandChosen;
|
||||
_resultCountTimer = new DispatcherTimer(DispatcherPriority.Background) { Interval = ResultCountDelay };
|
||||
_resultCountTimer.Tick += OnResultCountTick;
|
||||
viewModel.PropertyChanged += OnViewModelPropertyChanged;
|
||||
Loaded += (_, _) => SearchBox.Focus();
|
||||
// Close on focus loss — but guard against re-entrancy: Close() itself deactivates the window,
|
||||
// which would re-enter here and throw "Cannot ... while a Window is closing".
|
||||
@@ -79,7 +94,31 @@ public partial class CommandPaletteWindow : FluentWindow
|
||||
|
||||
var current = _viewModel.SelectedResult is null ? -1 : _viewModel.Results.IndexOf(_viewModel.SelectedResult);
|
||||
var next = Math.Clamp(current + delta, 0, count - 1);
|
||||
_viewModel.SelectedResult = _viewModel.Results[next];
|
||||
ResultsList.ScrollIntoView(_viewModel.SelectedResult);
|
||||
var item = _viewModel.Results[next];
|
||||
_viewModel.SelectedResult = item;
|
||||
ResultsList.ScrollIntoView(item);
|
||||
ScreenReader.Announce(HighlightText(item.Title, item.AccessibleStatus, next + 1, count));
|
||||
}
|
||||
|
||||
/// <summary>Pure: "Flush DNS cache, Safe, 2 of 14" — what a screen reader hears for the highlighted result.</summary>
|
||||
public static string HighlightText(string title, string status, int position, int count)
|
||||
=> string.Format(CultureInfo.CurrentCulture, Strings.Get("A11y_PaletteItem"), title, status, position, count);
|
||||
|
||||
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(CommandPaletteViewModel.SearchText))
|
||||
{
|
||||
_resultCountTimer.Stop();
|
||||
_resultCountTimer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnResultCountTick(object? sender, EventArgs e)
|
||||
{
|
||||
_resultCountTimer.Stop();
|
||||
if (!_closing)
|
||||
{
|
||||
ScreenReader.Announce(CatalogView.ResultCountText(_viewModel.Results.Count));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
xmlns:views="clr-namespace:CommandForge.Desktop.Views"
|
||||
Title="{Binding Title}"
|
||||
PrimaryButtonText="{res:Loc Detail_Run}"
|
||||
@@ -28,10 +29,18 @@
|
||||
|
||||
<StackPanel Margin="0,0,0,12" Visibility="{Binding IsDangerous, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock Text="{res:Loc Confirm_TypeToConfirm}" TextWrapping="Wrap" Margin="0,0,0,6" />
|
||||
<!-- The ID is also the box's help text: a placeholder is not read by screen readers. -->
|
||||
<ui:TextBox x:Name="ConfirmationInputBox"
|
||||
Text="{Binding ConfirmationInput, UpdateSourceTrigger=PropertyChanged}"
|
||||
PlaceholderText="{Binding CommandId}"
|
||||
AutomationProperties.Name="{res:Loc Confirm_TypeToConfirm}" />
|
||||
AutomationProperties.Name="{res:Loc Confirm_TypeToConfirm}">
|
||||
<AutomationProperties.HelpText>
|
||||
<MultiBinding Converter="{conv:FormatConverter}">
|
||||
<Binding Source="{x:Static res:LocalizationManager.Instance}" Path="[A11y_CommandId]" />
|
||||
<Binding Path="CommandId" />
|
||||
</MultiBinding>
|
||||
</AutomationProperties.HelpText>
|
||||
</ui:TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox IsChecked="{Binding CreateRestorePoint}"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using CommandForge.Desktop.ViewModels;
|
||||
using Wpf.Ui.Controls;
|
||||
@@ -20,11 +21,19 @@ public partial class ConfirmationDialog : ContentDialog
|
||||
DataContext = viewModel;
|
||||
PrimaryButtonAppearance = viewModel.IsDangerous ? ControlAppearance.Danger : ControlAppearance.Primary;
|
||||
|
||||
// For Dangerous commands start in the type-to-confirm box; otherwise focus stays on Cancel.
|
||||
if (viewModel.IsDangerous)
|
||||
// For Dangerous commands start in the type-to-confirm box; otherwise on Cancel. WPF-UI would
|
||||
// otherwise focus the first focusable control in the content: the command-line box.
|
||||
Opened += (_, _) =>
|
||||
{
|
||||
Opened += (_, _) => Keyboard.Focus(ConfirmationInputBox);
|
||||
}
|
||||
if (viewModel.IsDangerous)
|
||||
{
|
||||
Keyboard.Focus(ConfirmationInputBox);
|
||||
}
|
||||
else if (GetTemplateChild("CloseButton") is IInputElement cancel)
|
||||
{
|
||||
Keyboard.Focus(cancel);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnButtonClick(ContentDialogButton button)
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
xmlns:beh="clr-namespace:CommandForge.Desktop.Behaviors">
|
||||
<!-- The shared console (DataContext: ExecutionViewModel): virtualized output, status, result, actions. -->
|
||||
<!-- The shared console (DataContext: ExecutionViewModel): virtualized output, status, result, actions.
|
||||
Screen readers hear the run's start, wait and result from ExecutionViewModel (WPF raises nothing
|
||||
for a LiveSetting by itself). -->
|
||||
<UserControl.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
</UserControl.Resources>
|
||||
@@ -24,8 +28,9 @@
|
||||
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="12,0" VerticalAlignment="Center"
|
||||
Visibility="{Binding IsRunning, Converter={StaticResource BoolToVis}}">
|
||||
<ProgressBar IsIndeterminate="True" Width="72" VerticalAlignment="Center" Margin="0,0,10,0" />
|
||||
<TextBlock VerticalAlignment="Center" AutomationProperties.LiveSetting="Polite">
|
||||
<ProgressBar IsIndeterminate="True" Width="72" VerticalAlignment="Center" Margin="0,0,10,0"
|
||||
AutomationProperties.Name="{res:Loc Console_Running}" />
|
||||
<TextBlock VerticalAlignment="Center">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource CaptionTextStyle}">
|
||||
<Setter Property="Text" Value="{res:Loc Console_Running}" />
|
||||
@@ -44,11 +49,11 @@
|
||||
Visibility="{Binding IsRunning, Converter={StaticResource BoolToVis}}" />
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" Command="{Binding CopyOutputCommand}"
|
||||
ToolTip="{res:Loc Console_CopyAll}" AutomationProperties.Name="{res:Loc Console_CopyAll}">
|
||||
<ui:SymbolIcon Symbol="Copy24" />
|
||||
<ctl:DecorativeIcon Symbol="Copy24" />
|
||||
</ui:Button>
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" Command="{Binding SaveOutputCommand}"
|
||||
ToolTip="{res:Loc Console_Save}" AutomationProperties.Name="{res:Loc Console_Save}">
|
||||
<ui:SymbolIcon Symbol="Save24" />
|
||||
<ctl:DecorativeIcon Symbol="Save24" />
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -56,10 +61,10 @@
|
||||
<!-- Result -->
|
||||
<Grid DockPanel.Dock="Bottom" Margin="0,8,0,0"
|
||||
Visibility="{Binding HasResult, Converter={StaticResource BoolToVis}}">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" AutomationProperties.LiveSetting="Polite">
|
||||
<ui:SymbolIcon FontSize="16" Margin="0,0,6,0" VerticalAlignment="Center">
|
||||
<ui:SymbolIcon.Style>
|
||||
<Style TargetType="ui:SymbolIcon">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<ctl:DecorativeIcon FontSize="16" Margin="0,0,6,0" VerticalAlignment="Center">
|
||||
<ctl:DecorativeIcon.Style>
|
||||
<Style TargetType="ctl:DecorativeIcon">
|
||||
<Setter Property="Symbol" Value="ErrorCircle24" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorCriticalBrush}" />
|
||||
<Style.Triggers>
|
||||
@@ -73,8 +78,8 @@
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ui:SymbolIcon.Style>
|
||||
</ui:SymbolIcon>
|
||||
</ctl:DecorativeIcon.Style>
|
||||
</ctl:DecorativeIcon>
|
||||
<TextBlock Text="{Binding StatusText}" Style="{StaticResource BodyStrongTextStyle}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{res:Loc Result_ExitCode}" Style="{StaticResource SecondaryTextStyle}" Margin="14,0,4,0" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding ExitCode}" Style="{StaticResource SecondaryTextStyle}" VerticalAlignment="Center" />
|
||||
@@ -84,7 +89,7 @@
|
||||
Command="{Binding RestartWindowsCommand}"
|
||||
Visibility="{Binding RequiresRestart, Converter={StaticResource BoolToVis}}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="ArrowClockwise24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowClockwise24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
</Grid>
|
||||
@@ -93,7 +98,8 @@
|
||||
<TextBlock DockPanel.Dock="Top" Text="{Binding DroppedLinesText}" Style="{StaticResource CaptionTextStyle}"
|
||||
Margin="0,0,0,4" Visibility="{Binding HasDroppedLines, Converter={StaticResource BoolToVis}}" />
|
||||
|
||||
<!-- Output: virtualized, so even huge outputs stay responsive -->
|
||||
<!-- Output: virtualized, so even huge outputs stay responsive. Tab reaches it and the arrow keys
|
||||
move line by line; each line is read by its text, an error line with an "Error" prefix. -->
|
||||
<ListBox ItemsSource="{Binding OutputLines}"
|
||||
Background="Transparent" BorderThickness="0" Padding="0"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
@@ -104,7 +110,8 @@
|
||||
AutomationProperties.Name="{res:Loc PaneConsole}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Text}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
@@ -112,11 +119,29 @@
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsError}" Value="True">
|
||||
<Setter Property="AutomationProperties.Name">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{conv:FormatConverter}">
|
||||
<Binding Source="{x:Static res:LocalizationManager.Instance}" Path="[Console_ErrorLine]" />
|
||||
<Binding Path="Text" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</DataTrigger>
|
||||
<!-- A blank line has no text to read: say so instead of the line's type name. -->
|
||||
<DataTrigger Binding="{Binding Text, Converter={conv:BlankToBooleanConverter}}" Value="True">
|
||||
<Setter Property="AutomationProperties.Name" Value="{res:Loc A11y_BlankLine}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource ConsoleLineTextStyle}" />
|
||||
<Border Style="{StaticResource ConsoleLineBorderStyle}">
|
||||
<TextBlock Text="{Binding Text}" Style="{StaticResource ConsoleLineTextStyle}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<UserControl x:Class="CommandForge.Desktop.Views.DangerBadge"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
x:Name="Root"
|
||||
Focusable="False">
|
||||
<!-- The risk level as icon + text + color, so it never depends on color alone. -->
|
||||
@@ -23,9 +23,9 @@
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon FontSize="14" VerticalAlignment="Center" Margin="0,0,6,0">
|
||||
<ui:SymbolIcon.Style>
|
||||
<Style TargetType="ui:SymbolIcon">
|
||||
<ctl:DecorativeIcon FontSize="14" VerticalAlignment="Center" Margin="0,0,6,0">
|
||||
<ctl:DecorativeIcon.Style>
|
||||
<Style TargetType="ctl:DecorativeIcon">
|
||||
<Setter Property="Symbol" Value="CheckmarkCircle24" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorSuccessBrush}" />
|
||||
<Style.Triggers>
|
||||
@@ -39,8 +39,8 @@
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ui:SymbolIcon.Style>
|
||||
</ui:SymbolIcon>
|
||||
</ctl:DecorativeIcon.Style>
|
||||
</ctl:DecorativeIcon>
|
||||
<TextBlock x:Name="LabelText" VerticalAlignment="Center" FontWeight="SemiBold"
|
||||
FontSize="{DynamicResource AppFontSizeCaption}"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
@@ -13,17 +14,17 @@
|
||||
|
||||
<TextBlock Grid.Row="0" Text="{res:Loc Menu_DebugPanel}" Style="{StaticResource PageTitleTextStyle}" Margin="0,0,0,12" />
|
||||
|
||||
<TabControl Grid.Row="1">
|
||||
<TabControl Grid.Row="1" AutomationProperties.Name="{res:Loc Menu_DebugPanel}">
|
||||
<TabItem Header="{res:Loc Debug_TabVerbose}">
|
||||
<DockPanel Margin="0,12,0,0">
|
||||
<ui:Button DockPanel.Dock="Top" HorizontalAlignment="Left" Margin="0,0,0,8"
|
||||
Content="{res:Loc Debug_Refresh}" Command="{Binding RefreshCommand}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="ArrowClockwise24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowClockwise24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<Border Style="{StaticResource ConsoleBorderStyle}" Padding="10,6">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Focusable="False">
|
||||
<TextBox Text="{Binding LogText, Mode=OneWay}" Style="{StaticResource ReadOnlyCodeTextBoxStyle}"
|
||||
TextWrapping="NoWrap" AutomationProperties.Name="{res:Loc Debug_TabVerbose}" />
|
||||
</ScrollViewer>
|
||||
@@ -42,7 +43,12 @@
|
||||
<TextBlock Text="{res:Loc Debug_ValidationErrors}" Style="{StaticResource BodyStrongTextStyle}" Margin="0,16,0,6" />
|
||||
<TextBlock Text="{res:Loc Debug_NoValidationErrors}" Style="{StaticResource SecondaryTextStyle}"
|
||||
Visibility="{Binding HasValidationErrors, Converter={conv:InverseBooleanToVisibilityConverter}}" />
|
||||
<ItemsControl ItemsSource="{Binding ValidationErrors}">
|
||||
<ItemsControl ItemsSource="{Binding ValidationErrors}" AutomationProperties.Name="{res:Loc Debug_ValidationErrors}">
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding}" />
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" TextWrapping="Wrap" Margin="0,2"
|
||||
@@ -58,7 +64,7 @@
|
||||
<ui:Button DockPanel.Dock="Top" HorizontalAlignment="Left" Margin="0,0,0,8"
|
||||
Content="{res:Loc Debug_CopySystemInfo}" Command="{Binding CopySystemInfoCommand}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Copy24" />
|
||||
<ctl:DecorativeIcon Symbol="Copy24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<Border Style="{StaticResource CodeBlockBorderStyle}" VerticalAlignment="Top">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
Title="{res:Loc Error_Title}"
|
||||
Width="540" SizeToContent="Height" ResizeMode="NoResize"
|
||||
@@ -16,7 +17,7 @@
|
||||
|
||||
<StackPanel Margin="24,4,24,20">
|
||||
<DockPanel Margin="0,0,0,12">
|
||||
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="ErrorCircle24" FontSize="28" Margin="0,0,12,0" VerticalAlignment="Top"
|
||||
<ctl:DecorativeIcon DockPanel.Dock="Left" Symbol="ErrorCircle24" FontSize="28" Margin="0,0,12,0" VerticalAlignment="Top"
|
||||
Foreground="{DynamicResource SystemFillColorCriticalBrush}" />
|
||||
<TextBlock Text="{res:Loc Error_Message}" TextWrapping="Wrap" />
|
||||
</DockPanel>
|
||||
@@ -30,7 +31,7 @@
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<ui:Button Content="{res:Loc Error_CopyDetails}" Command="{Binding CopyDetailsCommand}" Margin="0,0,8,0" />
|
||||
<ui:Button Content="{res:Loc Error_ReportBug}" Command="{Binding ReportBugCommand}" Margin="0,0,8,0" />
|
||||
<ui:Button Content="{res:Loc Error_Close}" Command="{Binding CloseCommand}" Appearance="Primary"
|
||||
<ui:Button x:Name="CloseButton" Content="{res:Loc Error_Close}" Command="{Binding CloseCommand}" Appearance="Primary"
|
||||
IsCancel="True" IsDefault="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -12,5 +12,8 @@ public partial class ErrorDialog : FluentWindow
|
||||
InitializeComponent();
|
||||
DataContext = viewModel;
|
||||
viewModel.CloseRequested += Close;
|
||||
|
||||
// Start on Close, the default answer, so the keyboard is in the window at once.
|
||||
Loaded += (_, _) => CloseButton.Focus();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace CommandForge.Desktop.Views;
|
||||
|
||||
/// <summary>
|
||||
/// F6 / Shift+F6 order between the window's regions (navigation pane, page, console), as in File
|
||||
/// Explorer and Windows Settings: forward wraps from the last region to the first, backward the other
|
||||
/// way, and from outside every region F6 starts at the first and Shift+F6 at the last.
|
||||
/// </summary>
|
||||
public static class FocusCycle
|
||||
{
|
||||
/// <summary>Pure: the region to move to from <paramref name="current"/> (-1: none) among <paramref name="count"/>.</summary>
|
||||
public static int Next(int current, int count, bool backwards)
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(count);
|
||||
if (current < 0 || current >= count)
|
||||
{
|
||||
return backwards ? count - 1 : 0;
|
||||
}
|
||||
|
||||
return (current + (backwards ? count - 1 : 1)) % count;
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,15 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<UserControl.Resources>
|
||||
<conv:IconNameToSymbolConverter x:Key="IconConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
<conv:RowActionNameConverter x:Key="RowActionUndo" LabelKey="History_Undo" />
|
||||
<conv:RowActionNameConverter x:Key="RowActionRunAgain" LabelKey="History_RunAgain" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Margin="24,12,24,16">
|
||||
@@ -25,13 +28,14 @@
|
||||
<ui:Button Grid.Column="1" Content="{res:Loc History_Clear}" Command="{Binding ClearCommand}" VerticalAlignment="Center"
|
||||
Visibility="{Binding HasEntries, Converter={StaticResource BoolToVis}}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Delete24" />
|
||||
<ctl:DecorativeIcon Symbol="Delete24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
</Grid>
|
||||
|
||||
<!-- Past runs, newest first (virtualized: the history can be long) -->
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Entries}"
|
||||
<!-- Past runs, newest first (virtualized: the history can be long). The arrow keys move between
|
||||
runs, Enter opens the selected one in the catalog, and Tab moves into its Undo / Run again. -->
|
||||
<ListBox x:Name="EntriesList" Grid.Row="1" ItemsSource="{Binding Entries}"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
@@ -42,7 +46,17 @@
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="KeyboardNavigation.TabNavigation" Value="Local" />
|
||||
<Setter Property="AutomationProperties.Name">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{conv:FormatConverter}">
|
||||
<Binding Source="{x:Static res:LocalizationManager.Instance}" Path="[A11y_HistoryEntry]" />
|
||||
<Binding Path="Title" />
|
||||
<Binding Path="StatusText" />
|
||||
<Binding Path="TimeText" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
@@ -53,14 +67,14 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:SymbolIcon Grid.Column="0" Symbol="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
<ctl:DecorativeIcon Grid.Column="0" Symbol="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
FontSize="20" VerticalAlignment="Center" Margin="2,0,12,0" />
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Title}" Style="{StaticResource ListTitleTextStyle}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon FontSize="13" Margin="0,0,4,0" VerticalAlignment="Center">
|
||||
<ui:SymbolIcon.Style>
|
||||
<Style TargetType="ui:SymbolIcon">
|
||||
<ctl:DecorativeIcon FontSize="13" Margin="0,0,4,0" VerticalAlignment="Center">
|
||||
<ctl:DecorativeIcon.Style>
|
||||
<Style TargetType="ctl:DecorativeIcon">
|
||||
<Setter Property="Symbol" Value="ErrorCircle24" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorCriticalBrush}" />
|
||||
<Style.Triggers>
|
||||
@@ -70,8 +84,8 @@
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ui:SymbolIcon.Style>
|
||||
</ui:SymbolIcon>
|
||||
</ctl:DecorativeIcon.Style>
|
||||
</ctl:DecorativeIcon>
|
||||
<TextBlock Style="{StaticResource ListDescriptionTextStyle}">
|
||||
<Run Text="{Binding StatusText, Mode=OneWay}" /><Run Text=" · " /><Run Text="{Binding TimeText, Mode=OneWay}" /><Run Text=" · " /><Run Text="{Binding DurationText, Mode=OneWay}" />
|
||||
</TextBlock>
|
||||
@@ -80,10 +94,12 @@
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<ui:Button Appearance="Transparent" Content="{res:Loc History_Undo}" Margin="0,0,4,0"
|
||||
Visibility="{Binding CanUndo, Converter={StaticResource BoolToVis}}"
|
||||
AutomationProperties.Name="{Binding Title, Converter={StaticResource RowActionUndo}}"
|
||||
Command="{Binding DataContext.UndoCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}" />
|
||||
<ui:Button Appearance="Transparent" Content="{res:Loc History_RunAgain}"
|
||||
IsEnabled="{Binding CanRun}"
|
||||
AutomationProperties.Name="{Binding Title, Converter={StaticResource RowActionRunAgain}}"
|
||||
Command="{Binding DataContext.RunAgainCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,9 +1,30 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using CommandForge.Desktop.ViewModels;
|
||||
|
||||
namespace CommandForge.Desktop.Views;
|
||||
|
||||
/// <summary>The execution-history view (past runs, re-run, clear).</summary>
|
||||
public partial class HistoryView : UserControl
|
||||
{
|
||||
public HistoryView() => InitializeComponent();
|
||||
public HistoryView()
|
||||
{
|
||||
InitializeComponent();
|
||||
EntriesList.KeyDown += OnEntriesKeyDown;
|
||||
}
|
||||
|
||||
/// <summary>Enter on a run opens its command in the catalog (a button in the row handles its own Enter first).</summary>
|
||||
private void OnEntriesKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Handled || e.Key != Key.Enter || Keyboard.Modifiers != ModifierKeys.None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.OriginalSource is ListBoxItem { DataContext: HistoryEntryViewModel entry } && DataContext is HistoryViewModel viewModel)
|
||||
{
|
||||
viewModel.OpenCommand.Execute(entry);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
@@ -9,6 +10,12 @@
|
||||
<conv:IconNameToSymbolConverter x:Key="IconConverter" />
|
||||
<conv:DangerLevelToTextConverter x:Key="DangerText" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
<conv:RowActionNameConverter x:Key="RowActionOpen" LabelKey="Maint_Open" />
|
||||
|
||||
<!-- Items of a plain ItemsControl are read by their container's name, else by a type name. -->
|
||||
<Style x:Key="CommandItemContainerStyle" TargetType="ContentPresenter">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
</Style>
|
||||
|
||||
<!-- A clickable command row shared by the Recent and Favorites lists. The button names itself
|
||||
from its content (title + description), so screen readers get the same context. -->
|
||||
@@ -17,9 +24,10 @@
|
||||
Command="{Binding DataContext.OpenCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}"
|
||||
AutomationProperties.Name="{Binding Title}"
|
||||
AutomationProperties.HelpText="{Binding Description}">
|
||||
AutomationProperties.HelpText="{Binding Description}"
|
||||
AutomationProperties.ItemStatus="{Binding AccessibleStatus}">
|
||||
<ui:CardAction.Icon>
|
||||
<ui:SymbolIcon Symbol="{Binding Icon, Converter={StaticResource IconConverter}}" />
|
||||
<ctl:DecorativeIcon Symbol="{Binding Icon, Converter={StaticResource IconConverter}}" />
|
||||
</ui:CardAction.Icon>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -39,12 +47,15 @@
|
||||
<!-- One read-only status tile. -->
|
||||
<Style x:Key="StatusCardStyle" TargetType="ui:Card" BasedOn="{StaticResource {x:Type ui:Card}}">
|
||||
<Setter Property="Margin" Value="0,0,12,12" />
|
||||
<Setter Property="Width" Value="230" />
|
||||
<!-- A minimum, not a fixed width: the value grows with large text sizes instead of clipping. -->
|
||||
<Setter Property="MinWidth" Value="230" />
|
||||
<Setter Property="MaxWidth" Value="480" />
|
||||
<Setter Property="Padding" Value="16,12" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<!-- Not a Tab stop of its own: the arrow and page keys scroll it from any control on the page. -->
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Focusable="False">
|
||||
<StackPanel Margin="24,12,24,24" MaxWidth="1040" HorizontalAlignment="Left">
|
||||
<TextBlock Text="{res:Loc SidebarHome}" Style="{StaticResource PageTitleTextStyle}" />
|
||||
|
||||
@@ -54,7 +65,7 @@
|
||||
<ui:Card Style="{StaticResource StatusCardStyle}">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="WindowApps24" FontSize="18" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" />
|
||||
<ctl:DecorativeIcon Symbol="WindowApps24" FontSize="18" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" />
|
||||
<TextBlock Text="{res:Loc Home_StatusOs}" Style="{StaticResource SecondaryTextStyle}" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding OsValue}" Style="{StaticResource BodyStrongTextStyle}" Margin="0,6,0,0" TextWrapping="Wrap" />
|
||||
@@ -63,7 +74,7 @@
|
||||
<ui:Card Style="{StaticResource StatusCardStyle}">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="DataUsage24" FontSize="18" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" />
|
||||
<ctl:DecorativeIcon Symbol="DataUsage24" FontSize="18" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" />
|
||||
<TextBlock Text="{res:Loc Home_StatusMemory}" Style="{StaticResource SecondaryTextStyle}" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding MemoryValue}" Style="{StaticResource BodyStrongTextStyle}" Margin="0,6,0,0" TextWrapping="Wrap" />
|
||||
@@ -72,7 +83,7 @@
|
||||
<ui:Card Style="{StaticResource StatusCardStyle}">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="HardDrive20" FontSize="18" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" />
|
||||
<ctl:DecorativeIcon Symbol="HardDrive20" FontSize="18" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" />
|
||||
<TextBlock Text="{res:Loc Home_StatusDisk}" Style="{StaticResource SecondaryTextStyle}" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding DiskValue}" Style="{StaticResource BodyStrongTextStyle}" Margin="0,6,0,0" TextWrapping="Wrap" />
|
||||
@@ -81,7 +92,7 @@
|
||||
<ui:Card Style="{StaticResource StatusCardStyle}">
|
||||
<StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="Clock24" FontSize="18" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" />
|
||||
<ctl:DecorativeIcon Symbol="Clock24" FontSize="18" Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" />
|
||||
<TextBlock Text="{res:Loc Home_StatusUptime}" Style="{StaticResource SecondaryTextStyle}" Margin="8,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding UptimeValue}" Style="{StaticResource BodyStrongTextStyle}" Margin="0,6,0,0" TextWrapping="Wrap" />
|
||||
@@ -93,10 +104,16 @@
|
||||
<StackPanel Visibility="{Binding HasSuggestions, Converter={StaticResource BoolToVis}}">
|
||||
<TextBlock Text="{res:Loc Home_Suggestions}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
<ItemsControl ItemsSource="{Binding Suggestions}">
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Reason}" />
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ui:InfoBar Title="{Binding Reason}" IsOpen="True" IsClosable="False" Severity="Informational" Margin="0,0,0,6">
|
||||
<ui:Button Content="{res:Loc Maint_Open}" Margin="0,4,0,0"
|
||||
AutomationProperties.Name="{Binding Reason, Converter={StaticResource RowActionOpen}}"
|
||||
Visibility="{Binding CanOpen, Converter={StaticResource BoolToVis}}"
|
||||
Command="{Binding DataContext.OpenCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding Command}" />
|
||||
@@ -110,6 +127,8 @@
|
||||
<TextBlock Text="{res:Loc Home_Recent}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
<Grid>
|
||||
<ItemsControl ItemsSource="{Binding Recent}" ItemTemplate="{StaticResource HomeCommandItem}"
|
||||
ItemContainerStyle="{StaticResource CommandItemContainerStyle}"
|
||||
AutomationProperties.Name="{res:Loc Home_Recent}"
|
||||
Visibility="{Binding HasRecent, Converter={StaticResource BoolToVis}}" />
|
||||
<TextBlock Text="{res:Loc Home_NoRecent}" Style="{StaticResource SecondaryTextStyle}"
|
||||
Visibility="{Binding HasRecent, Converter={conv:InverseBooleanToVisibilityConverter}}" />
|
||||
@@ -119,6 +138,8 @@
|
||||
<TextBlock Text="{res:Loc SidebarFavorites}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
<Grid>
|
||||
<ItemsControl ItemsSource="{Binding Favorites}" ItemTemplate="{StaticResource HomeCommandItem}"
|
||||
ItemContainerStyle="{StaticResource CommandItemContainerStyle}"
|
||||
AutomationProperties.Name="{res:Loc SidebarFavorites}"
|
||||
Visibility="{Binding HasFavorites, Converter={StaticResource BoolToVis}}" />
|
||||
<TextBlock Text="{res:Loc Home_NoFavorites}" Style="{StaticResource SecondaryTextStyle}"
|
||||
Visibility="{Binding HasFavorites, Converter={conv:InverseBooleanToVisibilityConverter}}" />
|
||||
|
||||
@@ -1,13 +1,30 @@
|
||||
<UserControl x:Class="CommandForge.Desktop.Views.KeyboardShortcutsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<!-- The shortcuts the shell actually handles. -->
|
||||
<ItemsControl x:Name="ShortcutList" MinWidth="380">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters">
|
||||
<!-- The shortcuts the shell actually handles. The key column fits its widest key at any text size,
|
||||
and each row is read as "key: action". -->
|
||||
<ItemsControl x:Name="ShortcutList" MinWidth="380" Grid.IsSharedSizeScope="True"
|
||||
AutomationProperties.Name="{res:Loc Menu_KeyboardShortcuts}">
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="AutomationProperties.Name">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{conv:FormatConverter}">
|
||||
<Binding Source="{x:Static res:LocalizationManager.Instance}" Path="[A11y_RowAction]" />
|
||||
<Binding Path="Key" />
|
||||
<Binding Path="Action" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Margin="0,4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="110" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="110" SharedSizeGroup="ShortcutKey" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Grid.Column="0" Style="{StaticResource CodeBlockBorderStyle}" Padding="6,2"
|
||||
|
||||
@@ -15,6 +15,7 @@ public partial class KeyboardShortcutsView : UserControl
|
||||
new Shortcut("Ctrl+F", Strings.Get("Shortcuts_Search")),
|
||||
new Shortcut("Ctrl+H", Strings.Get("SidebarHome")),
|
||||
new Shortcut("Ctrl+B", Strings.Get("MenuToggleSidebar")),
|
||||
new Shortcut("F6 / Shift+F6", Strings.Get("Shortcuts_Regions")),
|
||||
new Shortcut("Ctrl+,", Strings.Get("Menu_OpenSettings")),
|
||||
new Shortcut("Ctrl+L", Strings.Get("Menu_LogViewer")),
|
||||
new Shortcut("F5", Strings.Get("Menu_CheckForUpdates")),
|
||||
|
||||
@@ -2,42 +2,52 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources">
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters">
|
||||
<UserControl.Resources>
|
||||
<!-- "Read on GitHub: EULA": the link's text, then the document it opens. -->
|
||||
<conv:RowActionNameConverter x:Key="ReadOnGitHubName" LabelKey="LegalGateReadOnGitHub" />
|
||||
</UserControl.Resources>
|
||||
|
||||
<!-- Each document: a short summary and a link to the full text on GitHub (Tag = URL). -->
|
||||
<TabControl>
|
||||
<TabControl AutomationProperties.Name="{res:Loc LegalViewer_Title}">
|
||||
<TabItem Header="{res:Loc TabEula}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" AutomationProperties.Name="{res:Loc TabEula}">
|
||||
<StackPanel Margin="4,16,4,4">
|
||||
<TextBlock Text="{res:Loc Legal_EulaSummary}" TextWrapping="Wrap" />
|
||||
<ui:HyperlinkButton Content="{res:Loc LegalGateReadOnGitHub}" Margin="-8,12,0,0" Click="OnLinkClick"
|
||||
Tag="https://github.com/poli0981/CommandForge/blob/main/EULA.md" />
|
||||
Tag="https://github.com/poli0981/CommandForge/blob/main/EULA.md"
|
||||
AutomationProperties.Name="{Binding [TabEula], Source={x:Static res:LocalizationManager.Instance}, Converter={StaticResource ReadOnGitHubName}}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="{res:Loc TabGpl}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" AutomationProperties.Name="{res:Loc TabGpl}">
|
||||
<StackPanel Margin="4,16,4,4">
|
||||
<TextBlock Text="{res:Loc Legal_GplSummary}" TextWrapping="Wrap" />
|
||||
<ui:HyperlinkButton Content="{res:Loc LegalGateReadOnGitHub}" Margin="-8,12,0,0" Click="OnLinkClick"
|
||||
Tag="https://github.com/poli0981/CommandForge/blob/main/LICENSE" />
|
||||
Tag="https://github.com/poli0981/CommandForge/blob/main/LICENSE"
|
||||
AutomationProperties.Name="{Binding [TabGpl], Source={x:Static res:LocalizationManager.Instance}, Converter={StaticResource ReadOnGitHubName}}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="{res:Loc TabDisclaimer}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" AutomationProperties.Name="{res:Loc TabDisclaimer}">
|
||||
<StackPanel Margin="4,16,4,4">
|
||||
<TextBlock Text="{res:Loc Legal_DisclaimerSummary}" TextWrapping="Wrap" />
|
||||
<ui:HyperlinkButton Content="{res:Loc LegalGateReadOnGitHub}" Margin="-8,12,0,0" Click="OnLinkClick"
|
||||
Tag="https://github.com/poli0981/CommandForge/blob/main/DISCLAIMER.md" />
|
||||
Tag="https://github.com/poli0981/CommandForge/blob/main/DISCLAIMER.md"
|
||||
AutomationProperties.Name="{Binding [TabDisclaimer], Source={x:Static res:LocalizationManager.Instance}, Converter={StaticResource ReadOnGitHubName}}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="{res:Loc TabPrivacy}">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" AutomationProperties.Name="{res:Loc TabPrivacy}">
|
||||
<StackPanel Margin="4,16,4,4">
|
||||
<TextBlock Text="{res:Loc Legal_PrivacySummary}" TextWrapping="Wrap" />
|
||||
<ui:HyperlinkButton Content="{res:Loc LegalGateReadOnGitHub}" Margin="-8,12,0,0" Click="OnLinkClick"
|
||||
Tag="https://github.com/poli0981/CommandForge/blob/main/PRIVACY.md" />
|
||||
Tag="https://github.com/poli0981/CommandForge/blob/main/PRIVACY.md"
|
||||
AutomationProperties.Name="{Binding [TabPrivacy], Source={x:Static res:LocalizationManager.Instance}, Converter={StaticResource ReadOnGitHubName}}" />
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:views="clr-namespace:CommandForge.Desktop.Views"
|
||||
Title="{res:Loc LegalGateTitle}"
|
||||
@@ -19,7 +20,7 @@
|
||||
|
||||
<ui:TitleBar Grid.Row="0" Title="{res:Loc LegalGateTitle}" ShowMaximize="False" ShowMinimize="False">
|
||||
<ui:TitleBar.Icon>
|
||||
<ui:SymbolIcon Symbol="WindowConsole20" />
|
||||
<ctl:DecorativeIcon Symbol="WindowConsole20" />
|
||||
</ui:TitleBar.Icon>
|
||||
</ui:TitleBar>
|
||||
|
||||
@@ -38,10 +39,17 @@
|
||||
|
||||
<!-- Pick the language first so the terms below are read in it. -->
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,0,0,12">
|
||||
<ui:SymbolIcon Symbol="LocalLanguage24" Margin="0,0,8,0" VerticalAlignment="Center" />
|
||||
<ctl:DecorativeIcon Symbol="LocalLanguage24" Margin="0,0,8,0" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{res:Loc Settings_Language}" VerticalAlignment="Center" Margin="0,0,12,0" />
|
||||
<ComboBox MinWidth="200" ItemsSource="{Binding Languages}" DisplayMemberPath="DisplayName"
|
||||
SelectedItem="{Binding SelectedLanguage}" AutomationProperties.Name="{res:Loc Settings_Language}" />
|
||||
<ComboBox x:Name="LanguageBox" MinWidth="200" ItemsSource="{Binding Languages}" DisplayMemberPath="DisplayName"
|
||||
SelectedItem="{Binding SelectedLanguage}" AutomationProperties.Name="{res:Loc Settings_Language}">
|
||||
<!-- Without this each language is read as its record (code and name). -->
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding DisplayName}" />
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
|
||||
<views:LegalDocumentsView Grid.Row="3" />
|
||||
|
||||
@@ -14,5 +14,8 @@ public partial class LegalGateWindow : FluentWindow
|
||||
|
||||
// Setting DialogResult closes a window opened with ShowDialog().
|
||||
viewModel.CloseRequested += result => DialogResult = result;
|
||||
|
||||
// Start in the language list: the terms below are read in the language chosen there.
|
||||
Loaded += (_, _) => LanguageBox.Focus();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace CommandForge.Desktop.Views;
|
||||
@@ -6,7 +7,13 @@ namespace CommandForge.Desktop.Views;
|
||||
/// <summary>Read-only viewer for the legal documents (reuses <see cref="LegalDocumentsView"/>).</summary>
|
||||
public partial class LegalViewerWindow : FluentWindow
|
||||
{
|
||||
public LegalViewerWindow() => InitializeComponent();
|
||||
public LegalViewerWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Start in the documents' tabs, so the keyboard is in the window at once.
|
||||
Loaded += (_, _) => MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
|
||||
}
|
||||
|
||||
private void OnCloseClick(object sender, RoutedEventArgs e) => Close();
|
||||
}
|
||||
@@ -2,8 +2,10 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:beh="clr-namespace:CommandForge.Desktop.Behaviors"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<UserControl.Resources>
|
||||
<!-- Level colors from the theme; the level tag is always shown too (never color alone). -->
|
||||
@@ -21,11 +23,12 @@
|
||||
<DataTrigger Binding="{Binding Level}" Value="Fatal">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SystemFillColorCriticalBrush}" />
|
||||
</DataTrigger>
|
||||
<!-- Secondary, not tertiary: tertiary text falls below 4.5:1 in the Light theme. -->
|
||||
<DataTrigger Binding="{Binding Level}" Value="Debug">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Level}" Value="Verbose">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
@@ -51,13 +54,20 @@
|
||||
<ComboBox Grid.Column="0" MinWidth="150" VerticalAlignment="Center"
|
||||
AutomationProperties.Name="{res:Loc LogViewer_Level}"
|
||||
ItemsSource="{Binding LevelOptions}" DisplayMemberPath="DisplayName"
|
||||
SelectedValuePath="Value" SelectedValue="{Binding SelectedLevel}" />
|
||||
SelectedValuePath="Value" SelectedValue="{Binding SelectedLevel}">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding DisplayName}" />
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
<ui:TextBox Grid.Column="1" Margin="8,0" VerticalAlignment="Center" MaxWidth="480" HorizontalAlignment="Stretch"
|
||||
PlaceholderText="{res:Loc LogViewer_FilterHint}" ClearButtonEnabled="True"
|
||||
AutomationProperties.Name="{res:Loc LogViewer_FilterHint}"
|
||||
beh:ShortcutScope.AllowExit="True"
|
||||
Text="{Binding FilterText, UpdateSourceTrigger=PropertyChanged}">
|
||||
<ui:TextBox.Icon>
|
||||
<ui:SymbolIcon Symbol="Filter24" />
|
||||
<ctl:DecorativeIcon Symbol="Filter24" />
|
||||
</ui:TextBox.Icon>
|
||||
</ui:TextBox>
|
||||
<CheckBox Grid.Column="2" VerticalAlignment="Center" Margin="0,0,8,0"
|
||||
@@ -65,20 +75,21 @@
|
||||
<StackPanel Grid.Column="3" Orientation="Horizontal">
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" Command="{Binding OpenFolderCommand}"
|
||||
ToolTip="{res:Loc LogViewer_OpenFolder}" AutomationProperties.Name="{res:Loc LogViewer_OpenFolder}">
|
||||
<ui:SymbolIcon Symbol="FolderOpen24" />
|
||||
<ctl:DecorativeIcon Symbol="FolderOpen24" />
|
||||
</ui:Button>
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" Command="{Binding ExportZipCommand}"
|
||||
ToolTip="{res:Loc LogViewer_Export}" AutomationProperties.Name="{res:Loc LogViewer_Export}">
|
||||
<ui:SymbolIcon Symbol="ArrowExportLtr24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowExportLtr24" />
|
||||
</ui:Button>
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" Command="{Binding ClearCommand}"
|
||||
ToolTip="{res:Loc LogViewer_Clear}" AutomationProperties.Name="{res:Loc LogViewer_Clear}">
|
||||
<ui:SymbolIcon Symbol="Delete24" />
|
||||
<ctl:DecorativeIcon Symbol="Delete24" />
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Entries (virtualized) -->
|
||||
<!-- Entries (virtualized). Tab reaches them and the arrow keys move entry by entry; each is read
|
||||
as its level, time and message. -->
|
||||
<Border Grid.Row="2" Style="{StaticResource ConsoleBorderStyle}" Padding="10,6">
|
||||
<ListBox ItemsSource="{Binding View}"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
@@ -90,7 +101,17 @@
|
||||
AutomationProperties.Name="{res:Loc LogViewer_Title}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
<Setter Property="AutomationProperties.Name">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{conv:FormatConverter}">
|
||||
<Binding Source="{x:Static res:LocalizationManager.Instance}" Path="[A11y_LogEntry]" />
|
||||
<Binding Path="LevelTag" />
|
||||
<Binding Path="Time" />
|
||||
<Binding Path="Message" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
@@ -111,7 +132,7 @@
|
||||
<TextBlock Grid.Column="0" Text="{Binding Time}" Margin="0,0,10,0"
|
||||
FontFamily="{StaticResource ConsoleFontFamily}" FontSize="{DynamicResource AppFontSizeConsole}"
|
||||
Foreground="{DynamicResource TextFillColorSecondaryBrush}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding LevelTag}" Width="34" FontWeight="SemiBold" Margin="0,0,10,0"
|
||||
<TextBlock Grid.Column="1" Text="{Binding LevelTag}" MinWidth="34" FontWeight="SemiBold" Margin="0,0,10,0"
|
||||
Style="{StaticResource LogLineStyle}" />
|
||||
<TextBlock Grid.Column="2" Text="{Binding Message}" TextWrapping="Wrap" Style="{StaticResource LogLineStyle}" />
|
||||
</Grid>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
Title="{res:Loc AppTitle}"
|
||||
Width="1200" Height="780" MinWidth="960" MinHeight="600"
|
||||
@@ -27,19 +28,23 @@
|
||||
|
||||
<ui:TitleBar x:Name="AppTitleBar" Grid.Row="0" Title="{res:Loc AppTitle}" CloseWindowByDoubleClickOnIcon="True">
|
||||
<ui:TitleBar.Icon>
|
||||
<ui:SymbolIcon Symbol="WindowConsole20" />
|
||||
<ctl:DecorativeIcon Symbol="WindowConsole20" />
|
||||
</ui:TitleBar.Icon>
|
||||
|
||||
<!-- Looks like a search box; opens the command palette (Ctrl+K). -->
|
||||
<ui:TitleBar.CenterContent>
|
||||
<!-- The title bar keeps its height, so very large text is cut short: an ellipsis and the
|
||||
tooltip show that, and the button's name is the whole text. -->
|
||||
<ui:Button x:Name="SearchButton" Click="OnOpenPaletteClick" Width="420" Margin="24,0,0,0"
|
||||
HorizontalAlignment="Center" HorizontalContentAlignment="Left" Padding="10,5"
|
||||
AutomationProperties.Name="{res:Loc TitleBar_Search}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="Search24" FontSize="16" Margin="0,0,8,0" />
|
||||
HorizontalAlignment="Center" HorizontalContentAlignment="Stretch" Padding="10,5"
|
||||
AutomationProperties.Name="{res:Loc TitleBar_Search}"
|
||||
AutomationProperties.AcceleratorKey="Ctrl+K"
|
||||
ToolTip="{res:Loc TitleBar_Search}">
|
||||
<DockPanel>
|
||||
<ctl:DecorativeIcon DockPanel.Dock="Left" Symbol="Search24" FontSize="16" Margin="0,0,8,0" />
|
||||
<TextBlock Text="{res:Loc TitleBar_Search}" Foreground="{DynamicResource TextFillColorSecondaryBrush}"
|
||||
VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
</DockPanel>
|
||||
</ui:Button>
|
||||
</ui:TitleBar.CenterContent>
|
||||
|
||||
@@ -51,14 +56,14 @@
|
||||
ToolTip="{res:Loc Admin_SessionTooltip}"
|
||||
AutomationProperties.Name="{res:Loc Admin_SessionActive}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:SymbolIcon Symbol="Shield24" FontSize="16" Foreground="{DynamicResource SystemFillColorCautionBrush}" />
|
||||
<ctl:DecorativeIcon Symbol="Shield24" FontSize="16" Foreground="{DynamicResource SystemFillColorCautionBrush}" />
|
||||
<TextBlock Text="{res:Loc Admin_SessionActive}" Margin="6,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<ui:DropDownButton.Flyout>
|
||||
<ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
|
||||
<ui:MenuItem Header="{res:Loc Admin_EndSession}" Command="{Binding EndAdminSessionCommand}">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="ShieldDismiss24" />
|
||||
<ctl:DecorativeIcon Symbol="ShieldDismiss24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
</ContextMenu>
|
||||
@@ -67,70 +72,70 @@
|
||||
|
||||
<ui:DropDownButton Appearance="Transparent" Padding="8,4" ToolTip="{res:Loc Menu_More}"
|
||||
AutomationProperties.Name="{res:Loc Menu_More}">
|
||||
<ui:SymbolIcon Symbol="MoreHorizontal24" />
|
||||
<ctl:DecorativeIcon Symbol="MoreHorizontal24" />
|
||||
<ui:DropDownButton.Flyout>
|
||||
<ContextMenu DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
|
||||
<ui:MenuItem Header="{res:Loc Palette_Placeholder}" InputGestureText="Ctrl+K" Click="OnOpenPaletteClick">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="Search24" />
|
||||
<ctl:DecorativeIcon Symbol="Search24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<ui:MenuItem Header="{res:Loc Menu_CheckForUpdates}" InputGestureText="F5" Command="{Binding CheckForUpdatesCommand}">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="ArrowSyncCircle24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowSyncCircle24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<ui:MenuItem Header="{res:Loc Menu_RestorePoint}" Command="{Binding CreateRestorePointCommand}">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="History24" />
|
||||
<ctl:DecorativeIcon Symbol="History24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<Separator />
|
||||
<ui:MenuItem Header="{res:Loc Menu_ExportLogs}" Command="{Binding LogViewer.ExportZipCommand}">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="ArrowExportLtr24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowExportLtr24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<ui:MenuItem Header="{res:Loc Menu_OpenConfigFolder}" Command="{Binding Settings.OpenConfigFolderCommand}">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="FolderOpen24" />
|
||||
<ctl:DecorativeIcon Symbol="FolderOpen24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<ui:MenuItem Header="{res:Loc Menu_OpenLogFolder}" Command="{Binding Settings.OpenLogFolderCommand}">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="Folder24" />
|
||||
<ctl:DecorativeIcon Symbol="Folder24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<ui:MenuItem Header="{res:Loc Menu_PortableInfo}" Click="OnShowPortableInfoClick">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="Info24" />
|
||||
<ctl:DecorativeIcon Symbol="Info24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<Separator />
|
||||
<ui:MenuItem Header="{res:Loc Menu_KeyboardShortcuts}" Click="OnShowKeyboardShortcutsClick">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="Keyboard24" />
|
||||
<ctl:DecorativeIcon Symbol="Keyboard24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<ui:MenuItem Header="{res:Loc Menu_UserGuide}" Command="{Binding OpenUserGuideCommand}">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="BookOpen24" />
|
||||
<ctl:DecorativeIcon Symbol="BookOpen24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<ui:MenuItem Header="{res:Loc Menu_ReportBug}" Command="{Binding ReportBugCommand}">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="Bug24" />
|
||||
<ctl:DecorativeIcon Symbol="Bug24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<Separator />
|
||||
<ui:MenuItem Header="{res:Loc Menu_Terms}" Click="OnShowTermsClick">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="DocumentText24" />
|
||||
<ctl:DecorativeIcon Symbol="DocumentText24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
<ui:MenuItem Header="{res:Loc Menu_About}" Click="OnShowAboutClick">
|
||||
<ui:MenuItem.Icon>
|
||||
<ui:SymbolIcon Symbol="Info24" />
|
||||
<ctl:DecorativeIcon Symbol="Info24" />
|
||||
</ui:MenuItem.Icon>
|
||||
</ui:MenuItem>
|
||||
</ContextMenu>
|
||||
@@ -146,7 +151,7 @@
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsPaneToggleVisible="True"
|
||||
IsPaneOpen="{Binding IsPaneOpen, Mode=TwoWay}"
|
||||
OpenPaneLength="290"
|
||||
OpenPaneLength="{DynamicResource AppNavigationPaneWidth}"
|
||||
FrameMargin="0"
|
||||
TitleBar="{Binding ElementName=AppTitleBar, Mode=OneWay}"
|
||||
TransitionDuration="150">
|
||||
|
||||
@@ -7,9 +7,11 @@ using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shell;
|
||||
using System.Windows.Threading;
|
||||
using CommandForge.Application.Ports;
|
||||
using CommandForge.Desktop.Controls;
|
||||
using CommandForge.Desktop.Converters;
|
||||
using CommandForge.Desktop.Resources;
|
||||
using CommandForge.Desktop.Services;
|
||||
@@ -41,6 +43,9 @@ public partial class MainWindow : FluentWindow
|
||||
private readonly ShellPageProvider _pages;
|
||||
private bool _closeConfirmed;
|
||||
|
||||
// True while the pane is being synced to the view-model (not a user's choice of page).
|
||||
private bool _syncingNavigation;
|
||||
|
||||
public MainWindow(
|
||||
MainViewModel viewModel,
|
||||
IServiceProvider services,
|
||||
@@ -74,7 +79,25 @@ public partial class MainWindow : FluentWindow
|
||||
RootNavigation.SelectionChanged += OnNavigationSelectionChanged;
|
||||
viewModel.PropertyChanged += OnViewModelPropertyChanged;
|
||||
viewModel.Execution.PropertyChanged += OnExecutionPropertyChanged;
|
||||
Loaded += (_, _) => SyncNavigation(force: true);
|
||||
viewModel.CommandOpened += OnCommandOpened;
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
#if DEBUG
|
||||
// A developer's accessibility scan opens a given page without sending keys or clicks.
|
||||
if (Environment.GetEnvironmentVariable("COMMANDFORGE_START_PAGE") is { Length: > 0 } startPage)
|
||||
{
|
||||
_viewModel.Navigate(startPage);
|
||||
}
|
||||
#endif
|
||||
SyncNavigation(force: true);
|
||||
|
||||
// Start with the keyboard in the first page, not on the window frame.
|
||||
FocusPageSoon(announce: false);
|
||||
};
|
||||
|
||||
ApplyAnimationPreference();
|
||||
SystemParameters.StaticPropertyChanged += OnSystemParametersChanged;
|
||||
Closed += (_, _) => SystemParameters.StaticPropertyChanged -= OnSystemParametersChanged;
|
||||
|
||||
RestorePlacement();
|
||||
}
|
||||
@@ -83,7 +106,7 @@ public partial class MainWindow : FluentWindow
|
||||
|
||||
private void BuildNavigation()
|
||||
{
|
||||
RootNavigation.MenuItems.Add(Item("SidebarHome", SymbolRegular.Home24, NavigationKeys.Home, typeof(HomeView)));
|
||||
RootNavigation.MenuItems.Add(Item("SidebarHome", SymbolRegular.Home24, NavigationKeys.Home, typeof(HomeView), "Ctrl+H"));
|
||||
RootNavigation.MenuItems.Add(Item("SidebarFavorites", SymbolRegular.Star24, NavigationKeys.Favorites, typeof(CatalogView)));
|
||||
RootNavigation.MenuItems.Add(Item("SidebarHistory", SymbolRegular.History24, NavigationKeys.History, typeof(HistoryView)));
|
||||
RootNavigation.MenuItems.Add(Item("SidebarRecipes", SymbolRegular.TaskListSquareLtr24, NavigationKeys.Recipes, typeof(RecipesView)));
|
||||
@@ -98,21 +121,27 @@ public partial class MainWindow : FluentWindow
|
||||
|
||||
RootNavigation.MenuItems.Add(catalog);
|
||||
|
||||
RootNavigation.FooterMenuItems.Add(Item("Menu_LogViewer", SymbolRegular.DocumentText24, NavigationKeys.Logs, typeof(LogViewerView)));
|
||||
RootNavigation.FooterMenuItems.Add(Item("Menu_LogViewer", SymbolRegular.DocumentText24, NavigationKeys.Logs, typeof(LogViewerView), "Ctrl+L"));
|
||||
RootNavigation.FooterMenuItems.Add(Item("Menu_DebugPanel", SymbolRegular.Bug24, NavigationKeys.Debug, typeof(DebugView)));
|
||||
RootNavigation.FooterMenuItems.Add(Item("SidebarSettings", SymbolRegular.Settings24, NavigationKeys.Settings, typeof(SettingsView)));
|
||||
RootNavigation.FooterMenuItems.Add(Item("SidebarSettings", SymbolRegular.Settings24, NavigationKeys.Settings, typeof(SettingsView), "Ctrl+,"));
|
||||
}
|
||||
|
||||
private static NavigationViewItem Item(string titleKey, SymbolRegular icon, string key, Type pageType)
|
||||
private static NavigationViewItem Item(string titleKey, SymbolRegular icon, string key, Type pageType, string? shortcut = null)
|
||||
{
|
||||
var item = new NavigationViewItem
|
||||
{
|
||||
Icon = new SymbolIcon { Symbol = icon },
|
||||
Icon = new DecorativeIcon { Symbol = icon },
|
||||
TargetPageTag = key,
|
||||
TargetPageType = pageType,
|
||||
};
|
||||
item.SetBinding(ContentControl.ContentProperty, Localized(titleKey));
|
||||
item.SetBinding(AutomationProperties.NameProperty, Localized(titleKey));
|
||||
if (shortcut is not null)
|
||||
{
|
||||
// Screen readers announce it with the item ("Home, Ctrl+H").
|
||||
AutomationProperties.SetAcceleratorKey(item, shortcut);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@@ -122,12 +151,13 @@ public partial class MainWindow : FluentWindow
|
||||
title.SetBinding(TextBlock.TextProperty, new Binding(nameof(CategoryViewModel.Title)) { Source = category });
|
||||
|
||||
var count = new TextBlock { Text = category.Count.ToString(CultureInfo.CurrentCulture), Margin = new Thickness(8, 0, 0, 0) };
|
||||
count.SetResourceReference(TextBlock.ForegroundProperty, "TextFillColorTertiaryBrush");
|
||||
// Secondary, not tertiary: tertiary text falls below 4.5:1 in the Light theme.
|
||||
count.SetResourceReference(TextBlock.ForegroundProperty, "TextFillColorSecondaryBrush");
|
||||
|
||||
var item = new NavigationViewItem
|
||||
{
|
||||
Content = new StackPanel { Orientation = Orientation.Horizontal, Children = { title, count } },
|
||||
Icon = new SymbolIcon { Symbol = IconMap.Resolve(category.Icon) },
|
||||
Icon = new DecorativeIcon { Symbol = IconMap.Resolve(category.Icon) },
|
||||
TargetPageTag = NavigationKeys.Category(categoryId),
|
||||
TargetPageType = typeof(CatalogView),
|
||||
};
|
||||
@@ -140,9 +170,16 @@ public partial class MainWindow : FluentWindow
|
||||
|
||||
private void OnNavigationSelectionChanged(NavigationView sender, RoutedEventArgs args)
|
||||
{
|
||||
MarkCurrentPage(sender.SelectedItem as NavigationViewItem);
|
||||
if (sender.SelectedItem is NavigationViewItem { TargetPageTag: { Length: > 0 } key })
|
||||
{
|
||||
_viewModel.Navigate(key);
|
||||
|
||||
// A page chosen from the keyboard takes the keyboard with it; the pane item is left behind.
|
||||
if (!_syncingNavigation && InputManager.Current.MostRecentInputDevice is KeyboardDevice)
|
||||
{
|
||||
FocusPageSoon(announce: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +202,134 @@ public partial class MainWindow : FluentWindow
|
||||
return;
|
||||
}
|
||||
|
||||
RootNavigation.Navigate(key);
|
||||
_syncingNavigation = true;
|
||||
try
|
||||
{
|
||||
RootNavigation.Navigate(key);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_syncingNavigation = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WPF UI exposes the pane's items to screen readers without their selection state, so the
|
||||
/// current page's item says so in its status ("Settings, Current page").
|
||||
/// </summary>
|
||||
private void MarkCurrentPage(NavigationViewItem? current)
|
||||
{
|
||||
foreach (var item in RootNavigation.MenuItems.OfType<NavigationViewItem>()
|
||||
.SelectMany(i => i.MenuItems.OfType<NavigationViewItem>().Prepend(i))
|
||||
.Concat(RootNavigation.FooterMenuItems.OfType<NavigationViewItem>()))
|
||||
{
|
||||
if (ReferenceEquals(item, current))
|
||||
{
|
||||
item.SetBinding(AutomationProperties.ItemStatusProperty, Localized("A11y_CurrentPage"));
|
||||
}
|
||||
else
|
||||
{
|
||||
BindingOperations.ClearBinding(item, AutomationProperties.ItemStatusProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the keyboard into the page on screen once it is laid out, so Tab continues from there and
|
||||
/// a screen reader reads where it landed; <paramref name="announce"/> also says the page's name.
|
||||
/// </summary>
|
||||
private void FocusPageSoon(bool announce)
|
||||
=> Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () => FocusPage(announce));
|
||||
|
||||
private void FocusPage(bool announce)
|
||||
{
|
||||
if (_pages.Current is not { IsVisible: true } page)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!page.IsKeyboardFocusWithin)
|
||||
{
|
||||
page.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
|
||||
}
|
||||
|
||||
if (announce && RootNavigation.SelectedItem is NavigationViewItem item)
|
||||
{
|
||||
ScreenReader.Announce(AutomationProperties.GetName(item));
|
||||
}
|
||||
}
|
||||
|
||||
// A command opened from Home, History or the palette: the control that opened it is gone.
|
||||
private void OnCommandOpened(object? sender, EventArgs e)
|
||||
=> Dispatcher.BeginInvoke(DispatcherPriority.Loaded, () => _pages.Find<CatalogView>()?.FocusSelectedCommand());
|
||||
|
||||
/// <summary>F6 / Shift+F6: the navigation pane, the page, and the console when one is shown.</summary>
|
||||
private void CycleFocusRegion(bool backwards)
|
||||
{
|
||||
var regions = new List<FrameworkElement>(3);
|
||||
if (RootNavigation.SelectedItem is FrameworkElement selected && selected.IsVisible)
|
||||
{
|
||||
regions.Add(selected);
|
||||
}
|
||||
|
||||
if (_pages.Current is { IsVisible: true } page)
|
||||
{
|
||||
regions.Add(page);
|
||||
if (FindVisibleConsole(page) is { } console)
|
||||
{
|
||||
regions.Add(console);
|
||||
}
|
||||
}
|
||||
|
||||
if (regions.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// The console sits inside the page, so the innermost region that holds the keyboard wins.
|
||||
var current = regions.FindLastIndex(r => r.IsKeyboardFocusWithin);
|
||||
var target = regions[FocusCycle.Next(current, regions.Count, backwards)];
|
||||
if (target is NavigationViewItem)
|
||||
{
|
||||
target.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
target.MoveFocus(new TraversalRequest(FocusNavigationDirection.First));
|
||||
}
|
||||
}
|
||||
|
||||
private static ConsoleView? FindVisibleConsole(DependencyObject root)
|
||||
{
|
||||
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(root); i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(root, i);
|
||||
if (child is ConsoleView { IsVisible: true } console)
|
||||
{
|
||||
return console;
|
||||
}
|
||||
|
||||
if (FindVisibleConsole(child) is { } nested)
|
||||
{
|
||||
return nested;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// ===== Animations =====
|
||||
|
||||
/// <summary>Page transitions follow Windows' "Animation effects" setting (off: pages switch instantly).</summary>
|
||||
private void ApplyAnimationPreference()
|
||||
=> RootNavigation.TransitionDuration = SystemParameters.ClientAreaAnimation ? 150 : 0;
|
||||
|
||||
private void OnSystemParametersChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(SystemParameters.ClientAreaAnimation))
|
||||
{
|
||||
Dispatcher.InvokeAsync(ApplyAnimationPreference);
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Keyboard =====
|
||||
@@ -185,6 +349,13 @@ public partial class MainWindow : FluentWindow
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Key == Key.F6 && Keyboard.Modifiers is ModifierKeys.None or ModifierKeys.Shift)
|
||||
{
|
||||
CycleFocusRegion(backwards: Keyboard.Modifiers == ModifierKeys.Shift);
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Exactly Ctrl: AltGr arrives as Ctrl+Alt, so a German "@" (AltGr+Q) must not quit the app
|
||||
// and a Polish "ł" (AltGr+L) must not open the Log Viewer.
|
||||
if (Keyboard.Modifiers != ModifierKeys.Control)
|
||||
@@ -202,17 +373,26 @@ public partial class MainWindow : FluentWindow
|
||||
break;
|
||||
case Key.OemComma:
|
||||
_viewModel.ShowSettingsCommand.Execute(null);
|
||||
FocusPageSoon(announce: true);
|
||||
break;
|
||||
case Key.L:
|
||||
_viewModel.ShowLogViewerCommand.Execute(null);
|
||||
FocusPageSoon(announce: true);
|
||||
break;
|
||||
case Key.H:
|
||||
_viewModel.ShowHomeCommand.Execute(null);
|
||||
FocusPageSoon(announce: true);
|
||||
break;
|
||||
case Key.B:
|
||||
_viewModel.ToggleSidebarCommand.Execute(null);
|
||||
break;
|
||||
case Key.Q:
|
||||
// Not while something is being typed: a slip would discard it (search boxes opt in).
|
||||
if (!Behaviors.ShortcutScope.CanExitFrom(Keyboard.FocusedElement))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Close();
|
||||
break;
|
||||
default:
|
||||
@@ -312,7 +492,8 @@ public partial class MainWindow : FluentWindow
|
||||
CultureInfo.CurrentCulture,
|
||||
Strings.Get(execution.Success ? "Run_Finished" : "Run_FinishedFailed"),
|
||||
execution.LastRunTitle);
|
||||
_notifications.Show(message, execution.Success ? NotificationKind.Success : NotificationKind.Error);
|
||||
// Shown only: the execution view model has already read the result to screen readers.
|
||||
_notifications.Show(message, execution.Success ? NotificationKind.Success : NotificationKind.Error, announce: false);
|
||||
|
||||
if (!IsActive)
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
xmlns:views="clr-namespace:CommandForge.Desktop.Views"
|
||||
@@ -10,6 +11,9 @@
|
||||
<conv:IconNameToSymbolConverter x:Key="IconConverter" />
|
||||
<conv:DangerLevelToTextConverter x:Key="DangerText" />
|
||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||
<conv:RowActionNameConverter x:Key="RowActionMoveUp" LabelKey="Recipes_MoveUp" />
|
||||
<conv:RowActionNameConverter x:Key="RowActionMoveDown" LabelKey="Recipes_MoveDown" />
|
||||
<conv:RowActionNameConverter x:Key="RowActionRemove" LabelKey="Recipes_RemoveStep" />
|
||||
|
||||
<!-- One recipe step: icon, title, risk dot, reorder/remove. -->
|
||||
<DataTemplate x:Key="StepItem">
|
||||
@@ -20,29 +24,30 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:SymbolIcon Grid.Column="0" Symbol="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
<ctl:DecorativeIcon Grid.Column="0" Symbol="{Binding Icon, Converter={StaticResource IconConverter}}"
|
||||
FontSize="18" VerticalAlignment="Center" Margin="2,0,10,0" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Title}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Title}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"
|
||||
ToolTip="{Binding Title}" />
|
||||
<Ellipse Grid.Column="2" Style="{StaticResource DangerDotStyle}" Margin="8,0"
|
||||
ToolTip="{Binding DangerLevel, Converter={StaticResource DangerText}}" />
|
||||
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" ToolTip="{res:Loc Recipes_MoveUp}"
|
||||
AutomationProperties.Name="{res:Loc Recipes_MoveUp}"
|
||||
AutomationProperties.Name="{Binding Title, Converter={StaticResource RowActionMoveUp}}"
|
||||
Command="{Binding DataContext.MoveStepUpCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}">
|
||||
<ui:SymbolIcon Symbol="ArrowUp24" FontSize="15" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowUp24" FontSize="15" />
|
||||
</ui:Button>
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" ToolTip="{res:Loc Recipes_MoveDown}"
|
||||
AutomationProperties.Name="{res:Loc Recipes_MoveDown}"
|
||||
AutomationProperties.Name="{Binding Title, Converter={StaticResource RowActionMoveDown}}"
|
||||
Command="{Binding DataContext.MoveStepDownCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}">
|
||||
<ui:SymbolIcon Symbol="ArrowDown24" FontSize="15" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowDown24" FontSize="15" />
|
||||
</ui:Button>
|
||||
<ui:Button Style="{StaticResource IconButtonStyle}" ToolTip="{res:Loc Recipes_RemoveStep}"
|
||||
AutomationProperties.Name="{res:Loc Recipes_RemoveStep}"
|
||||
AutomationProperties.Name="{Binding Title, Converter={StaticResource RowActionRemove}}"
|
||||
Command="{Binding DataContext.RemoveStepCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
CommandParameter="{Binding}">
|
||||
<ui:SymbolIcon Symbol="Dismiss24" FontSize="15" />
|
||||
<ctl:DecorativeIcon Symbol="Dismiss24" FontSize="15" />
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -58,8 +63,9 @@
|
||||
<TextBlock Grid.Row="0" Text="{res:Loc SidebarRecipes}" Style="{StaticResource PageTitleTextStyle}" Margin="0,0,0,12" />
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<!-- The list grows with its longest name (large text sizes), within bounds. -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="240" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="240" MaxWidth="420" />
|
||||
<ColumnDefinition Width="*" MinWidth="380" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
@@ -70,12 +76,12 @@
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="0,8,0,0">
|
||||
<ui:Button Content="{res:Loc Recipes_New}" Command="{Binding NewRecipeCommand}" Margin="0,0,8,0">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Add24" />
|
||||
<ctl:DecorativeIcon Symbol="Add24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<ui:Button Content="{res:Loc Recipe_Delete}" Command="{Binding DeleteRecipeCommand}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Delete24" />
|
||||
<ctl:DecorativeIcon Symbol="Delete24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
@@ -106,10 +112,18 @@
|
||||
<!-- Steps -->
|
||||
<ui:Card Grid.Row="2" Padding="8" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch">
|
||||
<Grid>
|
||||
<ItemsControl ItemsSource="{Binding Steps}" ItemTemplate="{StaticResource StepItem}">
|
||||
<ItemsControl ItemsSource="{Binding Steps}" ItemTemplate="{StaticResource StepItem}"
|
||||
AutomationProperties.Name="{res:Loc A11y_RecipeSteps}">
|
||||
<!-- Each step is read by its title and risk (the dot alone is color). -->
|
||||
<ItemsControl.ItemContainerStyle>
|
||||
<Style TargetType="ContentPresenter">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="AutomationProperties.ItemStatus" Value="{Binding AccessibleStatus}" />
|
||||
</Style>
|
||||
</ItemsControl.ItemContainerStyle>
|
||||
<ItemsControl.Template>
|
||||
<ControlTemplate TargetType="ItemsControl">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Focusable="False">
|
||||
<ItemsPresenter />
|
||||
</ScrollViewer>
|
||||
</ControlTemplate>
|
||||
@@ -135,26 +149,34 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<TextBlock Text="{res:Loc Recipes_AddHint}" VerticalAlignment="Center" Margin="0,0,8,0" />
|
||||
<ComboBox Width="260" VerticalAlignment="Center"
|
||||
<ComboBox MinWidth="260" MaxWidth="420" VerticalAlignment="Center"
|
||||
ItemsSource="{Binding AllCommands}" SelectedItem="{Binding CommandToAdd}"
|
||||
DisplayMemberPath="Title" IsTextSearchEnabled="True"
|
||||
AutomationProperties.Name="{res:Loc Recipes_AddHint}"
|
||||
ToolTip="{res:Loc Recipes_AddHint}" />
|
||||
ToolTip="{res:Loc Recipes_AddHint}">
|
||||
<!-- Without this each option is read as its view-model's type name. -->
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Title}" />
|
||||
<Setter Property="AutomationProperties.ItemStatus" Value="{Binding AccessibleStatus}" />
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
<ui:Button Content="{res:Loc Recipes_AddStep}" Command="{Binding AddStepCommand}" Margin="8,0,0,0">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Add24" />
|
||||
<ctl:DecorativeIcon Symbol="Add24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<ui:Button Content="{res:Loc Recipes_Save}" Command="{Binding SaveRecipeCommand}" Margin="8,0,0,0">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Save24" />
|
||||
<ctl:DecorativeIcon Symbol="Save24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<ui:Button Content="{res:Loc Recipes_Run}" Command="{Binding RunRecipeCommand}" Appearance="Primary" Margin="8,0,0,0">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Play24" />
|
||||
<ctl:DecorativeIcon Symbol="Play24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
|
||||
@@ -1,9 +1,41 @@
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Controls;
|
||||
using CommandForge.Desktop.Services;
|
||||
using CommandForge.Desktop.ViewModels;
|
||||
|
||||
namespace CommandForge.Desktop.Views;
|
||||
|
||||
/// <summary>The recipes view (build/run command chains).</summary>
|
||||
public partial class RecipesView : UserControl
|
||||
{
|
||||
public RecipesView() => InitializeComponent();
|
||||
private RecipesViewModel? _viewModel;
|
||||
|
||||
public RecipesView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContextChanged += (_, _) => Attach(DataContext as RecipesViewModel);
|
||||
}
|
||||
|
||||
private void Attach(RecipesViewModel? viewModel)
|
||||
{
|
||||
if (_viewModel is not null)
|
||||
{
|
||||
_viewModel.PropertyChanged -= OnViewModelPropertyChanged;
|
||||
}
|
||||
|
||||
_viewModel = viewModel;
|
||||
if (_viewModel is not null)
|
||||
{
|
||||
_viewModel.PropertyChanged += OnViewModelPropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
// The warning bar above the steps appears silently otherwise.
|
||||
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(RecipesViewModel.UnavailableStepsNotice) && IsVisible)
|
||||
{
|
||||
ScreenReader.Announce(_viewModel?.UnavailableStepsNotice);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,17 @@
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}">
|
||||
<UserControl.Resources>
|
||||
<conv:EnumToBooleanConverter x:Key="EnumBool" />
|
||||
|
||||
<!-- Spacing between the setting cards of one group. -->
|
||||
<!-- Spacing between the setting cards of one group. A card is a frame, not a control: Tab goes
|
||||
to the switch, list or button inside it (WPF-UI's card would otherwise be a nameless stop). -->
|
||||
<Style TargetType="ui:CardControl" BasedOn="{StaticResource {x:Type ui:CardControl}}">
|
||||
<Setter Property="Margin" Value="0,0,0,4" />
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
</Style>
|
||||
<Style TargetType="ui:CardExpander" BasedOn="{StaticResource {x:Type ui:CardExpander}}">
|
||||
<Setter Property="Margin" Value="0,0,0,4" />
|
||||
@@ -25,16 +29,17 @@
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<!-- Not a Tab stop of its own: the arrow and page keys scroll it from any control on the page. -->
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" Focusable="False">
|
||||
<StackPanel Margin="24,12,24,24" MaxWidth="1000">
|
||||
<TextBlock Text="{res:Loc SidebarSettings}" Style="{StaticResource PageTitleTextStyle}" />
|
||||
|
||||
<!-- ===== Appearance ===== -->
|
||||
<TextBlock Text="{res:Loc Settings_Appearance}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_Theme}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="DarkTheme24" />
|
||||
<ctl:DecorativeIcon Symbol="DarkTheme24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -42,19 +47,19 @@
|
||||
<TextBlock Text="{res:Loc Settings_ThemeDesc}" Style="{StaticResource CardDescriptionStyle}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ctl:LabeledGroup Orientation="Horizontal" AutomationProperties.Name="{res:Loc Settings_Theme}">
|
||||
<RadioButton Content="{res:Loc Settings_ThemeSystem}" GroupName="Theme" Margin="0,0,12,0" MinWidth="0"
|
||||
IsChecked="{Binding SelectedTheme, Converter={StaticResource EnumBool}, ConverterParameter=System}" />
|
||||
<RadioButton Content="{res:Loc Settings_ThemeLight}" GroupName="Theme" Margin="0,0,12,0" MinWidth="0"
|
||||
IsChecked="{Binding SelectedTheme, Converter={StaticResource EnumBool}, ConverterParameter=Light}" />
|
||||
<RadioButton Content="{res:Loc Settings_ThemeDark}" GroupName="Theme" MinWidth="0"
|
||||
IsChecked="{Binding SelectedTheme, Converter={StaticResource EnumBool}, ConverterParameter=Dark}" />
|
||||
</StackPanel>
|
||||
</ctl:LabeledGroup>
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_Language}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="LocalLanguage24" />
|
||||
<ctl:DecorativeIcon Symbol="LocalLanguage24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -63,12 +68,18 @@
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ComboBox MinWidth="200" ItemsSource="{Binding Languages}" DisplayMemberPath="DisplayName"
|
||||
SelectedItem="{Binding SelectedLanguage}" AutomationProperties.Name="{res:Loc Settings_Language}" />
|
||||
SelectedItem="{Binding SelectedLanguage}" AutomationProperties.Name="{res:Loc Settings_Language}">
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding DisplayName}" />
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_FontSize}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="TextFontSize24" />
|
||||
<ctl:DecorativeIcon Symbol="TextFontSize24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -76,19 +87,19 @@
|
||||
<TextBlock Text="{res:Loc Settings_FontSizeDesc}" Style="{StaticResource CardDescriptionStyle}" />
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ctl:LabeledGroup Orientation="Horizontal" AutomationProperties.Name="{res:Loc Settings_FontSize}">
|
||||
<RadioButton Content="{res:Loc Settings_FontSmall}" GroupName="Font" Margin="0,0,12,0" MinWidth="0"
|
||||
IsChecked="{Binding SelectedFontSize, Converter={StaticResource EnumBool}, ConverterParameter=Small}" />
|
||||
<RadioButton Content="{res:Loc Settings_FontMedium}" GroupName="Font" Margin="0,0,12,0" MinWidth="0"
|
||||
IsChecked="{Binding SelectedFontSize, Converter={StaticResource EnumBool}, ConverterParameter=Medium}" />
|
||||
<RadioButton Content="{res:Loc Settings_FontLarge}" GroupName="Font" MinWidth="0"
|
||||
IsChecked="{Binding SelectedFontSize, Converter={StaticResource EnumBool}, ConverterParameter=Large}" />
|
||||
</StackPanel>
|
||||
</ctl:LabeledGroup>
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_CollapseSidebar}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="PanelLeft24" />
|
||||
<ctl:DecorativeIcon Symbol="PanelLeft24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -99,9 +110,9 @@
|
||||
<ui:ToggleSwitch IsChecked="{Binding CollapseSidebarByDefault}" AutomationProperties.Name="{res:Loc Settings_CollapseSidebar}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_ShowBadges}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="Shield24" />
|
||||
<ctl:DecorativeIcon Symbol="Shield24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -115,9 +126,9 @@
|
||||
<!-- ===== Behavior & safety ===== -->
|
||||
<TextBlock Text="{res:Loc Settings_Behavior}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_ConfirmCaution}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="Warning24" />
|
||||
<ctl:DecorativeIcon Symbol="Warning24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -129,9 +140,9 @@
|
||||
</ui:CardControl>
|
||||
|
||||
<!-- A fixed safety floor (golden rule #8): shown on and locked, at full contrast rather than greyed out. -->
|
||||
<ui:CardControl ToolTip="{res:Loc Settings_DangerousLockedTooltip}">
|
||||
<ui:CardControl ToolTip="{res:Loc Settings_DangerousLockedTooltip}" AutomationProperties.Name="{res:Loc Settings_ConfirmDangerous}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="LockClosed24" />
|
||||
<ctl:DecorativeIcon Symbol="LockClosed24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -144,9 +155,9 @@
|
||||
AutomationProperties.HelpText="{res:Loc Settings_DangerousLockedTooltip}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_AutoRestorePoint}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="History24" />
|
||||
<ctl:DecorativeIcon Symbol="History24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -157,9 +168,9 @@
|
||||
<ui:ToggleSwitch IsChecked="{Binding AutoCreateRestorePoint}" AutomationProperties.Name="{res:Loc Settings_AutoRestorePoint}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_AutoScroll}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="ArrowAutofitDown24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowAutofitDown24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -170,9 +181,9 @@
|
||||
<ui:ToggleSwitch IsChecked="{Binding AutoScrollConsole}" AutomationProperties.Name="{res:Loc Settings_AutoScroll}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_WarnOnCancel}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="Dismiss24" />
|
||||
<ctl:DecorativeIcon Symbol="Dismiss24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -186,9 +197,9 @@
|
||||
<!-- ===== Updates ===== -->
|
||||
<TextBlock Text="{res:Loc Settings_Updates}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_AutoCheckUpdates}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="ArrowSyncCircle24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowSyncCircle24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -199,9 +210,9 @@
|
||||
<ui:ToggleSwitch IsChecked="{Binding AutoCheckForUpdates}" AutomationProperties.Name="{res:Loc Settings_AutoCheckUpdates}" />
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_CurrentVersion}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="Info24" />
|
||||
<ctl:DecorativeIcon Symbol="Info24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -219,9 +230,9 @@
|
||||
<!-- ===== Backup & profiles ===== -->
|
||||
<TextBlock Text="{res:Loc Settings_Profiles}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_ExportImport}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="ArrowExportLtr24" />
|
||||
<ctl:DecorativeIcon Symbol="ArrowExportLtr24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -235,9 +246,9 @@
|
||||
</StackPanel>
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardExpander>
|
||||
<ui:CardExpander AutomationProperties.Name="{res:Loc Settings_SavedProfiles}">
|
||||
<ui:CardExpander.Icon>
|
||||
<ui:SymbolIcon Symbol="PeopleSettings24" />
|
||||
<ctl:DecorativeIcon Symbol="PeopleSettings24" />
|
||||
</ui:CardExpander.Icon>
|
||||
<ui:CardExpander.Header>
|
||||
<StackPanel>
|
||||
@@ -266,9 +277,9 @@
|
||||
<!-- ===== Logs ===== -->
|
||||
<TextBlock Text="{res:Loc Settings_Logs}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_LogLevel}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="DocumentText24" />
|
||||
<ctl:DecorativeIcon Symbol="DocumentText24" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
@@ -277,12 +288,23 @@
|
||||
</StackPanel>
|
||||
</ui:CardControl.Header>
|
||||
<ComboBox MinWidth="160" ItemsSource="{Binding LogLevels}" SelectedItem="{Binding SelectedLogLevel}"
|
||||
AutomationProperties.Name="{res:Loc Settings_LogLevel}" />
|
||||
AutomationProperties.Name="{res:Loc Settings_LogLevel}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={conv:LogLevelToTextConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
<ComboBox.ItemContainerStyle>
|
||||
<Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Converter={conv:LogLevelToTextConverter}}" />
|
||||
</Style>
|
||||
</ComboBox.ItemContainerStyle>
|
||||
</ComboBox>
|
||||
</ui:CardControl>
|
||||
|
||||
<ui:CardExpander>
|
||||
<ui:CardExpander AutomationProperties.Name="{res:Loc Settings_LogsSize}">
|
||||
<ui:CardExpander.Icon>
|
||||
<ui:SymbolIcon Symbol="Folder24" />
|
||||
<ctl:DecorativeIcon Symbol="Folder24" />
|
||||
</ui:CardExpander.Icon>
|
||||
<ui:CardExpander.Header>
|
||||
<StackPanel>
|
||||
@@ -300,9 +322,9 @@
|
||||
<!-- ===== Advanced ===== -->
|
||||
<TextBlock Text="{res:Loc Settings_Advanced}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
|
||||
<ui:CardExpander>
|
||||
<ui:CardExpander AutomationProperties.Name="{res:Loc Settings_RunMode}">
|
||||
<ui:CardExpander.Icon>
|
||||
<ui:SymbolIcon Symbol="Wrench24" />
|
||||
<ctl:DecorativeIcon Symbol="Wrench24" />
|
||||
</ui:CardExpander.Icon>
|
||||
<ui:CardExpander.Header>
|
||||
<StackPanel>
|
||||
@@ -329,9 +351,9 @@
|
||||
<!-- ===== About ===== -->
|
||||
<TextBlock Text="{res:Loc Settings_About}" Style="{StaticResource SectionHeaderTextStyle}" />
|
||||
|
||||
<ui:CardControl>
|
||||
<ui:CardControl AutomationProperties.Name="{res:Loc Settings_About}">
|
||||
<ui:CardControl.Icon>
|
||||
<ui:SymbolIcon Symbol="WindowConsole20" />
|
||||
<ctl:DecorativeIcon Symbol="WindowConsole20" />
|
||||
</ui:CardControl.Icon>
|
||||
<ui:CardControl.Header>
|
||||
<StackPanel>
|
||||
|
||||
@@ -24,20 +24,22 @@ internal sealed class ShellPageProvider : INavigationViewPageProvider
|
||||
public object? GetPage(Type pageType)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(pageType);
|
||||
if (_pages.TryGetValue(pageType, out var page))
|
||||
if (!_pages.TryGetValue(pageType, out var page))
|
||||
{
|
||||
return page;
|
||||
}
|
||||
|
||||
page = Create(pageType);
|
||||
if (page is not null)
|
||||
{
|
||||
_pages[pageType] = page;
|
||||
page = Create(pageType);
|
||||
if (page is not null)
|
||||
{
|
||||
_pages[pageType] = page;
|
||||
}
|
||||
}
|
||||
|
||||
Current = page;
|
||||
return page;
|
||||
}
|
||||
|
||||
/// <summary>The page most recently handed to the navigation view (the one on screen).</summary>
|
||||
public FrameworkElement? Current { get; private set; }
|
||||
|
||||
/// <summary>The page already created for <typeparamref name="TPage"/>, if any.</summary>
|
||||
public TPage? Find<TPage>()
|
||||
where TPage : FrameworkElement
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
Title="{res:Loc Update_Title}"
|
||||
CloseButtonText="{res:Loc Update_Close}"
|
||||
@@ -22,14 +23,14 @@
|
||||
|
||||
<!-- Up to date -->
|
||||
<DockPanel Visibility="{Binding IsUpToDate, Converter={StaticResource BoolToVis}}">
|
||||
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="CheckmarkCircle24" FontSize="22" Margin="0,0,10,0"
|
||||
<ctl:DecorativeIcon DockPanel.Dock="Left" Symbol="CheckmarkCircle24" FontSize="22" Margin="0,0,10,0"
|
||||
Foreground="{DynamicResource SystemFillColorSuccessBrush}" VerticalAlignment="Top" />
|
||||
<TextBlock Text="{Binding Message}" TextWrapping="Wrap" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- Update available -->
|
||||
<DockPanel Visibility="{Binding IsAvailable, Converter={StaticResource BoolToVis}}">
|
||||
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="ArrowDownload24" FontSize="22" Margin="0,0,10,0"
|
||||
<ctl:DecorativeIcon DockPanel.Dock="Left" Symbol="ArrowDownload24" FontSize="22" Margin="0,0,10,0"
|
||||
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}" VerticalAlignment="Top" />
|
||||
<TextBlock Text="{Binding Message}" TextWrapping="Wrap" />
|
||||
</DockPanel>
|
||||
@@ -44,7 +45,7 @@
|
||||
|
||||
<!-- Error -->
|
||||
<DockPanel Visibility="{Binding IsError, Converter={StaticResource BoolToVis}}">
|
||||
<ui:SymbolIcon DockPanel.Dock="Left" Symbol="ErrorCircle24" FontSize="22" Margin="0,0,10,0"
|
||||
<ctl:DecorativeIcon DockPanel.Dock="Left" Symbol="ErrorCircle24" FontSize="22" Margin="0,0,10,0"
|
||||
Foreground="{DynamicResource SystemFillColorCriticalBrush}" VerticalAlignment="Top" />
|
||||
<TextBlock Text="{Binding Message}" TextWrapping="Wrap" />
|
||||
</DockPanel>
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using CommandForge.Desktop.Resources;
|
||||
using CommandForge.Desktop.Services;
|
||||
using CommandForge.Desktop.ViewModels;
|
||||
using Wpf.Ui.Controls;
|
||||
|
||||
namespace CommandForge.Desktop.Views;
|
||||
|
||||
/// <summary>In-window "Check for updates" dialog (check → download → apply & restart).</summary>
|
||||
/// <summary>
|
||||
/// In-window "Check for updates" dialog (check → download → apply & restart). Each state's text is
|
||||
/// also read to screen readers, and the download's progress every quarter.
|
||||
/// </summary>
|
||||
public partial class UpdateDialog : ContentDialog
|
||||
{
|
||||
private readonly UpdateViewModel _viewModel;
|
||||
private int _announcedPercent;
|
||||
|
||||
public UpdateDialog(UpdateViewModel viewModel)
|
||||
{
|
||||
@@ -18,12 +26,20 @@ public partial class UpdateDialog : ContentDialog
|
||||
_viewModel = viewModel;
|
||||
DataContext = viewModel;
|
||||
viewModel.CloseRequested += () => Hide(ContentDialogResult.None);
|
||||
viewModel.PropertyChanged += OnViewModelPropertyChanged;
|
||||
|
||||
// Closing in any way (Close, Esc) must stop a download too; otherwise it would finish in the
|
||||
// background and restart the app, possibly in the middle of a command.
|
||||
Closing += (_, _) => viewModel.CancelPending();
|
||||
Closing += (_, _) =>
|
||||
{
|
||||
viewModel.PropertyChanged -= OnViewModelPropertyChanged;
|
||||
viewModel.CancelPending();
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Pure: whether going from <paramref name="previous"/>% to <paramref name="current"/>% crosses a quarter worth saying.</summary>
|
||||
public static bool CrossesQuarter(int previous, int current) => current / 25 > previous / 25;
|
||||
|
||||
protected override void OnButtonClick(ContentDialogButton button)
|
||||
{
|
||||
if (button == ContentDialogButton.Primary)
|
||||
@@ -35,4 +51,24 @@ public partial class UpdateDialog : ContentDialog
|
||||
|
||||
base.OnButtonClick(button);
|
||||
}
|
||||
|
||||
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
case nameof(UpdateViewModel.Message) when !string.IsNullOrWhiteSpace(_viewModel.Message):
|
||||
ScreenReader.Announce(_viewModel.Message, important: _viewModel.IsError);
|
||||
break;
|
||||
case nameof(UpdateViewModel.IsDownloading) when _viewModel.IsDownloading:
|
||||
_announcedPercent = 0;
|
||||
ScreenReader.Announce(Strings.Get("Update_Downloading"));
|
||||
break;
|
||||
case nameof(UpdateViewModel.Percent) when CrossesQuarter(_announcedPercent, _viewModel.Percent):
|
||||
_announcedPercent = _viewModel.Percent;
|
||||
ScreenReader.Announce(string.Format(CultureInfo.CurrentCulture, Strings.Get("A11y_Percent"), _viewModel.Percent));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:ctl="clr-namespace:CommandForge.Desktop.Controls"
|
||||
xmlns:res="clr-namespace:CommandForge.Desktop.Resources"
|
||||
xmlns:conv="clr-namespace:CommandForge.Desktop.Converters"
|
||||
xmlns:views="clr-namespace:CommandForge.Desktop.Views"
|
||||
@@ -26,8 +27,9 @@
|
||||
<ui:InfoBar Grid.Row="1" Title="{res:Loc UserCmd_Warning}" Severity="Warning" IsOpen="True" IsClosable="False" Margin="0,0,0,12" />
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<!-- The list grows with its longest name (large text sizes), within bounds. -->
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="240" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="240" MaxWidth="420" />
|
||||
<ColumnDefinition Width="*" MinWidth="360" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
@@ -38,19 +40,26 @@
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" Margin="0,8,0,0">
|
||||
<ui:Button Content="{res:Loc UserCmd_New}" Command="{Binding NewCommand}" Margin="0,0,8,0">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Add24" />
|
||||
<ctl:DecorativeIcon Symbol="Add24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<ui:Button Content="{res:Loc UserCmd_Delete}" Command="{Binding DeleteCommand}">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Delete24" />
|
||||
<ctl:DecorativeIcon Symbol="Delete24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
<Grid>
|
||||
<ListBox ItemsSource="{Binding Commands}" SelectedItem="{Binding SelectedCommand}"
|
||||
DisplayMemberPath="Name" Background="Transparent" BorderThickness="0"
|
||||
AutomationProperties.Name="{res:Loc UserCmd_Saved}" />
|
||||
AutomationProperties.Name="{res:Loc UserCmd_Saved}">
|
||||
<!-- Without this each command is read as its record (id, executable, arguments). -->
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
||||
<Setter Property="AutomationProperties.Name" Value="{Binding Name}" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
</ListBox>
|
||||
<TextBlock Text="{res:Loc UserCmd_NoCommands}" Style="{StaticResource SecondaryTextStyle}" Margin="6,8"
|
||||
VerticalAlignment="Top" Visibility="{Binding Commands.Count, Converter={conv:ZeroToVisibleConverter}}" />
|
||||
</Grid>
|
||||
@@ -81,12 +90,12 @@
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0,16,0,0">
|
||||
<ui:Button Content="{res:Loc UserCmd_Save}" Command="{Binding SaveCommand}" Margin="0,0,8,0">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Save24" />
|
||||
<ctl:DecorativeIcon Symbol="Save24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
<ui:Button Content="{res:Loc UserCmd_Run}" Command="{Binding RunCommand}" Appearance="Primary">
|
||||
<ui:Button.Icon>
|
||||
<ui:SymbolIcon Symbol="Play24" />
|
||||
<ctl:DecorativeIcon Symbol="Play24" />
|
||||
</ui:Button.Icon>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using CommandForge.Application;
|
||||
|
||||
namespace CommandForge.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// ACCESSIBILITY.md is what a person who has just met a barrier reads: it states a goal and never a
|
||||
/// conformance claim, every link in it works, and it gives a way to report a barrier.
|
||||
/// </summary>
|
||||
public sealed partial class AccessibilityDocumentTests
|
||||
{
|
||||
private static readonly string Root = FindRepositoryRoot();
|
||||
private static readonly string Statement = File.ReadAllText(Path.Combine(Root, "ACCESSIBILITY.md"));
|
||||
|
||||
[Fact]
|
||||
public void ItStatesAGoalAndNeverAConformanceClaim()
|
||||
{
|
||||
Assert.Contains("WCAG 2.2", Statement, StringComparison.Ordinal);
|
||||
Assert.Contains("not a claim", Statement, StringComparison.Ordinal);
|
||||
Assert.DoesNotMatch(ConformanceClaim(), Statement);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EveryRepositoryLinkNamesAFileThatExists()
|
||||
{
|
||||
var broken = MarkdownLink().Matches(Statement)
|
||||
.Select(match => match.Groups["target"].Value)
|
||||
.Where(target => !target.Contains("://", StringComparison.Ordinal) && !target.StartsWith("mailto:", StringComparison.Ordinal) && !target.StartsWith('#'))
|
||||
.Select(target => target.Split('#')[0])
|
||||
.Where(path => !File.Exists(Path.Combine(Root, path)))
|
||||
.ToList();
|
||||
|
||||
Assert.True(broken.Count == 0, "Links to missing files: " + string.Join(", ", broken));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ABarrierHasAFormAndAnAddress()
|
||||
{
|
||||
Assert.Contains("issues/new?template=accessibility.yml", Statement, StringComparison.Ordinal);
|
||||
Assert.True(File.Exists(Path.Combine(Root, ".github", "ISSUE_TEMPLATE", "accessibility.yml")));
|
||||
Assert.Contains(ProductLinks.AccessibilityEmail, Statement, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private static string FindRepositoryRoot()
|
||||
{
|
||||
for (var directory = new DirectoryInfo(AppContext.BaseDirectory); directory is not null; directory = directory.Parent)
|
||||
{
|
||||
if (File.Exists(Path.Combine(directory.FullName, "CommandForge.slnx")))
|
||||
{
|
||||
return directory.FullName;
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException("Could not find the repository root (CommandForge.slnx) above " + AppContext.BaseDirectory);
|
||||
}
|
||||
|
||||
// A sentence that would claim conformance rather than state a goal.
|
||||
[GeneratedRegex(@"\bCommandForge (?:conforms|complies|meets WCAG|is (?:fully )?(?:accessible|compliant|conformant))", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 2000)]
|
||||
private static partial Regex ConformanceClaim();
|
||||
|
||||
[GeneratedRegex(@"\]\((?<target>[^)\s]+)\)", RegexOptions.CultureInvariant, matchTimeoutMilliseconds: 2000)]
|
||||
private static partial Regex MarkdownLink();
|
||||
}
|
||||
Loaded 100 of 110 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user