Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0edcbacbd5 | ||
|
|
a1570a9ec2
|
||
|
|
92ee2f82c8
|
||
|
|
adc7febca3
|
||
|
|
2bcd61484d | ||
|
|
7ba2d69214 | ||
|
|
e8671d8f0a
|
||
|
|
8065b091df
|
||
|
|
238a68763e
|
||
|
|
1a6ed965a5
|
||
|
|
c227fcf673 | ||
|
|
e39e613cf7
|
||
|
|
ac378452a8 | ||
|
|
280253c3ba | ||
|
|
abb6b4ae20 | ||
|
|
6db1b4c2a1 |
No files matched your search
@@ -10,7 +10,7 @@
|
||||
"rollForward": false
|
||||
},
|
||||
"jetbrains.resharper.globaltools": {
|
||||
"version": "2026.2.3.1",
|
||||
"version": "2026.2.4",
|
||||
"commands": [
|
||||
"jb"
|
||||
],
|
||||
@@ -31,7 +31,7 @@
|
||||
"rollForward": false
|
||||
},
|
||||
"dotnet-reportgenerator-globaltool": {
|
||||
"version": "5.5.11",
|
||||
"version": "5.5.12",
|
||||
"commands": [
|
||||
"reportgenerator"
|
||||
],
|
||||
@@ -45,4 +45,4 @@
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
name: Accessibility Barrier
|
||||
description: Something in AutoClick or its documentation is hard or impossible to use with a keyboard, a screen reader, a contrast theme, scaling or other assistive technology.
|
||||
title: "[Accessibility]: "
|
||||
labels: ["accessibility"]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for telling us. Accessibility barriers are triaged before other bugs; see the [Accessibility statement](https://github.com/poli0981/autoclick/blob/master/docs/ACCESSIBILITY.md) for what is already known and how we respond.
|
||||
|
||||
You never need to explain a disability or share personal information. Only the first three fields are required; fill in what you can. You may also write in your own words instead of using the fields.
|
||||
|
||||
- type: textarea
|
||||
id: barrier
|
||||
attributes:
|
||||
label: What were you trying to do, and what went wrong?
|
||||
description: The task, and where it failed or became hard.
|
||||
placeholder: |
|
||||
I tried to add a step with the keyboard only.
|
||||
After pressing Add step, ... happened.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: Steps to reproduce
|
||||
placeholder: |
|
||||
1. Open the Queue page
|
||||
2. Press Tab until ...
|
||||
3. ...
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: What did you expect instead?
|
||||
placeholder: "Narrator reads the name of the button / the focus moves to ..."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: severity
|
||||
attributes:
|
||||
label: How much does it affect you?
|
||||
description: The levels are explained in the Accessibility statement.
|
||||
options:
|
||||
- "Critical: I cannot do the task at all"
|
||||
- "Serious: very hard, but I found a workaround"
|
||||
- "Moderate: annoying or inconsistent"
|
||||
- "Minor: little effect"
|
||||
- "Not sure"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: assistive-technology
|
||||
attributes:
|
||||
label: Assistive technology and version
|
||||
description: For example Narrator, NVDA 2026.2, JAWS 2026, Magnifier, Voice Access, a switch device, or "none".
|
||||
placeholder: "Narrator (Windows 11 24H2)"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: input
|
||||
attributes:
|
||||
label: How do you use the computer?
|
||||
description: Select all that apply.
|
||||
options:
|
||||
- label: Keyboard only
|
||||
- label: Screen reader
|
||||
- label: Screen magnifier or large display scaling
|
||||
- label: Contrast theme or the High contrast theme
|
||||
- label: Speech or voice control
|
||||
- label: Switch or other alternative input
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: AutoClick version
|
||||
description: Shown on the About page.
|
||||
placeholder: "2.1.0"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: os-version
|
||||
attributes:
|
||||
label: Windows version
|
||||
description: Settings > System > About.
|
||||
placeholder: "Windows 11 Pro 24H2 (Build 26100.1234)"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: display
|
||||
attributes:
|
||||
label: Theme and display
|
||||
description: AutoClick theme, Windows contrast theme, display scale, text size, animation effects (whatever seems related).
|
||||
placeholder: "AutoClick theme: Use Windows setting; Windows: Night sky contrast theme, 150% scale"
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: recording
|
||||
attributes:
|
||||
label: Recording or screenshot
|
||||
description: Optional. A screen recording with the screen reader's speech helps a lot. Window titles in recordings and logs can contain personal text; remove it before posting.
|
||||
placeholder: "Drag and drop files here"
|
||||
validations:
|
||||
required: false
|
||||
@@ -14,6 +14,8 @@ body:
|
||||
|
||||
You may use this template or write your own, as long as required fields (Description, OS Version, Reason, Game) are included.
|
||||
|
||||
Hard or impossible to use with a keyboard, a screen reader, a contrast theme or other assistive technology? Use the [Accessibility Barrier](https://github.com/poli0981/autoclick/issues/new?template=accessibility.yml) form instead: it needs no game link.
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
@@ -135,6 +137,6 @@ body:
|
||||
attributes:
|
||||
label: IDE / Build Environment
|
||||
description: If you built from source, which IDE and .NET SDK version? (optional)
|
||||
placeholder: "JetBrains Rider 2026.2 / .NET SDK 10.0.401"
|
||||
placeholder: "JetBrains Rider 2026.2 / .NET SDK 10.0.403"
|
||||
validations:
|
||||
required: false
|
||||
@@ -107,6 +107,6 @@ body:
|
||||
attributes:
|
||||
label: IDE / Build Environment
|
||||
description: If relevant, your IDE and .NET SDK version (optional).
|
||||
placeholder: "JetBrains Rider 2026.2 / .NET SDK 10.0.401"
|
||||
placeholder: "JetBrains Rider 2026.2 / .NET SDK 10.0.403"
|
||||
validations:
|
||||
required: false
|
||||
@@ -44,6 +44,7 @@
|
||||
- [ ] `dotnet build AutoClick.slnx` and `dotnet test --solution AutoClick.slnx` pass (see [CONTRIBUTING](../CONTRIBUTING.md) for the other CI checks)
|
||||
- [ ] Tested manually on a game or with `tools/AutoClick.ClickTarget`
|
||||
- [ ] New UI text is in `Strings.resx` and in all four translations (`vi`, `ja`, `ko`, `zh`); no hard-coded text in XAML
|
||||
- [ ] UI changes work with the keyboard alone and with Narrator: icon-only controls have a name, the focus is visible and in order, and color is not the only signal (see [ACCESSIBILITY](../docs/ACCESSIBILITY.md))
|
||||
- [ ] User-visible changes are listed under `[Unreleased]` in `CHANGELOG.md`
|
||||
- [ ] No secrets, credentials, or suspicious code
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
global-json-file: global.json
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
|
||||
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
@@ -67,6 +67,6 @@ jobs:
|
||||
run: dotnet build AutoClick.slnx -c Release -p:UseSharedCompilation=false
|
||||
|
||||
- name: Analyze
|
||||
uses: github/codeql-action/analyze@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
|
||||
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
with:
|
||||
category: /language:${{ matrix.language }}
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: markdownlint
|
||||
uses: DavidAnson/markdownlint-cli2-action@21c1be1b93ad9ed58fa840aacc3f279cde2a72ff # v24.2.0
|
||||
uses: DavidAnson/markdownlint-cli2-action@696eb3f2509270d7b882d2aa68347bc676e7af34 # v25.0.0
|
||||
with:
|
||||
globs: '**/*.md'
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
publish_results: true
|
||||
|
||||
- name: Upload to code scanning
|
||||
uses: github/codeql-action/upload-sarif@6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee # v4.39.0
|
||||
uses: github/codeql-action/upload-sarif@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
category: scorecard
|
||||
@@ -49,12 +49,20 @@ jobs:
|
||||
dotnet tool restore
|
||||
dotnet restore AutoClick.slnx
|
||||
|
||||
- name: Build info
|
||||
id: info
|
||||
shell: pwsh
|
||||
run: ./eng/Get-BuildInfo.ps1
|
||||
|
||||
# The product version lets the "previous version" new-code period start at the last version
|
||||
# change; without it, new code would count from the project's first analysis.
|
||||
# The scanner provisions its own Java runtime. Build output and restore files are not sources.
|
||||
- name: Begin analysis
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
VERSION: ${{ steps.info.outputs.version }}
|
||||
run: >-
|
||||
dotnet sonarscanner begin /k:poli0981_autoclick /o:poli0981
|
||||
dotnet sonarscanner begin /k:poli0981_autoclick /o:poli0981 /v:"$env:VERSION"
|
||||
/d:sonar.host.url=https://sonarcloud.io /d:sonar.token="$env:SONAR_TOKEN"
|
||||
"/d:sonar.cs.cobertura.reportsPaths=artifacts/test-results/**/*.cobertura.xml"
|
||||
"/d:sonar.exclusions=**/bin/**,**/obj/**,artifacts/**"
|
||||
|
||||
@@ -59,9 +59,9 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Run zizmor
|
||||
uses: zizmorcore/zizmor-action@f9597c869b2e67095f9b527070297a13a6efe928 # v0.7.0
|
||||
uses: zizmorcore/zizmor-action@53290badfa369cb0bf7ad16342cb62c2fa47ac7b # v0.8.0
|
||||
with:
|
||||
version: 1.31.0
|
||||
version: 1.31.1
|
||||
# Fail the job on findings instead of uploading them to code scanning.
|
||||
advanced-security: false
|
||||
persona: regular
|
||||
+38
-1
@@ -8,6 +8,41 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.1.0] - 2026-11-09
|
||||
|
||||
Accessibility: AutoClick can now be used completely with the keyboard and with a screen reader. Settings, profiles and sessions are unchanged.
|
||||
|
||||
### Added
|
||||
|
||||
- Coordinate picker: the arrow keys move the pointer (10 pixels, 1 with Shift) and Enter or Space picks the point, so click steps can be added without a mouse. In key press mode (4) these keys are recorded as before.
|
||||
- Screen readers announce status changes without moving the focus: the state of a game and why it stopped, the status bar, the update status, schedule errors, the keys while recording a hotkey, the picker's instructions, the messages that appear for a few seconds, and each step you add.
|
||||
- Page and section titles are headings for screen readers.
|
||||
- An [Accessibility statement](https://github.com/poli0981/autoclick/blob/master/docs/ACCESSIBILITY.md), linked from the About page: what works, known limitations, and a new issue form for accessibility barriers.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Screen readers read a step as "ClickPoint { X = 40, Y = 60, ... }" and a game card as "AutoClick.UI.ViewModels.GameSessionViewModel". They now read the step ("Click at (40, 60)", with its reference color) and the game.
|
||||
- Controls without a name for screen readers: the search box and the window list of Add game, the text box of name prompts, the steps and log lists, the hotkey recorder, the release notes and the close buttons of notices. The three Change buttons of the hotkeys now say which hotkey they change.
|
||||
- Settings: every settings card was an extra Tab stop without a name before its own control; so was the list of games on the Queue page.
|
||||
- Pages slid in and the dashboard charts animated even with Animation effects turned off in Windows.
|
||||
- The picker's window title was always in English.
|
||||
|
||||
### Changed
|
||||
|
||||
- After you pick a point or press Esc, AutoClick comes back to the front with the focus on Add step; before, the game stayed in front. Switching to another window still cancels the picker and leaves the focus there.
|
||||
|
||||
## [2.0.3] - 2026-10-26
|
||||
|
||||
Security update of the bundled .NET runtime. Settings, profiles and sessions are unchanged.
|
||||
|
||||
### Security
|
||||
|
||||
- AutoClick now ships with the .NET 10.0.14 runtime, an out-of-band security update from Microsoft. It fixes an out-of-bounds write in the Brotli decoder (CVE-2026-111497) and completes the October fix for a memory corruption in socket operations (CVE-2026-70197).
|
||||
|
||||
### Changed
|
||||
|
||||
- Dependencies: Microsoft.Extensions.Hosting 10.0.14 and Microsoft.Windows.CsWin32 0.3.367 (the Win32 interop code generator).
|
||||
|
||||
## [2.0.2] - 2026-10-22
|
||||
|
||||
Security hardening from a static analysis review (SonarQube Cloud). Settings, profiles and sessions are unchanged.
|
||||
@@ -366,7 +401,9 @@ Platform bridge release: no feature or data-format changes, so it is safe to upd
|
||||
- `ManualResetEventSlim` for pause/resume, `CancellationToken` for stop
|
||||
- `DispatcherTimer` for UI refresh and process monitoring
|
||||
|
||||
[Unreleased]: https://github.com/poli0981/autoclick/compare/v2.0.2...HEAD
|
||||
[Unreleased]: https://github.com/poli0981/autoclick/compare/v2.1.0...HEAD
|
||||
[2.1.0]: https://github.com/poli0981/autoclick/compare/v2.0.3...v2.1.0
|
||||
[2.0.3]: https://github.com/poli0981/autoclick/compare/v2.0.2...v2.0.3
|
||||
[2.0.2]: https://github.com/poli0981/autoclick/compare/v2.0.1...v2.0.2
|
||||
[2.0.1]: https://github.com/poli0981/autoclick/compare/v2.0.0...v2.0.1
|
||||
[2.0.0]: https://github.com/poli0981/autoclick/compare/v1.3.4...v2.0.0
|
||||
|
||||
@@ -26,6 +26,7 @@ dotnet jb inspectcode AutoClick.slnx --no-build --properties:Configuration=Relea
|
||||
- **No unused code:** InspectCode with solution-wide analysis fails CI on unused members, types, parameters and usings.
|
||||
- **Win32:** new APIs go in `src/AutoClick.Win32/NativeMethods.txt` (CsWin32). Coordinate work happens inside `DpiScope.ForWindow(game)`.
|
||||
- **Overlays** are positioned with `WindowGeometry.SetBounds` in physical pixels, never with WPF `Left/Top`.
|
||||
- **Accessibility** ([docs/ACCESSIBILITY.md](docs/ACCESSIBILITY.md), rules in CONTRIBUTING): icon-only controls, inputs and lists get `AutomationProperties.Name="{l:Loc …}"`, list items a readable name; changing text uses `controls:LiveTextBlock` (a `TextBlock` with `LiveSetting` is never announced), never for per-second values; the smoke test fails on unnamed focusable controls. The path `docs/ACCESSIBILITY.md` is linked from the app: do not move it.
|
||||
|
||||
## Pitfalls seen before
|
||||
|
||||
|
||||
+12
-1
@@ -22,7 +22,7 @@ The design is described in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md); the tes
|
||||
|
||||
| Check | What it verifies | Run it locally |
|
||||
|-------|------------------|----------------|
|
||||
| **build-test** | Formatting, a build with warnings as errors, all tests with coverage minimums (Core 90%, Services 70%), the published app's smoke test in every theme and language, and a Velopack packaging dry run | see below |
|
||||
| **build-test** | Formatting, a build with warnings as errors, all tests with coverage minimums (Core 90%, Services 70%), the published app's smoke test in every theme and language (text colors, binding errors, accessible names), and a Velopack packaging dry run | see below |
|
||||
| **dead-code** | No unused code (ReSharper InspectCode with solution-wide analysis) and no XAML bindings to missing properties | see below |
|
||||
| **licenses** | Every shipped package has a GPL-3.0-compatible license ([`eng/licenses`](eng/licenses)) | `./eng/New-ThirdPartyNotices.ps1 -OutFile artifacts/THIRD-PARTY-NOTICES.txt` |
|
||||
| **vuln-audit** | No known vulnerability in direct or transitive packages | `./eng/Test-VulnerablePackages.ps1` |
|
||||
@@ -62,6 +62,17 @@ Please also:
|
||||
- **No unused code:** the dead-code check fails on it. For a deliberate exception, write `// ReSharper disable once <rule>` with a reason.
|
||||
- **SonarQube Cloud findings** are fixed, or, when the code is right as it is, suppressed with `[SuppressMessage("Category", "Sxxxx:Title", Justification = "why")]`.
|
||||
|
||||
## Accessibility
|
||||
|
||||
AutoClick must stay usable with the keyboard alone and with a screen reader; see [docs/ACCESSIBILITY.md](docs/ACCESSIBILITY.md). For every change to the interface:
|
||||
|
||||
- **Names:** a control that shows only an icon, an input and a list get `AutomationProperties.Name="{l:Loc Key}"`. List items need a readable name: a `ToString()` that returns the visible text, or an `AutomationProperties.Name` in the `ItemContainerStyle`. The smoke test fails on a control that can be reached with the keyboard and has no name, and on a list item that would be read as a type name or a record dump.
|
||||
- **Keyboard:** everything can be done without a mouse, in a sensible Tab order, and `Esc` leaves dialogs and overlays. Drag and drop always has a button alternative. A container that does nothing itself (a card, a list of cards) is not a Tab stop.
|
||||
- **Announcements:** text that changes on its own (a state, a status, an error) uses `controls:LiveTextBlock` with `AutomationProperties.LiveSetting`, which raises the event screen readers listen to; a plain `TextBlock` with `LiveSetting` is never read. Do not make a countdown or a value that changes every second a live region. A message that is not on screen goes through `DialogService.Announce`; toasts already do.
|
||||
- **Headings:** page titles are `AutomationProperties.HeadingLevel="Level1"`, section titles `Level2` (or `Level3` inside a card).
|
||||
- **Color and motion:** color is never the only signal (add text or a name), colors come from theme resources, and animations respect `Motion.IsEnabled` (the Windows *Animation effects* setting).
|
||||
- **Check it:** press `Tab` through the changed screen with the mouse unplugged, and listen to it once with Narrator (`Ctrl+Win+Enter`). Mention both in the pull request.
|
||||
|
||||
## Translations
|
||||
|
||||
All UI text lives in `src/AutoClick.UI/Resources/Strings.resx` (English) and `Strings.vi/ja/ko/zh.resx`. Keys are `Group_Name` (for example `Queue_AddGame`).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<!-- Single source of truth for the product version (release tags must match it). -->
|
||||
<PropertyGroup>
|
||||
<Version>2.0.2</Version>
|
||||
<Version>2.1.0</Version>
|
||||
<AssemblyVersion>$(Version).0</AssemblyVersion>
|
||||
<FileVersion>$(Version).0</FileVersion>
|
||||
<InformationalVersion>$(Version)</InformationalVersion>
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
<PackageVersion Include="LiveChartsCore" Version="2.0.5" />
|
||||
<PackageVersion Include="LiveChartsCore.SkiaSharpView" Version="2.0.5" />
|
||||
<PackageVersion Include="LiveChartsCore.SkiaSharpView.WPF" Version="2.0.5" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.13" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.13" />
|
||||
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.363" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.14" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.14" />
|
||||
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.3.367" />
|
||||
<PackageVersion Include="Serilog" Version="4.4.0" />
|
||||
<PackageVersion Include="Serilog.Extensions.Hosting" Version="10.0.0" />
|
||||
<PackageVersion Include="Serilog.Sinks.Async" Version="2.1.0" />
|
||||
|
||||
@@ -32,6 +32,10 @@ AutoClick sends mouse clicks and key presses to game windows with the Win32 `Pos
|
||||
>
|
||||
> **AI disclosure:** AutoClick is built with AI assistance (Claude by Anthropic). The in-app translations are AI-generated and may contain mistakes. See [Acknowledgements](docs/ACKNOWLEDGEMENTS.md).
|
||||
|
||||
## What's new in 2.1
|
||||
|
||||
Accessibility: points can be picked with the keyboard, screen readers now announce status changes and messages and read every control and step, and animations follow Windows. See the [Accessibility statement](docs/ACCESSIBILITY.md) and the [CHANGELOG](CHANGELOG.md#210---2026-11-09).
|
||||
|
||||
## What's new in 2.0
|
||||
|
||||
A new Fluent interface, administrator rights only when a game needs them, keystroke steps that survive saving, a picker that works on every monitor and display scaling, sessions that wait while a game is minimized, and fixes for every known 1.x bug. Settings, profiles and hotkeys from 1.x carry over. Full list: [CHANGELOG](CHANGELOG.md#200---2026-10-15).
|
||||
@@ -41,7 +45,7 @@ A new Fluent interface, administrator rights only when a game needs them, keystr
|
||||
- **Game queue**: add up to 50 game windows (10 by default), each with its own steps and statistics; start, pause, resume and stop them one by one or all together.
|
||||
- **Step sequences**: left click, double click, right click or a key press per step, run in order with a delay between steps, then repeated after the interval.
|
||||
- **Timing**: fixed or random interval (1 s to 1 h). *Global* mode uses one timing for every game; *Custom* mode gives each game its own timing and profiles.
|
||||
- **Coordinate picker**: a crosshair over exactly the game's window area, on any monitor and display scaling. Keys `1`-`4` switch between left, double, right click and key press; `Esc` cancels. Or add a random point.
|
||||
- **Coordinate picker**: a crosshair over exactly the game's window area, on any monitor and display scaling. Click the spot, or move with the arrow keys and press `Enter`. Keys `1`-`4` switch between left, double, right click and key press; `Esc` cancels. Or add a random point.
|
||||
- **Pixel color guard**: remember the color under each point and only click while it still matches; otherwise skip the step, stop, or wait until it matches.
|
||||
- **Profiles**: save, load, import and export steps and timing (`.autoclick` files).
|
||||
- **Sessions**: export or import everything (settings, profiles and the game queue) in one `.autoclick-session` file.
|
||||
@@ -52,6 +56,7 @@ A new Fluent interface, administrator rights only when a game needs them, keystr
|
||||
- **Administrator only when needed**: AutoClick tells you when a game runs as administrator and offers to restart elevated.
|
||||
- **Notifications and tray**: notification-area icon, a notice when a game exits, optional sounds; closing the window can minimize to the tray, stop and exit, or exit.
|
||||
- **Themes and languages**: System, Light, Dark or High contrast; English, Tiếng Việt, 日本語, 한국어, 中文, switchable without a restart.
|
||||
- **Accessibility**: works with the keyboard alone (the coordinate picker included) and with Narrator, follows Windows contrast themes, display scaling and animation settings. See the [Accessibility statement](docs/ACCESSIBILITY.md).
|
||||
- **Updates**: from GitHub Releases through Velopack, checked at startup and every 6 hours, installed when you choose or when you exit.
|
||||
|
||||
## Requirements
|
||||
@@ -84,7 +89,7 @@ gh attestation verify AutoClick-win-Setup.exe -R poli0981/autoclick
|
||||
## Usage
|
||||
|
||||
1. **Add game** and pick the game's window.
|
||||
2. **Add step** and click the spot in the game (or press `4`, then the key to send). Repeat for more steps; **Random point** adds one automatically.
|
||||
2. **Add step** and click the spot in the game, or move to it with the arrow keys and press `Enter` (or press `4`, then the key to send). Repeat for more steps; **Random point** adds one automatically.
|
||||
3. Press **Start** on the game card, or **Start all**.
|
||||
4. Watch clicks, skips and clicks per minute on the card and on the **Dashboard**; use **Heatmap** to see where clicks land.
|
||||
5. **Settings** holds timing, the pixel color guard, hotkeys, theme, language, exit behavior and administrator mode; changes apply immediately.
|
||||
@@ -117,7 +122,7 @@ See [CONTRIBUTING](CONTRIBUTING.md) for the checks every pull request must pass
|
||||
|
||||
## Contributing
|
||||
|
||||
Issues and pull requests are welcome; please read [CONTRIBUTING](CONTRIBUTING.md) and the [Code of Conduct](docs/CODE_OF_CONDUCT.md). Issues and pull requests that contain suspicious code or links, are unrelated to the project, or are disrespectful are closed without discussion. Report security problems privately as described in the [Security Policy](docs/SECURITY.md).
|
||||
Issues and pull requests are welcome; please read [CONTRIBUTING](CONTRIBUTING.md) and the [Code of Conduct](docs/CODE_OF_CONDUCT.md). Accessibility barriers have their own [issue form](https://github.com/poli0981/autoclick/issues/new?template=accessibility.yml). Issues and pull requests that contain suspicious code or links, are unrelated to the project, or are disrespectful are closed without discussion. Report security problems privately as described in the [Security Policy](docs/SECURITY.md).
|
||||
|
||||
## Connect & Support
|
||||
|
||||
@@ -145,6 +150,7 @@ The PC used to build and test releases is described in [docs/pc_spec.md](docs/pc
|
||||
| [Privacy Policy](docs/PRIVACY_POLICY.md) | What is stored, where, and for how long; nothing is collected |
|
||||
| [Disclaimer](docs/DISCLAIMER.md) | Anti-cheat and hardware risks, liability |
|
||||
| [Security Policy](docs/SECURITY.md) | Supported versions and private vulnerability reporting |
|
||||
| [Accessibility](docs/ACCESSIBILITY.md) | What AutoClick supports, known limitations, and how to report a barrier |
|
||||
| [Acknowledgements](docs/ACKNOWLEDGEMENTS.md) | Third-party software and credits |
|
||||
| [Code of Conduct](docs/CODE_OF_CONDUCT.md) | Community guidelines |
|
||||
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
# Accessibility
|
||||
|
||||
**Last reviewed:** November 2026 (AutoClick 2.1)
|
||||
|
||||
AutoClick should work for everyone who wants to automate a game, including people who use only a keyboard, a screen reader, a contrast theme or large display scaling. This statement explains what AutoClick supports, what does not work yet, how it is tested, and how to report a barrier. It covers the AutoClick app for Windows, its installer and this repository's documentation.
|
||||
|
||||
## Goals
|
||||
|
||||
- **Target:** we work toward [WCAG 2.2](https://www.w3.org/TR/WCAG22/) Level AA, applied to desktop software as described in [WCAG2ICT](https://www.w3.org/TR/wcag2ict/). This is a goal, not a claim of conformance: AutoClick has not had a formal accessibility audit.
|
||||
- **Keyboard:** every feature can be used without a mouse, with a visible focus indicator, a logical Tab order and no keyboard traps.
|
||||
- **Screen readers:** every control has a name in the language of the interface, status changes and messages are announced, and page and section titles are headings. Narrator is the reference screen reader.
|
||||
- **Vision:** contrast themes, display scaling on every monitor, and color never as the only way to tell something.
|
||||
- **Motion:** no flashing content, and animations follow the Windows setting.
|
||||
|
||||
## Accessibility features
|
||||
|
||||
### Keyboard
|
||||
|
||||
| Where | Keys |
|
||||
|-------|------|
|
||||
| Anywhere in the window | `Tab` / `Shift+Tab` move between controls, `Enter` or `Space` activates a button, arrow keys move in lists and menus, `Esc` closes a dialog. The page list (Queue, Dashboard, Settings, About) is reached with `Tab`. |
|
||||
| Global hotkeys | `F6` pause or resume all, `F7` stop all, `F8` start all. They work while the game is in front and can be changed in **Settings → Hotkeys**. |
|
||||
| Coordinate picker (**Add step**) | Arrow keys move the pointer 10 pixels (`Shift`+arrow: 1 pixel) inside the game window; `Enter` or `Space` picks the point. `1`-`4` choose left, double or right click, or a key press; `Esc` cancels. After picking, AutoClick comes back to the front with the focus on **Add step**. |
|
||||
| Key press steps | In the picker, press `4`, then the key to send. Every key is recorded in this mode, including the arrow keys and `Enter`. |
|
||||
| Steps list | **Move up** and **Move down** reorder steps without dragging. **Random point** adds a click point without picking one. |
|
||||
| Recording a hotkey | Press the new combination. `Tab` moves to the buttons and `Esc` cancels. |
|
||||
|
||||
### Screen readers
|
||||
|
||||
- Buttons that show only an icon, inputs, lists and list items have names, in every language of the interface. Each game card is named after its game, and each step after what it does (for example "Click at (40, 60), reference color #336699").
|
||||
- These changes are announced without moving the focus:
|
||||
- the state of a game, and why a game stopped by itself;
|
||||
- the status bar and the update status;
|
||||
- schedule errors, and the key combination while you record a hotkey;
|
||||
- the coordinate picker's instructions;
|
||||
- messages that appear for a few seconds, and each step you add.
|
||||
- Page titles are level 1 headings and section titles level 2 or 3, so the heading keys of a screen reader (in Narrator's scan mode: `H` and `Shift+H`) move between them.
|
||||
- The scheduler's countdown is not announced every second; read it when you need it.
|
||||
|
||||
### Display
|
||||
|
||||
- **Themes:** *Use Windows setting* follows Windows' light, dark and contrast themes. *Light*, *Dark* and *High contrast* can also be chosen in AutoClick's **Settings → Appearance**.
|
||||
- **Color is never the only signal:** game states, warnings and log levels also have text, and the reference color of a step is named for screen readers and shown as a hex value in its tooltip.
|
||||
- **Scaling:** AutoClick is per-monitor DPI aware. It follows the Windows *Scale* setting, and the coordinate picker and the heatmap stay exact on every monitor.
|
||||
- **Motion:** with *Animation effects* turned off in Windows (Windows 11: **Settings → Accessibility → Visual effects**; Windows 10: **Settings → Ease of Access → Display → Show animations**), pages no longer slide in and the dashboard charts no longer animate.
|
||||
- **Sounds** are optional (the **Sounds** setting in AutoClick's Settings), and every sound has a visual or spoken equivalent.
|
||||
|
||||
## Supported environments
|
||||
|
||||
| Environment | Support |
|
||||
|-------------|---------|
|
||||
| Windows 10 version 2004 or later, Windows 11 (x64) | Supported |
|
||||
| Keyboard only | Supported, including the coordinate picker |
|
||||
| Narrator | Supported; the reference screen reader, checked before releases that change the interface |
|
||||
| NVDA | Expected to work (AutoClick uses Windows UI Automation), not tested regularly |
|
||||
| JAWS and other screen readers | Not tested |
|
||||
| Voice Access and other speech input | Not tested; the control names it relies on are in place |
|
||||
| Contrast themes and the High contrast theme | Supported |
|
||||
| Display scaling | Supported at any scale, on every monitor |
|
||||
|
||||
## Known limitations
|
||||
|
||||
- **Windows *Text size* setting:** WPF applications do not receive it, so AutoClick's text keeps its size. Use the Windows *Scale* setting instead (**Settings → System → Display**), which AutoClick follows.
|
||||
- **Dashboard charts** are drawings: screen readers read only their titles. The totals, clicks per minute, the peak and the active time are text on the same page, each game card shows its own numbers, and **Export statistics** saves the current totals as a CSV file.
|
||||
- **Heatmap overlay:** it shows where clicks landed with colors and sizes only; its legend gives the totals as text.
|
||||
- **Overlays:** the coordinate picker and the heatmap use their own fixed colors (a light blue tint, white text on a dark background), not the theme or a contrast theme.
|
||||
- **Coordinate picker:** the coordinates next to the pointer are not read aloud while it moves; the step is announced once you pick it.
|
||||
- **Notification area icon:** its menu has not been tested with a screen reader. The main window offers the same commands.
|
||||
- **Translations** are AI-generated and may contain mistakes; corrections are welcome.
|
||||
- **Games:** AutoClick cannot change how accessible a game itself is.
|
||||
|
||||
**If you meet a barrier that is not listed here, please [report it](#reporting-a-barrier).**
|
||||
|
||||
## How we test
|
||||
|
||||
| When | What |
|
||||
|------|------|
|
||||
| Every pull request and release build | The smoke test opens every page in every theme (including High contrast) and every language, plus the dialogs, and fails when a control that can be reached with the keyboard has no name, when a list item has no readable name, or when text does not follow the theme. Architecture tests check that all interface text is translated. |
|
||||
| Before a release that changes the interface | A keyboard-only pass with the mouse disconnected, a Narrator pass of the changed screens, and a look at the High contrast theme. |
|
||||
|
||||
Recorded passes:
|
||||
|
||||
| Version | Pass |
|
||||
|---------|------|
|
||||
| 2.0.3 (October 2026) | Keyboard only (mouse disconnected) and Narrator, Windows 11, by the maintainer: no errors found. |
|
||||
| 2.1.0 (November 2026) | Name check added to the smoke test (it found the problems fixed in 2.1.0). Keyboard picking and the announcements were checked through UI Automation, the interface Narrator uses. |
|
||||
|
||||
## Reporting a barrier
|
||||
|
||||
Open an [accessibility issue](https://github.com/poli0981/autoclick/issues/new?template=accessibility.yml). It helps to include:
|
||||
|
||||
- what you were trying to do, and where it failed;
|
||||
- the steps to get there;
|
||||
- your assistive technology and its version (for example Narrator, NVDA 2026.2, a switch device), or how you use the computer (keyboard only, magnifier, contrast theme);
|
||||
- your Windows version and AutoClick version (shown on the About page);
|
||||
- a screen recording or screenshot, if you can.
|
||||
|
||||
You never need to explain a disability or share personal information. If you prefer not to report in public, write to the developer by email (address on the [GitHub profile](https://github.com/poli0981) and in [social.md](social.md)) or on [Discord](https://discord.gg/kDM9GMu5vm).
|
||||
|
||||
### Severity
|
||||
|
||||
| Severity | Meaning |
|
||||
|----------|---------|
|
||||
| Critical | Blocks a core task, with no workaround (for example, a game cannot be added or started) |
|
||||
| Serious | A core task is very hard, but a workaround exists |
|
||||
| Moderate | Annoying or inconsistent, but the task can be done |
|
||||
| Minor | Little effect on use |
|
||||
|
||||
### How we respond
|
||||
|
||||
- We acknowledge a report within a week, without questioning the reporter's experience.
|
||||
- We explain what we will do next, and what we cannot change (for example, a limit of WPF or of a game).
|
||||
- We suggest a workaround when there is one, and post updates in the issue.
|
||||
- We ask the reporter to confirm the fix before closing, if they are willing.
|
||||
|
||||
AutoClick is maintained by one person in their spare time. From the day a report is opened, we aim to fix Critical barriers within 30 days, Serious ones within 60 days, and Moderate and Minor ones within 90 days. When a target is missed, the issue says why, what the workaround is, and when to expect a fix.
|
||||
|
||||
## Contributing
|
||||
|
||||
Interface changes follow the [accessibility rules in CONTRIBUTING](../CONTRIBUTING.md#accessibility), and the pull request template asks for a keyboard and Narrator check. Reports and suggestions from people who use assistive technology are especially welcome, in issues, in [Discussions](https://github.com/poli0981/autoclick/discussions) or as pull requests.
|
||||
|
||||
## Ownership
|
||||
|
||||
The maintainer ([poli0981](https://github.com/poli0981)) is responsible for accessibility: triaging reports, tracking barriers, and reviewing this statement with every minor release.
|
||||
|
||||
## Feedback
|
||||
|
||||
Accessibility is ongoing work. If something in this statement is unclear, wrong or missing, open an issue or a pull request.
|
||||
|
||||
This statement follows the guidance of [Open Source Guides](https://opensource.guide/accessibility-best-practices-for-your-project/#start-with-an-accessibility-statement) and the [Open Source Accessibility toolkit](https://github.com/open-source-accessibility/accessibility-toolkit/blob/main/ACCESSIBILITY.md).
|
||||
@@ -62,6 +62,7 @@ Everything lives in `%LocalAppData%\AutoClick`, which is also Velopack's install
|
||||
- **Localization:** `LocalizationService` reads `Strings*.resx`. XAML binds through `{l:Loc Key}` (an indexer binding), so changing the language updates the whole UI without a restart.
|
||||
- **Overlays:** the coordinate picker is placed over the game's client area in physical pixels (`SetWindowPos`), so it works on any monitor. The heatmap is a click-through, no-activate, tool window that follows the game through out-of-process WinEvent hooks (focus and location, filtered by process and window, at most one update per frame) with a one-second fallback, shows only while the game or its dialogs are in front, and draws all markers in one `OnRender` pass with frozen brushes.
|
||||
- **Hotkeys:** registered on a message-only window owned by the UI thread; registration results are reported; recording a new hotkey suspends the old ones and re-registers them in a `finally`.
|
||||
- **Accessibility** ([ACCESSIBILITY.md](ACCESSIBILITY.md)): names come from `{l:Loc}` like all text (`AccessibleNames` names icon-only parts of WPF-UI templates). `LiveTextBlock` raises the UI Automation `LiveRegionChanged` event that WPF never raises for `LiveSetting` alone, at most once a second with the latest text; `DialogService.Announce` raises a notification for toasts and added steps. `Motion` relays Windows' *Animation effects* setting to page transitions and charts, which ignore it. The smoke test checks the names in every language.
|
||||
|
||||
## Updates
|
||||
|
||||
@@ -106,3 +107,9 @@ Velopack (`packId` `AutoClick`, channel `win`, main exe `AutoClick.UI.exe`, none
|
||||
|
||||
**Decided:** the build drops `Microsoft.Windows.SDK.NET.dll` (24 MB) and SkiaSharp's native debug symbols (about 100 MB) from the output.
|
||||
**Why:** the `windows10.0.19041` target framework (needed for the modern assets of SkiaSharp.Views.WPF) and CommunityToolkit.Mvvm pull in the WinRT projection, but no assembly of the app references it; `WinRT.Runtime.dll`, which some libraries reference, stays. The smoke test runs on the published output to catch a mistake here.
|
||||
|
||||
### 7. Keyboard picking moves the real pointer (November 2026)
|
||||
|
||||
**Considered:** a virtual crosshair moved by the arrow keys, converted to the game's coordinates by the overlay.
|
||||
**Decided:** the arrow keys move the real pointer (`SetCursorPos`, physical pixels, kept inside the game's client area) and `Enter` picks through the same `GetCursorPos`/`ScreenToClient` path as a click.
|
||||
**Why:** that path already maps correctly for DPI-unaware games on scaled monitors, with no second conversion to keep right. The pointer moves only while the user is picking.
|
||||
@@ -31,7 +31,8 @@ The checks CI runs on every pull request, and how to run them locally, are liste
|
||||
| Tool | Purpose |
|
||||
|------|---------|
|
||||
| **`tools/AutoClick.ClickTarget`** | A window that logs every mouse and keyboard message it receives (client coordinates, virtual-key and scan codes). `--dpi unaware\|system\|pmv2` changes its DPI awareness to test coordinate mapping, `--log <file>` writes the log to a file. |
|
||||
| **`AutoClick.UI.exe --smoke-test`** | Opens every page in every theme and language, the dialogs and a heatmap overlay, and fails on any binding error. Uses `%TEMP%\AutoClick-smoke` instead of the real data folder. |
|
||||
| **`AutoClick.UI.exe --smoke-test`** | Opens every page in every theme and language, the dialogs and a heatmap overlay, and fails on any binding error, on text that does not follow the theme, and on a control or list item that screen readers would find without a name. Uses `%TEMP%\AutoClick-smoke` instead of the real data folder. |
|
||||
| **Narrator and the keyboard** | Manual accessibility check of interface changes: unplug the mouse and use `Tab`, the arrow keys, `Enter` and `Esc`; start Narrator with `Ctrl+Win+Enter`. What to check is in [ACCESSIBILITY.md](ACCESSIBILITY.md#how-we-test). |
|
||||
| **`eng/Invoke-UpgradeTest.ps1`** | Update test in Windows Sandbox, without touching the development machine: installs an older release (for example 1.3.3), updates it to a new package with the installed updater, and checks the data migration, the uninstall and a fresh install. Used before every release ([RELEASING.md](RELEASING.md)). |
|
||||
|
||||
## Tested Games
|
||||
|
||||
@@ -56,6 +56,8 @@ Until it is published, the release is invisible to users and to the updater.
|
||||
|
||||
The script installs the old release, adds 1.x settings and a profile, updates with the installed `Update.exe` (as the in-app updater does), starts the new version once (data migration) and runs its smoke test, then uninstalls and checks a fresh install. It prints PASS or FAIL for each check and keeps the logs in `artifacts/upgrade-test/runs`.
|
||||
|
||||
4. If the release changes the interface: a keyboard-only pass (mouse unplugged) and a Narrator pass of the changed screens, and a look at the High contrast theme ([ACCESSIBILITY.md](ACCESSIBILITY.md#how-we-test)). Add the result to its *Recorded passes* table.
|
||||
|
||||
## 4. Publish
|
||||
|
||||
Publish from **your own account** (events raised by the workflow token would not start other workflows):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# System Requirements
|
||||
|
||||
**Applies to:** AutoClick 2.0 and later. **Last updated:** October 2026.
|
||||
**Applies to:** AutoClick 2.0 and later. **Last updated:** November 2026.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -38,6 +38,10 @@ See [HEATMAP_COMPATIBILITY.md](HEATMAP_COMPATIBILITY.md) for the overlay details
|
||||
|
||||
AutoClick is per-monitor DPI aware. The coordinate picker and the heatmap work on every monitor and at any scaling, and points are stored in the game's own coordinates. Points picked with AutoClick 1.x in a game that is not DPI aware, on a scaled monitor, may be off and should be picked again.
|
||||
|
||||
## Accessibility
|
||||
|
||||
AutoClick works with the keyboard alone and with Narrator, follows Windows contrast themes, display scaling and the *Animation effects* setting, and has a High contrast theme of its own. Supported assistive technology, known limitations and how to report a barrier are in the [Accessibility statement](ACCESSIBILITY.md).
|
||||
|
||||
## Tested configurations (2.0)
|
||||
|
||||
| Configuration | What was tested |
|
||||
|
||||
@@ -31,7 +31,8 @@ Các bước kiểm tra CI chạy cho mỗi pull request, và cách chạy chún
|
||||
| Công cụ | Mục đích |
|
||||
|---------|----------|
|
||||
| **`tools/AutoClick.ClickTarget`** | Cửa sổ ghi lại mọi message chuột và bàn phím nhận được (toạ độ client, mã phím ảo và scan code). `--dpi unaware\|system\|pmv2` đổi chế độ DPI để kiểm tra quy đổi toạ độ, `--log <file>` ghi log ra file. |
|
||||
| **`AutoClick.UI.exe --smoke-test`** | Mở mọi trang ở mọi theme và ngôn ngữ, các hộp thoại và lớp heatmap, báo lỗi nếu có binding hỏng. Dùng `%TEMP%\AutoClick-smoke` thay cho thư mục dữ liệu thật. |
|
||||
| **`AutoClick.UI.exe --smoke-test`** | Mở mọi trang ở mọi theme và ngôn ngữ, các hộp thoại và lớp heatmap, báo lỗi nếu có binding hỏng, chữ không theo theme, hoặc control/mục danh sách mà trình đọc màn hình không tìm được tên. Dùng `%TEMP%\AutoClick-smoke` thay cho thư mục dữ liệu thật. |
|
||||
| **Narrator và bàn phím** | Kiểm tra accessibility thủ công cho các thay đổi giao diện: rút chuột ra và dùng `Tab`, phím mũi tên, `Enter`, `Esc`; bật Narrator bằng `Ctrl+Win+Enter`. Những điểm cần kiểm tra nằm trong [ACCESSIBILITY.md](../../ACCESSIBILITY.md#how-we-test) (tiếng Anh). |
|
||||
| **`eng/Invoke-UpgradeTest.ps1`** | Kiểm thử cập nhật trong Windows Sandbox, không ảnh hưởng máy phát triển: cài một bản cũ (ví dụ 1.3.3), cập nhật lên gói mới bằng trình cập nhật đã cài, rồi kiểm tra việc chuyển dữ liệu, gỡ cài đặt và cài mới. Chạy trước mỗi lần phát hành ([RELEASING.md](../../RELEASING.md)). |
|
||||
|
||||
## Game Đã Kiểm Thử
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
Runs the published app with --smoke-test and fails if it does not exit 0 in time.
|
||||
.DESCRIPTION
|
||||
--smoke-test builds the DI graph, opens every page in every theme and language, the
|
||||
dialogs and a heatmap overlay, checks that page and chart text follow the theme, and exits 1
|
||||
on any exception, data-binding error or wrong text color. It uses %TEMP%\AutoClick-smoke as
|
||||
its data folder; on failure the newest log from there is printed.
|
||||
dialogs and a heatmap overlay, checks that page and chart text follow the theme and that
|
||||
screen readers find a name for every control and list item, and exits 1 on any exception,
|
||||
data-binding error, wrong text color or missing name. It uses %TEMP%\AutoClick-smoke as its
|
||||
data folder; on failure the newest log from there is printed.
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "10.0.401",
|
||||
"version": "10.0.403",
|
||||
"rollForward": "latestFeature"
|
||||
},
|
||||
"test": {
|
||||
|
||||
@@ -42,4 +42,26 @@ public static class DpiMath
|
||||
|
||||
public static bool IsInsideClient(int x, int y, int clientWidth, int clientHeight) =>
|
||||
x >= 0 && y >= 0 && x < clientWidth && y < clientHeight;
|
||||
|
||||
/// <summary>
|
||||
/// Where the coordinate picker's arrow keys move the pointer: <paramref name="dx"/>,
|
||||
/// <paramref name="dy"/> pixels from <paramref name="position"/>, kept inside
|
||||
/// <paramref name="area"/> (all in physical screen pixels). A position outside the area moves to
|
||||
/// its center first.
|
||||
/// </summary>
|
||||
public static PixelPoint MovePointer(PixelPoint position, PixelRect area, int dx, int dy)
|
||||
{
|
||||
if (area.IsEmpty)
|
||||
{
|
||||
return position;
|
||||
}
|
||||
|
||||
if (!IsInsideClient(position.X - area.Left, position.Y - area.Top, area.Width, area.Height))
|
||||
{
|
||||
return new PixelPoint(area.Left + (area.Width / 2), area.Top + (area.Height / 2));
|
||||
}
|
||||
|
||||
var moved = ClampToClient(position.X - area.Left + dx, position.Y - area.Top + dy, area.Width, area.Height);
|
||||
return new PixelPoint(area.Left + moved.X, area.Top + moved.Y);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,9 @@ public static class AppLinks
|
||||
public const string Eula = Repository + "/blob/master/docs/EULA.md";
|
||||
public const string SecurityPolicy = Repository + "/blob/master/docs/SECURITY.md";
|
||||
|
||||
// Linked from 2.1 on: keep this path too.
|
||||
public const string Accessibility = Repository + "/blob/master/docs/ACCESSIBILITY.md";
|
||||
|
||||
public const string Discord = "https://discord.gg/kDM9GMu5vm";
|
||||
public const string X = "https://x.com/SkullMute0011";
|
||||
public const string YouTube = "https://www.youtube.com/@SkullMute";
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Windows.Shapes;
|
||||
using AutoClick.Core.Abstractions;
|
||||
using AutoClick.Core.Models;
|
||||
using AutoClick.UI.Localization;
|
||||
using AutoClick.UI.Views.Controls;
|
||||
using AutoClick.Win32;
|
||||
|
||||
namespace AutoClick.UI.Overlays;
|
||||
@@ -15,7 +16,8 @@ namespace AutoClick.UI.Overlays;
|
||||
/// <summary>
|
||||
/// Crosshair overlay placed exactly over the game's client area (on whichever monitor it is).
|
||||
/// The picked point is read with GetCursorPos/ScreenToClient in the game's own DPI context, so
|
||||
/// it is correct for DPI-unaware games on scaled monitors too.
|
||||
/// it is correct for DPI-unaware games on scaled monitors too. Without a mouse, the arrow keys
|
||||
/// move the real pointer (10 pixels, 1 with Shift) and Enter or Space picks, through the same path.
|
||||
/// </summary>
|
||||
public sealed class CoordinatePickerOverlay : Window
|
||||
{
|
||||
@@ -26,7 +28,7 @@ public sealed class CoordinatePickerOverlay : Window
|
||||
private readonly Line _vertical = CrosshairLine();
|
||||
private readonly TextBlock _coordinates = new() { Foreground = Brushes.White, FontFamily = new FontFamily("Consolas"), FontSize = 12 };
|
||||
private readonly Border _coordinateLabel;
|
||||
private readonly TextBlock _instructions = new() { Foreground = Brushes.White, FontSize = 14, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Center };
|
||||
private readonly LiveTextBlock _instructions = new() { Foreground = Brushes.White, FontSize = 14, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Center };
|
||||
private ClickType _type = ClickType.LeftClick;
|
||||
|
||||
private CoordinatePickerOverlay(nint target, IPixelReader? pixels)
|
||||
@@ -42,7 +44,7 @@ public sealed class CoordinatePickerOverlay : Window
|
||||
ShowInTaskbar = false;
|
||||
ResizeMode = ResizeMode.NoResize;
|
||||
Cursor = Cursors.Cross;
|
||||
Title = "AutoClick coordinate picker";
|
||||
Title = L.Get("Picker_Title");
|
||||
|
||||
_coordinateLabel = new Border
|
||||
{
|
||||
@@ -78,7 +80,8 @@ public sealed class CoordinatePickerOverlay : Window
|
||||
MouseMove += OnMouseMove;
|
||||
MouseLeftButtonDown += OnMouseDown;
|
||||
PreviewKeyDown += OnKeyDown;
|
||||
Deactivated += (_, _) => Finish(null);
|
||||
// Switching to another window cancels, and leaves the focus where the user went.
|
||||
Deactivated += (_, _) => Finish(null, returnFocus: false);
|
||||
Closed += (_, _) => _result.TrySetResult(null);
|
||||
}
|
||||
|
||||
@@ -120,9 +123,10 @@ public sealed class CoordinatePickerOverlay : Window
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseMove(object sender, MouseEventArgs e)
|
||||
private void OnMouseMove(object sender, MouseEventArgs e) => UpdateCrosshair(e.GetPosition(this));
|
||||
|
||||
private void UpdateCrosshair(Point position)
|
||||
{
|
||||
var position = e.GetPosition(this);
|
||||
_horizontal.X1 = 0;
|
||||
_horizontal.X2 = ActualWidth;
|
||||
_horizontal.Y1 = _horizontal.Y2 = position.Y;
|
||||
@@ -140,13 +144,26 @@ public sealed class CoordinatePickerOverlay : Window
|
||||
Canvas.SetTop(_coordinateLabel, Math.Max(0, labelY));
|
||||
}
|
||||
|
||||
private void OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
private void OnMouseDown(object sender, MouseButtonEventArgs e) => Pick(fromKeyboard: false);
|
||||
|
||||
private void Pick(bool fromKeyboard)
|
||||
{
|
||||
if (_type == ClickType.Keystroke || !WindowGeometry.TryGetCursorClientPoint(_target, out var point))
|
||||
if (_type == ClickType.Keystroke)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WindowGeometry.TryGetCursorClientPoint(_target, out var point))
|
||||
{
|
||||
if (fromKeyboard)
|
||||
{
|
||||
// Enter with the pointer outside the game: bring it to the center first.
|
||||
MovePointer(0, 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var color = ClickPoint.NoColor;
|
||||
if (_pixels is not null)
|
||||
{
|
||||
@@ -189,6 +206,11 @@ public sealed class CoordinatePickerOverlay : Window
|
||||
return;
|
||||
}
|
||||
|
||||
if (_type != ClickType.Keystroke && HandleClickModeKey(key))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (_type != ClickType.Keystroke
|
||||
|| key is Key.LeftCtrl or Key.RightCtrl or Key.LeftAlt or Key.RightAlt or Key.LeftShift or Key.RightShift or Key.LWin or Key.RWin)
|
||||
{
|
||||
@@ -202,6 +224,42 @@ public sealed class CoordinatePickerOverlay : Window
|
||||
}
|
||||
}
|
||||
|
||||
// Arrows move the pointer (Shift: one pixel), Enter or Space picks. In keystroke mode these
|
||||
// keys are recorded like any other.
|
||||
private bool HandleClickModeKey(Key key)
|
||||
{
|
||||
var step = Keyboard.Modifiers.HasFlag(ModifierKeys.Shift) ? 1 : 10;
|
||||
switch (key)
|
||||
{
|
||||
case Key.Left:
|
||||
MovePointer(-step, 0);
|
||||
return true;
|
||||
case Key.Right:
|
||||
MovePointer(step, 0);
|
||||
return true;
|
||||
case Key.Up:
|
||||
MovePointer(0, -step);
|
||||
return true;
|
||||
case Key.Down:
|
||||
MovePointer(0, step);
|
||||
return true;
|
||||
case Key.Enter or Key.Space:
|
||||
Pick(fromKeyboard: true);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void MovePointer(int dx, int dy)
|
||||
{
|
||||
// The pointer may be hidden or not move a mouse device: draw the crosshair at once.
|
||||
if (WindowGeometry.MovePointerWithinClient(_target, dx, dy) is { } screen)
|
||||
{
|
||||
UpdateCrosshair(PointFromScreen(new Point(screen.X, screen.Y)));
|
||||
}
|
||||
}
|
||||
|
||||
private void SetType(ClickType type)
|
||||
{
|
||||
_type = type;
|
||||
@@ -221,11 +279,19 @@ public sealed class CoordinatePickerOverlay : Window
|
||||
_instructions.Text = $"{instruction}\n[{typeName}]";
|
||||
}
|
||||
|
||||
private void Finish(ClickPoint? point)
|
||||
private void Finish(ClickPoint? point, bool returnFocus = true)
|
||||
{
|
||||
if (_result.TrySetResult(point))
|
||||
if (!_result.TrySetResult(point))
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
Close();
|
||||
if (returnFocus)
|
||||
{
|
||||
// The game was brought to the front for picking. Come back to AutoClick, where WPF
|
||||
// gives the focus back to the button that opened the picker (keyboard users rely on it).
|
||||
Application.Current.MainWindow?.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public sealed class HeatmapOverlay : Window
|
||||
Focusable = false;
|
||||
IsHitTestVisible = false;
|
||||
ResizeMode = ResizeMode.NoResize;
|
||||
Title = "AutoClick heatmap";
|
||||
Title = L.Get("Heatmap_Show");
|
||||
|
||||
var legend = new Border
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<resheader name="version"><value>2.0</value></resheader>
|
||||
<resheader name="reader"><value>System.Resources.ResXResourceReader</value></resheader>
|
||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter</value></resheader>
|
||||
<data name="About_Accessibility" xml:space="preserve"><value>アクセシビリティ</value></data>
|
||||
<data name="About_Acknowledgements" xml:space="preserve"><value>謝辞</value></data>
|
||||
<data name="About_Ai" xml:space="preserve"><value>AutoClick は AI の支援を受けて開発されています。アプリ内の翻訳は AI によって生成されており、誤りを含む場合があります。</value></data>
|
||||
<data name="About_AiTitle" xml:space="preserve"><value>AI の利用について</value></data>
|
||||
@@ -63,6 +64,7 @@
|
||||
<data name="ClickType_Right" xml:space="preserve"><value>右クリック</value></data>
|
||||
<data name="Common_Cancel" xml:space="preserve"><value>キャンセル</value></data>
|
||||
<data name="Common_Clear" xml:space="preserve"><value>クリア</value></data>
|
||||
<data name="Common_Close" xml:space="preserve"><value>閉じる</value></data>
|
||||
<data name="Common_Delete" xml:space="preserve"><value>削除</value></data>
|
||||
<data name="Common_FileError" xml:space="preserve"><value>ファイルを読み書きできませんでした: {0}</value></data>
|
||||
<data name="Common_Ok" xml:space="preserve"><value>OK</value></data>
|
||||
@@ -170,12 +172,13 @@
|
||||
<data name="Picker_Empty" xml:space="preserve"><value>ウィンドウが見つかりません。ゲームを起動してから更新してください。</value></data>
|
||||
<data name="Picker_GameTitle" xml:space="preserve"><value>ゲームを追加</value></data>
|
||||
<data name="Picker_Hint" xml:space="preserve"><value>クリックするゲームのウィンドウを選んでください。ウィンドウモードまたはボーダーレスが最適です。</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>使用する位置をクリックします。キー: 1 左 · 2 ダブル · 3 右 · 4 キー入力 · Esc キャンセル</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>使用する位置をクリックするか、矢印キーで移動して (Shift: 1 ピクセル) Enter を押します。キー: 1 左 · 2 ダブル · 3 右 · 4 キー入力 · Esc キャンセル</value></data>
|
||||
<data name="Picker_InstructionKeystroke" xml:space="preserve"><value>送信するキーを押してください。1・2・3 でクリックに戻ります · Esc でキャンセル</value></data>
|
||||
<data name="Picker_RestoreGame" xml:space="preserve"><value>先にゲームウィンドウを元に戻してください (最小化されているか閉じられています)。</value></data>
|
||||
<data name="Picker_Search" xml:space="preserve"><value>名前またはタイトルで検索</value></data>
|
||||
<data name="Picker_Select" xml:space="preserve"><value>追加</value></data>
|
||||
<data name="Picker_Title" xml:space="preserve"><value>位置を選択</value></data>
|
||||
<data name="Picker_WindowList" xml:space="preserve"><value>開いているウィンドウ</value></data>
|
||||
<data name="Profile_Delete" xml:space="preserve"><value>プロファイルを削除</value></data>
|
||||
<data name="Profile_DeleteConfirm" xml:space="preserve"><value>プロファイル「{0}」を削除しますか?</value></data>
|
||||
<data name="Profile_Export" xml:space="preserve"><value>プロファイルをエクスポート</value></data>
|
||||
@@ -269,9 +272,11 @@
|
||||
<data name="Status_Administrator" xml:space="preserve"><value>管理者</value></data>
|
||||
<data name="Status_Idle" xml:space="preserve"><value>準備完了</value></data>
|
||||
<data name="Status_Running" xml:space="preserve"><value>実行中 {0} · 一時停止 {1}</value></data>
|
||||
<data name="Step_Added" xml:space="preserve"><value>追加しました: {0}</value></data>
|
||||
<data name="Step_Double" xml:space="preserve"><value>({0}, {1}) をダブルクリック</value></data>
|
||||
<data name="Step_Key" xml:space="preserve"><value>{0} を押す</value></data>
|
||||
<data name="Step_Left" xml:space="preserve"><value>({0}, {1}) をクリック</value></data>
|
||||
<data name="Step_ReferenceColor" xml:space="preserve"><value>{0}、基準色 {1}</value></data>
|
||||
<data name="Step_Right" xml:space="preserve"><value>({0}, {1}) を右クリック</value></data>
|
||||
<data name="Stop_ColorMismatch" xml:space="preserve"><value>停止: ピクセルの色が一致しませんでした: {0}。</value></data>
|
||||
<data name="Stop_ElevationRequired" xml:space="preserve"><value>ブロック: このゲームは管理者として実行されています。</value></data>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<resheader name="version"><value>2.0</value></resheader>
|
||||
<resheader name="reader"><value>System.Resources.ResXResourceReader</value></resheader>
|
||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter</value></resheader>
|
||||
<data name="About_Accessibility" xml:space="preserve"><value>접근성</value></data>
|
||||
<data name="About_Acknowledgements" xml:space="preserve"><value>감사의 글</value></data>
|
||||
<data name="About_Ai" xml:space="preserve"><value>AutoClick은 AI의 도움을 받아 개발되었습니다. 앱 내 번역은 AI가 생성했으며 오류가 있을 수 있습니다.</value></data>
|
||||
<data name="About_AiTitle" xml:space="preserve"><value>AI 사용 고지</value></data>
|
||||
@@ -63,6 +64,7 @@
|
||||
<data name="ClickType_Right" xml:space="preserve"><value>오른쪽 클릭</value></data>
|
||||
<data name="Common_Cancel" xml:space="preserve"><value>취소</value></data>
|
||||
<data name="Common_Clear" xml:space="preserve"><value>지우기</value></data>
|
||||
<data name="Common_Close" xml:space="preserve"><value>닫기</value></data>
|
||||
<data name="Common_Delete" xml:space="preserve"><value>삭제</value></data>
|
||||
<data name="Common_FileError" xml:space="preserve"><value>파일을 읽거나 저장할 수 없습니다: {0}</value></data>
|
||||
<data name="Common_Ok" xml:space="preserve"><value>확인</value></data>
|
||||
@@ -170,12 +172,13 @@
|
||||
<data name="Picker_Empty" xml:space="preserve"><value>창을 찾을 수 없습니다. 게임을 실행한 뒤 새로 고치세요.</value></data>
|
||||
<data name="Picker_GameTitle" xml:space="preserve"><value>게임 추가</value></data>
|
||||
<data name="Picker_Hint" xml:space="preserve"><value>클릭할 게임 창을 선택하세요. 창 모드나 테두리 없는 창 모드가 가장 좋습니다.</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>사용할 지점을 클릭하세요. 키: 1 왼쪽 · 2 더블 · 3 오른쪽 · 4 키 입력 · Esc 취소</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>사용할 지점을 클릭하거나, 화살표 키로 이동한 뒤(Shift: 1픽셀) Enter를 누르세요. 키: 1 왼쪽 · 2 더블 · 3 오른쪽 · 4 키 입력 · Esc 취소</value></data>
|
||||
<data name="Picker_InstructionKeystroke" xml:space="preserve"><value>보낼 키를 누르세요. 1, 2, 3을 누르면 클릭으로 돌아갑니다 · Esc 취소</value></data>
|
||||
<data name="Picker_RestoreGame" xml:space="preserve"><value>먼저 게임 창을 복원하세요(최소화되었거나 닫혔습니다).</value></data>
|
||||
<data name="Picker_Search" xml:space="preserve"><value>이름 또는 제목으로 검색</value></data>
|
||||
<data name="Picker_Select" xml:space="preserve"><value>추가</value></data>
|
||||
<data name="Picker_Title" xml:space="preserve"><value>지점 선택</value></data>
|
||||
<data name="Picker_WindowList" xml:space="preserve"><value>열린 창</value></data>
|
||||
<data name="Profile_Delete" xml:space="preserve"><value>프로필 삭제</value></data>
|
||||
<data name="Profile_DeleteConfirm" xml:space="preserve"><value>“{0}” 프로필을 삭제할까요?</value></data>
|
||||
<data name="Profile_Export" xml:space="preserve"><value>프로필 내보내기</value></data>
|
||||
@@ -269,9 +272,11 @@
|
||||
<data name="Status_Administrator" xml:space="preserve"><value>관리자</value></data>
|
||||
<data name="Status_Idle" xml:space="preserve"><value>준비됨</value></data>
|
||||
<data name="Status_Running" xml:space="preserve"><value>실행 중 {0} · 일시정지 {1}</value></data>
|
||||
<data name="Step_Added" xml:space="preserve"><value>추가됨: {0}</value></data>
|
||||
<data name="Step_Double" xml:space="preserve"><value>({0}, {1}) 더블 클릭</value></data>
|
||||
<data name="Step_Key" xml:space="preserve"><value>{0} 누르기</value></data>
|
||||
<data name="Step_Left" xml:space="preserve"><value>({0}, {1}) 클릭</value></data>
|
||||
<data name="Step_ReferenceColor" xml:space="preserve"><value>{0}, 기준 색 {1}</value></data>
|
||||
<data name="Step_Right" xml:space="preserve"><value>({0}, {1}) 오른쪽 클릭</value></data>
|
||||
<data name="Stop_ColorMismatch" xml:space="preserve"><value>정지됨: 픽셀 색상이 일치하지 않습니다: {0}.</value></data>
|
||||
<data name="Stop_ElevationRequired" xml:space="preserve"><value>차단됨: 이 게임은 관리자 권한으로 실행 중입니다.</value></data>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<resheader name="version"><value>2.0</value></resheader>
|
||||
<resheader name="reader"><value>System.Resources.ResXResourceReader</value></resheader>
|
||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter</value></resheader>
|
||||
<data name="About_Accessibility" xml:space="preserve"><value>Accessibility</value></data>
|
||||
<data name="About_Acknowledgements" xml:space="preserve"><value>Acknowledgements</value></data>
|
||||
<data name="About_Ai" xml:space="preserve"><value>AutoClick is built with AI assistance. The in-app translations are AI-generated and may contain mistakes.</value></data>
|
||||
<data name="About_AiTitle" xml:space="preserve"><value>AI disclosure</value></data>
|
||||
@@ -63,6 +64,7 @@
|
||||
<data name="ClickType_Right" xml:space="preserve"><value>Right click</value></data>
|
||||
<data name="Common_Cancel" xml:space="preserve"><value>Cancel</value></data>
|
||||
<data name="Common_Clear" xml:space="preserve"><value>Clear</value></data>
|
||||
<data name="Common_Close" xml:space="preserve"><value>Close</value></data>
|
||||
<data name="Common_Delete" xml:space="preserve"><value>Delete</value></data>
|
||||
<data name="Common_FileError" xml:space="preserve"><value>The file could not be read or saved: {0}</value></data>
|
||||
<data name="Common_Ok" xml:space="preserve"><value>OK</value></data>
|
||||
@@ -170,12 +172,13 @@
|
||||
<data name="Picker_Empty" xml:space="preserve"><value>No windows found. Start the game, then refresh.</value></data>
|
||||
<data name="Picker_GameTitle" xml:space="preserve"><value>Add a game</value></data>
|
||||
<data name="Picker_Hint" xml:space="preserve"><value>Pick the window of the game to click. Windowed or borderless mode works best.</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>Click the point to use. Keys: 1 left · 2 double · 3 right · 4 keystroke · Esc cancel</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>Click the point to use, or move with the arrow keys (Shift: 1 pixel) and press Enter. Keys: 1 left · 2 double · 3 right · 4 keystroke · Esc cancel</value></data>
|
||||
<data name="Picker_InstructionKeystroke" xml:space="preserve"><value>Press the key to send. 1, 2 or 3 switches back to clicks · Esc cancels</value></data>
|
||||
<data name="Picker_RestoreGame" xml:space="preserve"><value>Restore the game window first (it is minimized or closed).</value></data>
|
||||
<data name="Picker_Search" xml:space="preserve"><value>Search by name or title</value></data>
|
||||
<data name="Picker_Select" xml:space="preserve"><value>Add</value></data>
|
||||
<data name="Picker_Title" xml:space="preserve"><value>Pick a point</value></data>
|
||||
<data name="Picker_WindowList" xml:space="preserve"><value>Open windows</value></data>
|
||||
<data name="Profile_Delete" xml:space="preserve"><value>Delete profile</value></data>
|
||||
<data name="Profile_DeleteConfirm" xml:space="preserve"><value>Delete the profile “{0}”?</value></data>
|
||||
<data name="Profile_Export" xml:space="preserve"><value>Export profile</value></data>
|
||||
@@ -269,9 +272,11 @@
|
||||
<data name="Status_Administrator" xml:space="preserve"><value>Administrator</value></data>
|
||||
<data name="Status_Idle" xml:space="preserve"><value>Ready</value></data>
|
||||
<data name="Status_Running" xml:space="preserve"><value>{0} running · {1} paused</value></data>
|
||||
<data name="Step_Added" xml:space="preserve"><value>Added: {0}</value></data>
|
||||
<data name="Step_Double" xml:space="preserve"><value>Double-click at ({0}, {1})</value></data>
|
||||
<data name="Step_Key" xml:space="preserve"><value>Press {0}</value></data>
|
||||
<data name="Step_Left" xml:space="preserve"><value>Click at ({0}, {1})</value></data>
|
||||
<data name="Step_ReferenceColor" xml:space="preserve"><value>{0}, reference color {1}</value></data>
|
||||
<data name="Step_Right" xml:space="preserve"><value>Right-click at ({0}, {1})</value></data>
|
||||
<data name="Stop_ColorMismatch" xml:space="preserve"><value>Stopped: the pixel color did not match: {0}.</value></data>
|
||||
<data name="Stop_ElevationRequired" xml:space="preserve"><value>Blocked: this game runs as administrator.</value></data>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<resheader name="version"><value>2.0</value></resheader>
|
||||
<resheader name="reader"><value>System.Resources.ResXResourceReader</value></resheader>
|
||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter</value></resheader>
|
||||
<data name="About_Accessibility" xml:space="preserve"><value>Trợ năng</value></data>
|
||||
<data name="About_Acknowledgements" xml:space="preserve"><value>Ghi nhận</value></data>
|
||||
<data name="About_Ai" xml:space="preserve"><value>AutoClick được xây dựng với sự hỗ trợ của AI. Bản dịch trong ứng dụng do AI tạo và có thể có sai sót.</value></data>
|
||||
<data name="About_AiTitle" xml:space="preserve"><value>Công bố về AI</value></data>
|
||||
@@ -63,6 +64,7 @@
|
||||
<data name="ClickType_Right" xml:space="preserve"><value>Click phải</value></data>
|
||||
<data name="Common_Cancel" xml:space="preserve"><value>Hủy</value></data>
|
||||
<data name="Common_Clear" xml:space="preserve"><value>Xóa</value></data>
|
||||
<data name="Common_Close" xml:space="preserve"><value>Đóng</value></data>
|
||||
<data name="Common_Delete" xml:space="preserve"><value>Xóa</value></data>
|
||||
<data name="Common_FileError" xml:space="preserve"><value>Không thể đọc hoặc lưu tệp: {0}</value></data>
|
||||
<data name="Common_Ok" xml:space="preserve"><value>OK</value></data>
|
||||
@@ -170,12 +172,13 @@
|
||||
<data name="Picker_Empty" xml:space="preserve"><value>Không tìm thấy cửa sổ nào. Hãy mở game rồi làm mới.</value></data>
|
||||
<data name="Picker_GameTitle" xml:space="preserve"><value>Thêm game</value></data>
|
||||
<data name="Picker_Hint" xml:space="preserve"><value>Chọn cửa sổ của game cần click. Chế độ cửa sổ hoặc không viền hoạt động tốt nhất.</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>Click vào điểm cần dùng. Phím: 1 trái · 2 đúp · 3 phải · 4 nhấn phím · Esc hủy</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>Click vào điểm cần dùng, hoặc di chuyển bằng phím mũi tên (Shift: 1 pixel) rồi nhấn Enter. Phím: 1 trái · 2 đúp · 3 phải · 4 nhấn phím · Esc hủy</value></data>
|
||||
<data name="Picker_InstructionKeystroke" xml:space="preserve"><value>Nhấn phím cần gửi. 1, 2 hoặc 3 để quay lại click · Esc để hủy</value></data>
|
||||
<data name="Picker_RestoreGame" xml:space="preserve"><value>Hãy mở lại cửa sổ game trước (đang thu nhỏ hoặc đã đóng).</value></data>
|
||||
<data name="Picker_Search" xml:space="preserve"><value>Tìm theo tên hoặc tiêu đề</value></data>
|
||||
<data name="Picker_Select" xml:space="preserve"><value>Thêm</value></data>
|
||||
<data name="Picker_Title" xml:space="preserve"><value>Chọn điểm</value></data>
|
||||
<data name="Picker_WindowList" xml:space="preserve"><value>Các cửa sổ đang mở</value></data>
|
||||
<data name="Profile_Delete" xml:space="preserve"><value>Xóa hồ sơ</value></data>
|
||||
<data name="Profile_DeleteConfirm" xml:space="preserve"><value>Xóa hồ sơ “{0}”?</value></data>
|
||||
<data name="Profile_Export" xml:space="preserve"><value>Xuất hồ sơ</value></data>
|
||||
@@ -269,9 +272,11 @@
|
||||
<data name="Status_Administrator" xml:space="preserve"><value>Quản trị viên</value></data>
|
||||
<data name="Status_Idle" xml:space="preserve"><value>Sẵn sàng</value></data>
|
||||
<data name="Status_Running" xml:space="preserve"><value>{0} đang chạy · {1} tạm dừng</value></data>
|
||||
<data name="Step_Added" xml:space="preserve"><value>Đã thêm: {0}</value></data>
|
||||
<data name="Step_Double" xml:space="preserve"><value>Click đúp tại ({0}, {1})</value></data>
|
||||
<data name="Step_Key" xml:space="preserve"><value>Nhấn {0}</value></data>
|
||||
<data name="Step_Left" xml:space="preserve"><value>Click tại ({0}, {1})</value></data>
|
||||
<data name="Step_ReferenceColor" xml:space="preserve"><value>{0}, màu tham chiếu {1}</value></data>
|
||||
<data name="Step_Right" xml:space="preserve"><value>Click phải tại ({0}, {1})</value></data>
|
||||
<data name="Stop_ColorMismatch" xml:space="preserve"><value>Đã dừng: màu pixel không khớp: {0}.</value></data>
|
||||
<data name="Stop_ElevationRequired" xml:space="preserve"><value>Bị chặn: game này chạy với quyền quản trị.</value></data>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<resheader name="version"><value>2.0</value></resheader>
|
||||
<resheader name="reader"><value>System.Resources.ResXResourceReader</value></resheader>
|
||||
<resheader name="writer"><value>System.Resources.ResXResourceWriter</value></resheader>
|
||||
<data name="About_Accessibility" xml:space="preserve"><value>无障碍</value></data>
|
||||
<data name="About_Acknowledgements" xml:space="preserve"><value>致谢</value></data>
|
||||
<data name="About_Ai" xml:space="preserve"><value>AutoClick 在 AI 辅助下开发。应用内的翻译由 AI 生成,可能存在错误。</value></data>
|
||||
<data name="About_AiTitle" xml:space="preserve"><value>AI 使用说明</value></data>
|
||||
@@ -63,6 +64,7 @@
|
||||
<data name="ClickType_Right" xml:space="preserve"><value>右键单击</value></data>
|
||||
<data name="Common_Cancel" xml:space="preserve"><value>取消</value></data>
|
||||
<data name="Common_Clear" xml:space="preserve"><value>清除</value></data>
|
||||
<data name="Common_Close" xml:space="preserve"><value>关闭</value></data>
|
||||
<data name="Common_Delete" xml:space="preserve"><value>删除</value></data>
|
||||
<data name="Common_FileError" xml:space="preserve"><value>无法读取或保存文件:{0}</value></data>
|
||||
<data name="Common_Ok" xml:space="preserve"><value>确定</value></data>
|
||||
@@ -170,12 +172,13 @@
|
||||
<data name="Picker_Empty" xml:space="preserve"><value>未找到窗口。请先启动游戏,然后刷新。</value></data>
|
||||
<data name="Picker_GameTitle" xml:space="preserve"><value>添加游戏</value></data>
|
||||
<data name="Picker_Hint" xml:space="preserve"><value>选择要点击的游戏窗口。窗口或无边框模式效果最佳。</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>点击要使用的位置。按键:1 左键 · 2 双击 · 3 右键 · 4 按键 · Esc 取消</value></data>
|
||||
<data name="Picker_Instruction" xml:space="preserve"><value>点击要使用的位置,或用方向键移动(Shift:1 像素)后按 Enter。按键:1 左键 · 2 双击 · 3 右键 · 4 按键 · Esc 取消</value></data>
|
||||
<data name="Picker_InstructionKeystroke" xml:space="preserve"><value>按下要发送的键。按 1、2 或 3 切换回点击 · Esc 取消</value></data>
|
||||
<data name="Picker_RestoreGame" xml:space="preserve"><value>请先还原游戏窗口(已最小化或已关闭)。</value></data>
|
||||
<data name="Picker_Search" xml:space="preserve"><value>按名称或标题搜索</value></data>
|
||||
<data name="Picker_Select" xml:space="preserve"><value>添加</value></data>
|
||||
<data name="Picker_Title" xml:space="preserve"><value>选择位置</value></data>
|
||||
<data name="Picker_WindowList" xml:space="preserve"><value>打开的窗口</value></data>
|
||||
<data name="Profile_Delete" xml:space="preserve"><value>删除配置</value></data>
|
||||
<data name="Profile_DeleteConfirm" xml:space="preserve"><value>删除配置“{0}”?</value></data>
|
||||
<data name="Profile_Export" xml:space="preserve"><value>导出配置</value></data>
|
||||
@@ -269,9 +272,11 @@
|
||||
<data name="Status_Administrator" xml:space="preserve"><value>管理员</value></data>
|
||||
<data name="Status_Idle" xml:space="preserve"><value>就绪</value></data>
|
||||
<data name="Status_Running" xml:space="preserve"><value>运行中 {0} · 已暂停 {1}</value></data>
|
||||
<data name="Step_Added" xml:space="preserve"><value>已添加:{0}</value></data>
|
||||
<data name="Step_Double" xml:space="preserve"><value>双击 ({0}, {1})</value></data>
|
||||
<data name="Step_Key" xml:space="preserve"><value>按 {0}</value></data>
|
||||
<data name="Step_Left" xml:space="preserve"><value>单击 ({0}, {1})</value></data>
|
||||
<data name="Step_ReferenceColor" xml:space="preserve"><value>{0},参考颜色 {1}</value></data>
|
||||
<data name="Step_Right" xml:space="preserve"><value>右键单击 ({0}, {1})</value></data>
|
||||
<data name="Stop_ColorMismatch" xml:space="preserve"><value>已停止:像素颜色不匹配:{0}。</value></data>
|
||||
<data name="Stop_ElevationRequired" xml:space="preserve"><value>被阻止:此游戏以管理员身份运行。</value></data>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
using AutoClick.Core.Abstractions;
|
||||
using AutoClick.Core.Hotkeys;
|
||||
@@ -19,7 +21,7 @@ public enum ToastKind
|
||||
Error,
|
||||
}
|
||||
|
||||
/// <summary>Fluent dialogs, toasts (snackbar) and file pickers for view models.</summary>
|
||||
/// <summary>Fluent dialogs, toasts (snackbar), screen reader announcements and file pickers for view models.</summary>
|
||||
public sealed class DialogService(IContentDialogService dialogs, ISnackbarService snackbar)
|
||||
{
|
||||
public async Task<bool> ConfirmAsync(string title, string message, string confirmText)
|
||||
@@ -50,6 +52,7 @@ public sealed class DialogService(IContentDialogService dialogs, ISnackbarServic
|
||||
public async Task<string?> PromptAsync(string title, string label, string initialValue = "")
|
||||
{
|
||||
var box = new Wpf.Ui.Controls.TextBox { Text = initialValue, MinWidth = 320, PlaceholderText = label };
|
||||
AutomationProperties.SetName(box, label);
|
||||
var panel = new StackPanel();
|
||||
panel.Children.Add(new System.Windows.Controls.TextBlock { Text = label, Margin = new Thickness(0, 0, 0, 8) });
|
||||
panel.Children.Add(box);
|
||||
@@ -134,9 +137,31 @@ public sealed class DialogService(IContentDialogService dialogs, ISnackbarServic
|
||||
if (snackbar.GetSnackbarPresenter() is not null)
|
||||
{
|
||||
snackbar.Show(title, message, appearance, new SymbolIcon(symbol), TimeSpan.FromSeconds(kind == ToastKind.Error ? 8 : 4));
|
||||
// A toast disappears after a few seconds and never takes the focus: read it out.
|
||||
Announce($"{title}: {message}", kind is ToastKind.Warning or ToastKind.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Has screen readers (Narrator, NVDA) read <paramref name="message"/> without moving the
|
||||
/// focus. <paramref name="important"/> messages interrupt what is being read.
|
||||
/// </summary>
|
||||
public static void Announce(string message, bool important = false)
|
||||
{
|
||||
if (!AutomationPeer.ListenerExists(AutomationEvents.Notification)
|
||||
|| Application.Current?.MainWindow is not { IsVisible: true } window
|
||||
|| UIElementAutomationPeer.CreatePeerForElement(window) is not { } peer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
peer.RaiseNotificationEvent(
|
||||
AutomationNotificationKind.Other,
|
||||
important ? AutomationNotificationProcessing.ImportantMostRecent : AutomationNotificationProcessing.MostRecent,
|
||||
message,
|
||||
"AutoClick.Announcement");
|
||||
}
|
||||
|
||||
public static string? PickOpenFile(string filter)
|
||||
{
|
||||
var dialog = new OpenFileDialog { Filter = filter, CheckFileExists = true };
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Interop;
|
||||
@@ -24,8 +25,9 @@ namespace AutoClick.UI.Services;
|
||||
/// <summary>
|
||||
/// <c>--smoke-test</c> (CI and release builds): opens every page in every theme and language,
|
||||
/// the dialogs, the notices and a heatmap overlay, and checks that the text of the pages and the
|
||||
/// charts follows the theme. Exits with 0, or 1 on any exception, data-binding error or wrong
|
||||
/// text color. Runs with a separate data folder, never the user's.
|
||||
/// charts follows the theme, and that screen readers find a name for every control and list item.
|
||||
/// Exits with 0, or 1 on any exception, data-binding error, wrong text color or missing name. Runs
|
||||
/// with a separate data folder, never the user's.
|
||||
/// </summary>
|
||||
public sealed class SmokeTest(
|
||||
MainWindow window,
|
||||
@@ -46,6 +48,7 @@ public sealed class SmokeTest(
|
||||
private static readonly ApplicationTheme[] WindowsThemes = [ApplicationTheme.Dark, ApplicationTheme.Light];
|
||||
|
||||
private int _colorErrors;
|
||||
private int _nameErrors;
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
@@ -91,11 +94,18 @@ public sealed class SmokeTest(
|
||||
await RenderAsync();
|
||||
views++;
|
||||
|
||||
// Colors do not depend on the language.
|
||||
// Colors do not depend on the language, names do not depend on the theme.
|
||||
if (language == AppSettings.SupportedLanguages[0])
|
||||
{
|
||||
CheckPageColors((Page)services.GetRequiredService(page), appTheme.ToString());
|
||||
}
|
||||
|
||||
if (appTheme == Themes[0])
|
||||
{
|
||||
// The first view also covers the window around the page (title bar, navigation).
|
||||
DependencyObject root = views == 1 ? window : (Page)services.GetRequiredService(page);
|
||||
CheckAccessibleNames(root, $"{page.Name} ({language})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,9 +138,9 @@ public sealed class SmokeTest(
|
||||
logger.LogError("Binding error: {Error}", error);
|
||||
}
|
||||
|
||||
exitCode = bindingErrors.Errors.Count == 0 && _colorErrors == 0 ? 0 : 1;
|
||||
logger.LogInformation("Smoke test finished: {Views} page views, {Errors} binding error(s), {ColorErrors} color error(s)",
|
||||
views, bindingErrors.Errors.Count, _colorErrors);
|
||||
exitCode = bindingErrors.Errors.Count == 0 && _colorErrors == 0 && _nameErrors == 0 ? 0 : 1;
|
||||
logger.LogInformation("Smoke test finished: {Views} page views, {Errors} binding error(s), {ColorErrors} color error(s), {NameErrors} name error(s)",
|
||||
views, bindingErrors.Errors.Count, _colorErrors, _nameErrors);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -151,7 +161,7 @@ public sealed class SmokeTest(
|
||||
await Dispatcher.Yield(DispatcherPriority.ApplicationIdle);
|
||||
}
|
||||
|
||||
private static async Task ShowStandaloneAsync(FrameworkElement content)
|
||||
private async Task ShowStandaloneAsync(FrameworkElement content)
|
||||
{
|
||||
var host = new Window
|
||||
{
|
||||
@@ -163,9 +173,58 @@ public sealed class SmokeTest(
|
||||
};
|
||||
host.Show();
|
||||
await RenderAsync();
|
||||
CheckAccessibleNames(host, content.GetType().Name);
|
||||
host.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Screen readers read a control by its name: its text, or AutomationProperties.Name for an
|
||||
/// icon or an input. Every control reachable with the keyboard needs one, and every list item
|
||||
/// needs a readable one (without a name WPF reads the item's ToString, which for a record is a
|
||||
/// dump of its properties and for other types is the type name).
|
||||
/// </summary>
|
||||
private void CheckAccessibleNames(DependencyObject root, string context)
|
||||
{
|
||||
var missing = new List<string>();
|
||||
foreach (var element in Descendants(root).OfType<UIElement>().Where(e => e.IsVisible))
|
||||
{
|
||||
if (UIElementAutomationPeer.CreatePeerForElement(element) is not { } peer)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Tab stops, and lists (whose items are the tab stops but which give them their context).
|
||||
var reachable = element is not Control control || control.IsTabStop || element is ItemsControl;
|
||||
if (reachable && peer.IsControlElement() && peer.IsKeyboardFocusable() && string.IsNullOrWhiteSpace(peer.GetName()))
|
||||
{
|
||||
missing.Add($"{element.GetType().Name} {(element as FrameworkElement)?.Name}".TrimEnd());
|
||||
}
|
||||
|
||||
if (element is ItemsControl)
|
||||
{
|
||||
foreach (var item in peer.GetChildren()?.OfType<ItemAutomationPeer>() ?? [])
|
||||
{
|
||||
if (item.Item is { } data && !IsReadable(item.GetName(), data))
|
||||
{
|
||||
missing.Add($"{element.GetType().Name} item \"{item.GetName()}\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (missing.Count > 0)
|
||||
{
|
||||
_nameErrors++;
|
||||
logger.LogError("Controls without an accessible name in {Context}, {Count} element(s): {Examples}",
|
||||
context, missing.Count, string.Join("; ", missing.Distinct().Take(8)));
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsReadable(string? name, object item) =>
|
||||
!string.IsNullOrWhiteSpace(name)
|
||||
&& name != item.GetType().FullName
|
||||
&& !name.StartsWith(item.GetType().Name + " {", StringComparison.Ordinal);
|
||||
|
||||
/// <summary>
|
||||
/// Text and icons without a color of their own take the color of the page. WPF-UI's implicit
|
||||
/// Page style never reaches page subclasses and the navigation frame does not pass the window's
|
||||
|
||||
@@ -264,6 +264,7 @@ public sealed partial class GameSessionViewModel : ObservableObject, IDisposable
|
||||
Points.Add(point);
|
||||
_deps.Logger.LogInformation("Step {Index} added to {Process}: {Type} ({X}, {Y}) key {Key}", Points.Count, ProcessName, point.ClickType, point.X, point.Y, point.VirtualKeyCode);
|
||||
_deps.Sound.Success();
|
||||
DialogService.Announce(L.Format("Step_Added", Describe(point)));
|
||||
}
|
||||
|
||||
[RelayCommand(CanExecute = nameof(IsIdle))]
|
||||
@@ -285,6 +286,7 @@ public sealed partial class GameSessionViewModel : ObservableObject, IDisposable
|
||||
{
|
||||
Points.Add(point);
|
||||
_deps.Sound.Success();
|
||||
DialogService.Announce(L.Format("Step_Added", Describe(point)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -525,6 +527,9 @@ public sealed partial class GameSessionViewModel : ObservableObject, IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The game as screen readers announce it (the queue lists cards by this text).</summary>
|
||||
public override string ToString() => Window.ToString();
|
||||
|
||||
public static string Describe(ClickPoint point) => point.ClickType switch
|
||||
{
|
||||
ClickType.Keystroke => L.Format("Step_Key", VirtualKeyNames.GetDisplayName(point.VirtualKeyCode)),
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using AutoClick.UI.Localization;
|
||||
|
||||
namespace AutoClick.UI.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Names for parts of WPF-UI templates that have only an icon, which screen readers would read as
|
||||
/// just "button".
|
||||
/// </summary>
|
||||
public static class AccessibleNames
|
||||
{
|
||||
/// <summary>
|
||||
/// On an InfoBar: the localization key of the name of its close button (the template part
|
||||
/// <c>CloseButton</c>). The name follows language changes.
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty CloseButtonProperty = DependencyProperty.RegisterAttached(
|
||||
"CloseButton", typeof(string), typeof(AccessibleNames), new PropertyMetadata(null, OnCloseButtonChanged));
|
||||
|
||||
public static string? GetCloseButton(DependencyObject element) => (string?)element.GetValue(CloseButtonProperty);
|
||||
|
||||
public static void SetCloseButton(DependencyObject element, string? value) => element.SetValue(CloseButtonProperty, value);
|
||||
|
||||
private static void OnCloseButtonChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is Control control)
|
||||
{
|
||||
control.Loaded -= OnLoaded;
|
||||
control.Loaded += OnLoaded;
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var control = (Control)sender;
|
||||
// A closed InfoBar is collapsed and has no template yet.
|
||||
control.ApplyTemplate();
|
||||
if (GetCloseButton(control) is { } key && control.Template?.FindName("CloseButton", control) is UIElement button)
|
||||
{
|
||||
BindingOperations.SetBinding(button, AutomationProperties.NameProperty,
|
||||
new Binding($"[{key}]") { Source = LocalizationService.Instance, Mode = BindingMode.OneWay });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
x:Class="AutoClick.UI.Views.Controls.GameCard"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:AutoClick.UI.Views.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:l="clr-namespace:AutoClick.UI.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
@@ -9,6 +10,7 @@
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:views="clr-namespace:AutoClick.UI.Views"
|
||||
xmlns:vm="clr-namespace:AutoClick.UI.ViewModels"
|
||||
AutomationProperties.Name="{Binding Mode=OneWay}"
|
||||
d:DataContext="{d:DesignInstance vm:GameSessionViewModel, IsDesignTimeCreatable=False}"
|
||||
mc:Ignorable="d">
|
||||
<Border Style="{StaticResource SectionCard}">
|
||||
@@ -34,6 +36,7 @@
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:TextBlock
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{Binding ProcessName}"
|
||||
ToolTip="{Binding ExecutablePath}" />
|
||||
@@ -43,7 +46,7 @@
|
||||
VerticalAlignment="Center"
|
||||
Background="{DynamicResource ControlFillColorSecondaryBrush}"
|
||||
CornerRadius="4">
|
||||
<TextBlock
|
||||
<controls:LiveTextBlock
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
FontSize="12"
|
||||
Text="{Binding StateText}" />
|
||||
@@ -134,7 +137,7 @@
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="Center"
|
||||
Symbol="Warning24" />
|
||||
<TextBlock
|
||||
<controls:LiveTextBlock
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.LiveSetting="Assertive"
|
||||
Text="{Binding StopMessage}"
|
||||
@@ -153,14 +156,29 @@
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,6"
|
||||
AutomationProperties.HeadingLevel="Level3"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Game_Steps}" />
|
||||
<ListBox
|
||||
MaxHeight="220"
|
||||
views:ListReorder.Command="{Binding ReorderPointCommand}"
|
||||
AutomationProperties.Name="{l:Loc Game_Steps}"
|
||||
ItemsSource="{Binding Points}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
ToolTip="{l:Loc Game_StepsTooltip}">
|
||||
<!-- Screen readers read a step by this name (a ClickPoint has no readable ToString). -->
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource DefaultListBoxItemStyle}" TargetType="ListBoxItem">
|
||||
<Setter Property="AutomationProperties.Name">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource StepText}" ConverterParameter="Name">
|
||||
<Binding />
|
||||
<Binding Path="Culture" Source="{x:Static l:LocalizationService.Instance}" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type models:ClickPoint}">
|
||||
<Grid>
|
||||
@@ -291,6 +309,7 @@
|
||||
<StackPanel IsEnabled="{Binding IsIdle}" Visibility="{Binding IsCustomMode, Converter={StaticResource BoolToVisibility}}">
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,6"
|
||||
AutomationProperties.HeadingLevel="Level3"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Timing_Title}" />
|
||||
<ComboBox
|
||||
@@ -343,6 +362,7 @@
|
||||
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,6"
|
||||
AutomationProperties.HeadingLevel="Level3"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Profile_Title}" />
|
||||
<ComboBox
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Automation;
|
||||
using System.Windows.Automation.Peers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace AutoClick.UI.Views.Controls;
|
||||
|
||||
/// <summary>
|
||||
/// A text block whose changes screen readers announce. In WPF,
|
||||
/// <see cref="AutomationProperties.LiveSettingProperty"/> only marks a live region: nothing is read
|
||||
/// until the element raises <see cref="AutomationEvents.LiveRegionChanged"/>, which a plain
|
||||
/// <see cref="TextBlock"/> never does. The announcement waits until the text has been laid out (so
|
||||
/// a message that appears together with its text is read), and comes at most once a second with
|
||||
/// the latest text (so a download percentage is not read for every percent).
|
||||
/// </summary>
|
||||
public sealed class LiveTextBlock : TextBlock
|
||||
{
|
||||
private static readonly TimeSpan MinimumInterval = TimeSpan.FromSeconds(1);
|
||||
private static readonly TimeSpan LayoutDelay = TimeSpan.FromMilliseconds(100);
|
||||
|
||||
private readonly DispatcherTimer _timer;
|
||||
// Environment.TickCount64 of the last announcement (0: none yet, long before any tick count).
|
||||
private long _lastAnnouncement;
|
||||
|
||||
static LiveTextBlock() =>
|
||||
// TextBlock.OnPropertyChanged is sealed; overriding the metadata adds a callback to TextBlock's own.
|
||||
TextProperty.OverrideMetadata(typeof(LiveTextBlock), new FrameworkPropertyMetadata(string.Empty, OnTextChanged));
|
||||
|
||||
public LiveTextBlock()
|
||||
{
|
||||
_timer = new DispatcherTimer(DispatcherPriority.Background, Dispatcher);
|
||||
_timer.Tick += (_, _) =>
|
||||
{
|
||||
_timer.Stop();
|
||||
Announce();
|
||||
};
|
||||
}
|
||||
|
||||
private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var block = (LiveTextBlock)d;
|
||||
if (block._timer.IsEnabled
|
||||
|| AutomationProperties.GetLiveSetting(block) == AutomationLiveSetting.Off
|
||||
|| !AutomationPeer.ListenerExists(AutomationEvents.LiveRegionChanged))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var sinceLast = TimeSpan.FromMilliseconds(Environment.TickCount64 - block._lastAnnouncement);
|
||||
var wait = MinimumInterval - sinceLast;
|
||||
block._timer.Interval = wait > LayoutDelay ? wait : LayoutDelay;
|
||||
block._timer.Start();
|
||||
}
|
||||
|
||||
private void Announce()
|
||||
{
|
||||
if (!IsVisible || string.IsNullOrWhiteSpace(Text))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_lastAnnouncement = Environment.TickCount64;
|
||||
UIElementAutomationPeer.CreatePeerForElement(this)?.RaiseAutomationEvent(AutomationEvents.LiveRegionChanged);
|
||||
}
|
||||
}
|
||||
@@ -21,11 +21,23 @@ public sealed class LocKeyConverter : IMultiValueConverter
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>MultiBinding: [0] a <see cref="ClickPoint"/>, [1] the culture (see <see cref="LocKeyConverter"/>).</summary>
|
||||
/// <summary>
|
||||
/// MultiBinding: [0] a <see cref="ClickPoint"/>, [1] the culture (see <see cref="LocKeyConverter"/>).
|
||||
/// With the parameter <c>Name</c> it gives the name screen readers read, which also tells the
|
||||
/// reference color that the screen shows only as a swatch.
|
||||
/// </summary>
|
||||
public sealed class StepTextConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object?[] values, Type targetType, object? parameter, CultureInfo culture) =>
|
||||
values.Length > 0 && values[0] is ClickPoint point ? GameSessionViewModel.Describe(point) : string.Empty;
|
||||
public object Convert(object?[] values, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (values.Length == 0 || values[0] is not ClickPoint point)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var text = GameSessionViewModel.Describe(point);
|
||||
return parameter is "Name" && point.HasReferenceColor ? L.Format("Step_ReferenceColor", text, ColorRef.ToHex(point.ReferenceColor)) : text;
|
||||
}
|
||||
|
||||
public object?[] ConvertBack(object? value, Type[] targetTypes, object? parameter, CultureInfo culture) =>
|
||||
throw new NotSupportedException();
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBox
|
||||
x:Name="SearchBox"
|
||||
AutomationProperties.Name="{l:Loc Picker_Search}"
|
||||
Icon="{ui:SymbolIcon Search24}"
|
||||
PlaceholderText="{l:Loc Picker_Search}"
|
||||
Text="{Binding Filter, UpdateSourceTrigger=PropertyChanged}" />
|
||||
@@ -47,6 +48,7 @@
|
||||
<Grid Grid.Row="2" Height="360">
|
||||
<ListView
|
||||
x:Name="WindowList"
|
||||
AutomationProperties.Name="{l:Loc Picker_WindowList}"
|
||||
ItemsSource="{Binding Windows}"
|
||||
MouseDoubleClick="OnListDoubleClick"
|
||||
SelectedItem="{Binding Selected, Mode=TwoWay}"
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
x:Class="AutoClick.UI.Views.Dialogs.HotkeyCaptureView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:AutoClick.UI.Views.Controls"
|
||||
xmlns:l="clr-namespace:AutoClick.UI.Localization"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
MinWidth="380"
|
||||
AutomationProperties.Name="{l:Loc Hotkey_Instructions}"
|
||||
Focusable="True">
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
@@ -17,7 +19,7 @@
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="6">
|
||||
<TextBlock
|
||||
<controls:LiveTextBlock
|
||||
x:Name="GestureText"
|
||||
HorizontalAlignment="Center"
|
||||
AutomationProperties.LiveSetting="Assertive"
|
||||
@@ -26,9 +28,10 @@
|
||||
FontWeight="SemiBold"
|
||||
Text="…" />
|
||||
</Border>
|
||||
<ui:TextBlock
|
||||
<controls:LiveTextBlock
|
||||
x:Name="ValidationText"
|
||||
Margin="0,8,0,0"
|
||||
AutomationProperties.LiveSetting="Assertive"
|
||||
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
x:Class="AutoClick.UI.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:AutoClick.UI.Views.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:l="clr-namespace:AutoClick.UI.Localization"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:pages="clr-namespace:AutoClick.UI.Views.Pages"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:views="clr-namespace:AutoClick.UI.Views"
|
||||
xmlns:vm="clr-namespace:AutoClick.UI.ViewModels"
|
||||
Title="{Binding Title}"
|
||||
Width="1180"
|
||||
@@ -45,8 +47,7 @@
|
||||
FrameMargin="0"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsPaneToggleVisible="False"
|
||||
PaneDisplayMode="LeftFluent"
|
||||
Transition="FadeInWithSlide">
|
||||
PaneDisplayMode="LeftFluent">
|
||||
<ui:NavigationView.MenuItems>
|
||||
<ui:NavigationViewItem
|
||||
Content="{l:Loc Nav_Queue}"
|
||||
@@ -74,6 +75,7 @@
|
||||
<ui:InfoBar
|
||||
Title="{l:Loc Notice_AdminTitle}"
|
||||
Margin="0,0,0,8"
|
||||
views:AccessibleNames.CloseButton="Common_Close"
|
||||
IsClosable="True"
|
||||
IsOpen="{Binding ShowAdminNotice, Mode=TwoWay}"
|
||||
Message="{l:Loc Notice_AdminMessage}"
|
||||
@@ -85,6 +87,7 @@
|
||||
<ui:InfoBar
|
||||
Title="{l:Loc Notice_ElevationTitle}"
|
||||
Margin="0,0,0,8"
|
||||
views:AccessibleNames.CloseButton="Common_Close"
|
||||
IsClosable="True"
|
||||
IsOpen="{Binding ShowElevationRequired, Mode=TwoWay}"
|
||||
Message="{Binding ElevationRequiredMessage}"
|
||||
@@ -98,6 +101,7 @@
|
||||
<ui:InfoBar
|
||||
Title="{l:Loc Notice_ElevationDeclinedTitle}"
|
||||
Margin="0,0,0,8"
|
||||
views:AccessibleNames.CloseButton="Common_Close"
|
||||
IsClosable="True"
|
||||
IsOpen="{Binding ShowElevationDeclined, Mode=TwoWay}"
|
||||
Message="{l:Loc Notice_ElevationDeclined}"
|
||||
@@ -105,6 +109,7 @@
|
||||
<ui:InfoBar
|
||||
Title="{l:Loc Notice_SettingsRecoveredTitle}"
|
||||
Margin="0,0,0,8"
|
||||
views:AccessibleNames.CloseButton="Common_Close"
|
||||
IsClosable="True"
|
||||
IsOpen="{Binding ShowSettingsRecovered, Mode=TwoWay}"
|
||||
Message="{Binding SettingsRecoveredMessage}"
|
||||
@@ -114,6 +119,7 @@
|
||||
<ui:InfoBar
|
||||
Title="{l:Loc Notice_UpdateTitle}"
|
||||
Margin="0,0,0,8"
|
||||
views:AccessibleNames.CloseButton="Common_Close"
|
||||
IsClosable="True"
|
||||
IsOpen="{Binding ShowUpdateReady, Mode=TwoWay}"
|
||||
Message="{Binding UpdateReadyMessage}"
|
||||
@@ -148,7 +154,7 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
<controls:LiveTextBlock
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
Text="{Binding Queue.StatusText}" />
|
||||
|
||||
@@ -3,6 +3,7 @@ using AutoClick.UI.Services;
|
||||
using AutoClick.UI.ViewModels;
|
||||
using AutoClick.UI.Views.Pages;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.Animations;
|
||||
|
||||
namespace AutoClick.UI.Views;
|
||||
|
||||
@@ -18,6 +19,9 @@ public partial class MainWindow
|
||||
dialogs.SetDialogHost(RootContentDialog);
|
||||
snackbar.SetSnackbarPresenter(SnackbarPresenter);
|
||||
RootNavigation.SetServiceProvider(services);
|
||||
ApplyMotion();
|
||||
Motion.Changed += OnMotionChanged;
|
||||
Closed += (_, _) => Motion.Changed -= OnMotionChanged;
|
||||
Loaded += (_, _) => Navigate(typeof(QueuePage));
|
||||
}
|
||||
|
||||
@@ -37,4 +41,9 @@ public partial class MainWindow
|
||||
|
||||
base.OnClosing(e);
|
||||
}
|
||||
|
||||
// Pages slide in unless Windows' "Animation effects" are off.
|
||||
private void ApplyMotion() => RootNavigation.Transition = Motion.IsEnabled ? Transition.FadeInWithSlide : Transition.None;
|
||||
|
||||
private void OnMotionChanged(object? sender, EventArgs e) => Dispatcher.Invoke(ApplyMotion);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace AutoClick.UI.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Windows' "Animation effects" setting (Settings → Accessibility → Visual effects). WPF-UI's page
|
||||
/// transitions and LiveCharts' animations do not read it, so the views apply it themselves.
|
||||
/// </summary>
|
||||
public static class Motion
|
||||
{
|
||||
static Motion() => SystemParameters.StaticPropertyChanged += (_, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(SystemParameters.ClientAreaAnimation))
|
||||
{
|
||||
Changed?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>Raised when the Windows setting changes.</summary>
|
||||
public static event EventHandler? Changed;
|
||||
|
||||
/// <summary>False when the user turned animations off in Windows.</summary>
|
||||
public static bool IsEnabled => SystemParameters.ClientAreaAnimation;
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
x:Class="AutoClick.UI.Views.Pages.AboutPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:AutoClick.UI.Views.Controls"
|
||||
xmlns:app="clr-namespace:AutoClick.UI"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:l="clr-namespace:AutoClick.UI.Localization"
|
||||
@@ -19,7 +20,10 @@
|
||||
</Page.Resources>
|
||||
|
||||
<StackPanel Margin="0,8,0,24">
|
||||
<ui:TextBlock FontTypography="Title" Text="{l:Loc Nav_About}" />
|
||||
<ui:TextBlock
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
FontTypography="Title"
|
||||
Text="{l:Loc Nav_About}" />
|
||||
|
||||
<!-- Product -->
|
||||
<Border Margin="0,12,0,12" Style="{StaticResource SectionCard}">
|
||||
@@ -32,6 +36,7 @@
|
||||
Width="56"
|
||||
Height="56"
|
||||
Margin="0,0,16,0"
|
||||
AutomationProperties.Name="AutoClick"
|
||||
VerticalAlignment="Top"
|
||||
Source="pack://application:,,,/Assets/app.ico" />
|
||||
<StackPanel Grid.Column="1">
|
||||
@@ -59,6 +64,7 @@
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,8"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Update_Title}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
@@ -68,7 +74,7 @@
|
||||
Margin="0,0,8,0"
|
||||
IsIndeterminate="True"
|
||||
Visibility="{Binding IsUpdateBusy, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock
|
||||
<controls:LiveTextBlock
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
Text="{Binding UpdateStatus}"
|
||||
@@ -100,6 +106,7 @@
|
||||
<TextBox
|
||||
MaxHeight="200"
|
||||
Margin="0,8,0,0"
|
||||
AutomationProperties.Name="{l:Loc About_Changelog}"
|
||||
FontFamily="Consolas"
|
||||
FontSize="12"
|
||||
IsReadOnly="True"
|
||||
@@ -131,6 +138,7 @@
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,8"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc About_Documents}" />
|
||||
<WrapPanel>
|
||||
@@ -159,6 +167,11 @@
|
||||
Content="{l:Loc About_Security}"
|
||||
Icon="{ui:SymbolIcon ShieldCheckmark24}"
|
||||
Style="{StaticResource LinkButton}" />
|
||||
<ui:Button
|
||||
CommandParameter="{x:Static app:AppLinks.Accessibility}"
|
||||
Content="{l:Loc About_Accessibility}"
|
||||
Icon="{ui:SymbolIcon Accessibility24}"
|
||||
Style="{StaticResource LinkButton}" />
|
||||
<ui:Button
|
||||
CommandParameter="{x:Static app:AppLinks.Acknowledgements}"
|
||||
Content="{l:Loc About_Acknowledgements}"
|
||||
@@ -185,6 +198,7 @@
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,8"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc About_Community}" />
|
||||
<WrapPanel>
|
||||
@@ -231,6 +245,7 @@
|
||||
</WrapPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,8,0,8"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc About_Support}" />
|
||||
<WrapPanel>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
FontTypography="Title"
|
||||
Text="{l:Loc Nav_Dashboard}" />
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
@@ -77,9 +78,12 @@
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,8"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Dashboard_CpmChart}" />
|
||||
<lvc:CartesianChart
|
||||
x:Name="CpmChart"
|
||||
AutomationProperties.Name="{l:Loc Dashboard_CpmChart}"
|
||||
Height="240"
|
||||
AnimationsSpeed="00:00:00.100"
|
||||
Background="Transparent"
|
||||
@@ -100,9 +104,12 @@
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,8"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Dashboard_Ratio}" />
|
||||
<lvc:PieChart
|
||||
x:Name="RatioChart"
|
||||
AutomationProperties.Name="{l:Loc Dashboard_Ratio}"
|
||||
Height="220"
|
||||
AnimationsSpeed="00:00:00.200"
|
||||
Background="Transparent"
|
||||
@@ -115,9 +122,12 @@
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,8"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Dashboard_Breakdown}" />
|
||||
<lvc:CartesianChart
|
||||
x:Name="BreakdownChart"
|
||||
AutomationProperties.Name="{l:Loc Dashboard_Breakdown}"
|
||||
Height="220"
|
||||
AnimationsSpeed="00:00:00.200"
|
||||
Background="Transparent"
|
||||
@@ -134,9 +144,12 @@
|
||||
<StackPanel>
|
||||
<ui:TextBlock
|
||||
Margin="0,0,0,8"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Dashboard_Timeline}" />
|
||||
<lvc:CartesianChart
|
||||
x:Name="TimelineChart"
|
||||
AutomationProperties.Name="{l:Loc Dashboard_Timeline}"
|
||||
Height="220"
|
||||
AnimationsSpeed="00:00:00.100"
|
||||
Background="Transparent"
|
||||
|
||||
@@ -1,12 +1,28 @@
|
||||
using AutoClick.UI.ViewModels;
|
||||
using LiveChartsCore.Kernel.Sketches;
|
||||
|
||||
namespace AutoClick.UI.Views.Pages;
|
||||
|
||||
public partial class DashboardPage
|
||||
{
|
||||
private readonly (IChartView Chart, TimeSpan Speed)[] _charts;
|
||||
|
||||
public DashboardPage(DashboardViewModel viewModel)
|
||||
{
|
||||
DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
|
||||
// The charts animate their updates unless Windows' "Animation effects" are off.
|
||||
_charts = [.. new IChartView[] { CpmChart, RatioChart, BreakdownChart, TimelineChart }.Select(chart => (chart, chart.AnimationsSpeed))];
|
||||
ApplyMotion();
|
||||
Motion.Changed += (_, _) => Dispatcher.Invoke(ApplyMotion);
|
||||
}
|
||||
|
||||
private void ApplyMotion()
|
||||
{
|
||||
foreach (var (chart, speed) in _charts)
|
||||
{
|
||||
chart.AnimationsSpeed = Motion.IsEnabled ? speed : TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,10 @@
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<ui:TextBlock FontTypography="Title" Text="{l:Loc Nav_Queue}" />
|
||||
<ui:TextBlock
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
FontTypography="Title"
|
||||
Text="{l:Loc Nav_Queue}" />
|
||||
<TextBlock Foreground="{DynamicResource TextFillColorSecondaryBrush}" Text="{Binding GamesCountText}" />
|
||||
</StackPanel>
|
||||
<WrapPanel
|
||||
@@ -76,12 +79,13 @@
|
||||
Symbol="CalendarClock24" />
|
||||
<ui:TextBlock
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Schedule_Title}" />
|
||||
<!-- A countdown that changes every second: not a live region, it would be read nonstop. -->
|
||||
<TextBlock
|
||||
Margin="12,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.LiveSetting="Polite"
|
||||
Foreground="{DynamicResource AccentTextFillColorPrimaryBrush}"
|
||||
Text="{Binding ScheduleStatus}" />
|
||||
</StackPanel>
|
||||
@@ -121,8 +125,9 @@
|
||||
Icon="{ui:SymbolIcon Dismiss24}"
|
||||
Visibility="{Binding IsScheduleArmed, Converter={StaticResource BoolToVisibility}}" />
|
||||
</WrapPanel>
|
||||
<TextBlock
|
||||
<controls:LiveTextBlock
|
||||
Margin="0,4,0,0"
|
||||
AutomationProperties.LiveSetting="Assertive"
|
||||
Foreground="{DynamicResource SystemFillColorCriticalBrush}"
|
||||
Text="{Binding ScheduleMessage}"
|
||||
TextWrapping="Wrap"
|
||||
@@ -157,7 +162,11 @@
|
||||
</Border>
|
||||
|
||||
<!-- Games -->
|
||||
<ItemsControl ItemsSource="{Binding Games}">
|
||||
<!-- Only the cards' controls take the focus, not the list itself. -->
|
||||
<ItemsControl
|
||||
AutomationProperties.Name="{l:Loc Nav_Queue}"
|
||||
Focusable="False"
|
||||
ItemsSource="{Binding Games}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type vm:GameSessionViewModel}">
|
||||
<controls:GameCard />
|
||||
@@ -175,6 +184,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:TextBlock
|
||||
VerticalAlignment="Center"
|
||||
AutomationProperties.HeadingLevel="Level2"
|
||||
FontTypography="BodyStrong"
|
||||
Text="{l:Loc Log_Title}" />
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
@@ -200,6 +210,7 @@
|
||||
<ListBox
|
||||
Height="220"
|
||||
views:AutoScroll.IsEnabled="True"
|
||||
AutomationProperties.Name="{l:Loc Log_Title}"
|
||||
FontFamily="Consolas"
|
||||
FontSize="12"
|
||||
ItemsSource="{Binding LogLines}"
|
||||
|
||||
@@ -22,11 +22,19 @@
|
||||
<Setter Property="FontWeight" Value="SemiBold" />
|
||||
<Setter Property="Margin" Value="0,16,0,8" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextFillColorPrimaryBrush}" />
|
||||
<Setter Property="AutomationProperties.HeadingLevel" Value="Level2" />
|
||||
</Style>
|
||||
<!-- WPF-UI's CardControl is a button: without this, every card was an extra Tab stop without a name. -->
|
||||
<Style BasedOn="{StaticResource {x:Type ui:CardControl}}" TargetType="ui:CardControl">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
</Style>
|
||||
</Page.Resources>
|
||||
|
||||
<StackPanel Margin="0,8,0,24">
|
||||
<ui:TextBlock FontTypography="Title" Text="{l:Loc Nav_Settings}" />
|
||||
<ui:TextBlock
|
||||
AutomationProperties.HeadingLevel="Level1"
|
||||
FontTypography="Title"
|
||||
Text="{l:Loc Nav_Settings}" />
|
||||
|
||||
<!-- Appearance -->
|
||||
<TextBlock Style="{StaticResource GroupTitle}" Text="{l:Loc Settings_Appearance}" />
|
||||
@@ -223,7 +231,15 @@
|
||||
<ui:Button
|
||||
Command="{Binding RecordHotkeyCommand}"
|
||||
CommandParameter="{x:Static services:HotkeyAction.PauseResume}"
|
||||
Content="{l:Loc Hotkey_Change}" />
|
||||
Content="{l:Loc Hotkey_Change}">
|
||||
<!-- Three "Change" buttons: tell screen readers which hotkey and its keys. -->
|
||||
<AutomationProperties.HelpText>
|
||||
<MultiBinding StringFormat="{}{0}: {1}">
|
||||
<Binding Path="[Hotkey_PauseResume]" Source="{x:Static l:LocalizationService.Instance}" />
|
||||
<Binding Path="PauseResumeHotkey" />
|
||||
</MultiBinding>
|
||||
</AutomationProperties.HelpText>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
</ui:CardControl>
|
||||
<ui:CardControl Margin="0,0,0,4" Icon="{ui:SymbolIcon Keyboard24}">
|
||||
@@ -246,7 +262,15 @@
|
||||
<ui:Button
|
||||
Command="{Binding RecordHotkeyCommand}"
|
||||
CommandParameter="{x:Static services:HotkeyAction.StopAll}"
|
||||
Content="{l:Loc Hotkey_Change}" />
|
||||
Content="{l:Loc Hotkey_Change}">
|
||||
<!-- Three "Change" buttons: tell screen readers which hotkey and its keys. -->
|
||||
<AutomationProperties.HelpText>
|
||||
<MultiBinding StringFormat="{}{0}: {1}">
|
||||
<Binding Path="[Hotkey_StopAll]" Source="{x:Static l:LocalizationService.Instance}" />
|
||||
<Binding Path="StopAllHotkey" />
|
||||
</MultiBinding>
|
||||
</AutomationProperties.HelpText>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
</ui:CardControl>
|
||||
<ui:CardControl Margin="0,0,0,4" Icon="{ui:SymbolIcon Keyboard24}">
|
||||
@@ -269,7 +293,15 @@
|
||||
<ui:Button
|
||||
Command="{Binding RecordHotkeyCommand}"
|
||||
CommandParameter="{x:Static services:HotkeyAction.StartAll}"
|
||||
Content="{l:Loc Hotkey_Change}" />
|
||||
Content="{l:Loc Hotkey_Change}">
|
||||
<!-- Three "Change" buttons: tell screen readers which hotkey and its keys. -->
|
||||
<AutomationProperties.HelpText>
|
||||
<MultiBinding StringFormat="{}{0}: {1}">
|
||||
<Binding Path="[Hotkey_StartAll]" Source="{x:Static l:LocalizationService.Instance}" />
|
||||
<Binding Path="StartAllHotkey" />
|
||||
</MultiBinding>
|
||||
</AutomationProperties.HelpText>
|
||||
</ui:Button>
|
||||
</StackPanel>
|
||||
</ui:CardControl>
|
||||
<ui:Button
|
||||
|
||||
@@ -10,6 +10,7 @@ GetClientRect
|
||||
ClientToScreen
|
||||
ScreenToClient
|
||||
GetCursorPos
|
||||
SetCursorPos
|
||||
EnumWindows
|
||||
GetWindow
|
||||
GetAncestor
|
||||
|
||||
@@ -19,10 +19,7 @@ public sealed class ShellLauncher(IElevationService elevation)
|
||||
{
|
||||
try
|
||||
{
|
||||
var startInfo = elevation.IsCurrentProcessElevated
|
||||
? new ProcessStartInfo(ExplorerPath) { ArgumentList = { target }, UseShellExecute = false }
|
||||
: new ProcessStartInfo(target) { UseShellExecute = true };
|
||||
using var process = Process.Start(startInfo);
|
||||
using var process = Process.Start(StartInfo(target, elevation.IsCurrentProcessElevated));
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex) when (ex is Win32Exception or InvalidOperationException)
|
||||
@@ -30,4 +27,9 @@ public sealed class ShellLauncher(IElevationService elevation)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal static ProcessStartInfo StartInfo(string target, bool elevated) =>
|
||||
elevated
|
||||
? new ProcessStartInfo(ExplorerPath) { ArgumentList = { target }, UseShellExecute = false }
|
||||
: new ProcessStartInfo(target) { UseShellExecute = true };
|
||||
}
|
||||
@@ -46,6 +46,23 @@ public static class WindowGeometry
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the real pointer <paramref name="dx"/>, <paramref name="dy"/> physical pixels, kept
|
||||
/// inside <paramref name="window"/>'s client area (see <see cref="DpiMath.MovePointer"/>), for
|
||||
/// the coordinate picker's arrow keys. Returns the new position in physical screen pixels.
|
||||
/// </summary>
|
||||
public static PixelPoint? MovePointerWithinClient(nint window, int dx, int dy)
|
||||
{
|
||||
using var scope = DpiScope.PerMonitorV2();
|
||||
if (!TryGetPhysicalClientRect(window, out var rect) || !PInvoke.GetCursorPos(out var cursor))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var target = DpiMath.MovePointer(new PixelPoint(cursor.X, cursor.Y), rect, dx, dy);
|
||||
return PInvoke.SetCursorPos(target.X, target.Y) ? target : null;
|
||||
}
|
||||
|
||||
public static uint GetDpi(nint window) => PInvoke.GetDpiForWindow((HWND)window);
|
||||
|
||||
/// <summary>True when <paramref name="window"/> or one of its owned dialogs is in the foreground.</summary>
|
||||
|
||||
@@ -63,4 +63,32 @@ public class DpiMathTests
|
||||
{
|
||||
Assert.Equal(expected, DpiMath.IsInsideClient(x, y, 1280, 720));
|
||||
}
|
||||
|
||||
// A game on a second monitor, left of the primary one.
|
||||
private static readonly PixelRect GameArea = new(-1920, 100, 1280, 720);
|
||||
|
||||
[Theory]
|
||||
[InlineData(-1500, 400, 10, 0, -1490, 400)]
|
||||
[InlineData(-1500, 400, 0, -1, -1500, 399)]
|
||||
[InlineData(-1915, 400, -10, 0, -1920, 400)]
|
||||
[InlineData(-645, 815, 10, 10, -641, 819)]
|
||||
public void MovePointer_MovesInsideTheArea(int x, int y, int dx, int dy, int expectedX, int expectedY)
|
||||
{
|
||||
Assert.Equal(new PixelPoint(expectedX, expectedY), DpiMath.MovePointer(new PixelPoint(x, y), GameArea, dx, dy));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0, 0)]
|
||||
[InlineData(-640, 400)]
|
||||
[InlineData(-1500, 820)]
|
||||
public void MovePointer_StartsFromTheCenterWhenOutside(int x, int y)
|
||||
{
|
||||
Assert.Equal(new PixelPoint(-1280, 460), DpiMath.MovePointer(new PixelPoint(x, y), GameArea, 10, 0));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MovePointer_LeavesThePointerForAnEmptyArea()
|
||||
{
|
||||
Assert.Equal(new PixelPoint(5, 5), DpiMath.MovePointer(new PixelPoint(5, 5), new PixelRect(0, 0, 0, 0), 10, 0));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.IO;
|
||||
using AutoClick.Core.Abstractions;
|
||||
|
||||
namespace AutoClick.Win32.Tests;
|
||||
|
||||
public class ShellLauncherTests
|
||||
{
|
||||
[Fact]
|
||||
public void StartInfo_Elevated_StartsExplorerByItsFullPath()
|
||||
{
|
||||
var startInfo = ShellLauncher.StartInfo("https://example.com", elevated: true);
|
||||
|
||||
// A bare "explorer.exe" would be searched in AutoClick's own, user-writable folder first.
|
||||
Assert.True(Path.IsPathFullyQualified(startInfo.FileName));
|
||||
Assert.Equal(Environment.GetFolderPath(Environment.SpecialFolder.Windows), Path.GetDirectoryName(startInfo.FileName), ignoreCase: true);
|
||||
Assert.Equal("explorer.exe", Path.GetFileName(startInfo.FileName), ignoreCase: true);
|
||||
Assert.True(File.Exists(startInfo.FileName));
|
||||
Assert.Equal("https://example.com", Assert.Single(startInfo.ArgumentList));
|
||||
Assert.False(startInfo.UseShellExecute);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryOpen_MissingFile_ReturnsFalse()
|
||||
{
|
||||
// Not elevated: the default handler reports the missing file without showing any UI.
|
||||
var launcher = new ShellLauncher(new NotElevated());
|
||||
|
||||
Assert.False(launcher.TryOpen(Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid():N}.autoclick-missing")));
|
||||
}
|
||||
|
||||
private sealed class NotElevated : IElevationService
|
||||
{
|
||||
public bool IsCurrentProcessElevated => false;
|
||||
|
||||
public ElevationState GetRelativeElevation(int processId) => ElevationState.SameOrLower;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,13 @@ public class WindowAndSystemTests
|
||||
Assert.Equal(ElevationState.Unknown, new ElevationService().GetRelativeElevation(int.MaxValue - 1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Elevation_CurrentProcess_MatchesTheRuntime()
|
||||
{
|
||||
// Opens the token of the GetCurrentProcess pseudo-handle (-1) through CsWin32's SafeHandle overloads.
|
||||
Assert.Equal(Environment.IsPrivilegedProcess, new ElevationService().IsCurrentProcessElevated);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Inspector_InvalidHandle_IsGone()
|
||||
{
|
||||
@@ -78,6 +85,41 @@ public class WindowAndSystemTests
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WinEventWatcher_LocationChange_ReportsMovesUntilDisposed()
|
||||
{
|
||||
StaThread.Run(() =>
|
||||
{
|
||||
var window = CreateWindow(Colors.Black);
|
||||
try
|
||||
{
|
||||
var handle = new WindowInteropHelper(window).Handle;
|
||||
var moved = new TaskCompletionSource();
|
||||
var moves = 0;
|
||||
using (WinEventWatcher.LocationChange(handle, Environment.ProcessId, () =>
|
||||
{
|
||||
moves++;
|
||||
moved.TrySetResult();
|
||||
}))
|
||||
{
|
||||
window.Left += 30;
|
||||
StaThread.PumpUntil(moved.Task, TimeSpan.FromSeconds(5));
|
||||
Assert.True(moved.Task.IsCompleted, "No location change event arrived.");
|
||||
}
|
||||
|
||||
// Disposing the watcher unhooks it: later moves are not reported.
|
||||
var reported = moves;
|
||||
window.Left += 30;
|
||||
StaThread.PumpFor(TimeSpan.FromMilliseconds(300));
|
||||
Assert.Equal(reported, moves);
|
||||
}
|
||||
finally
|
||||
{
|
||||
window.Close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Hotkeys_RegisterReportsConflictsAndReservedKeys()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user