refactor(rules): keep WPF index focused
This commit is contained in:
1 parent
c91505a568
commit
ca9f6296d6
3 files changed
+14
-32
No files matched your search
+10
-32
@@ -1,34 +1,12 @@
|
||||
# WPF Code Guidelines
|
||||
# WPF Rules
|
||||
|
||||
* Use modern C# and current .NET/WPF conventions.
|
||||
* Keep UI, application logic and domain logic clearly separated.
|
||||
* Prefer MVVM for non-trivial views.
|
||||
* Keep code-behind minimal.
|
||||
* Use code-behind only for view-specific behavior that does not belong in the ViewModel.
|
||||
* Avoid business logic in views.
|
||||
* Avoid direct service access from controls.
|
||||
* Keep dependencies explicit and testable.
|
||||
* Prefer composition over inheritance.
|
||||
* Avoid unnecessary abstractions and framework wrappers.
|
||||
* Follow the existing project architecture unless there is a strong reason to change it.
|
||||
For WPF, XAML, or MVVM work, open only the focused topic rules relevant to the change.
|
||||
|
||||
## Safety Rule
|
||||
|
||||
* The UI must remain responsive.
|
||||
* Do not block the UI thread with I/O or expensive CPU work.
|
||||
* Do not bypass validation or security controls for convenience.
|
||||
* Do not introduce hidden cross-thread access.
|
||||
* Prefer predictable, explicit and testable UI behavior.
|
||||
|
||||
## Detailed guidance
|
||||
|
||||
Read the matching reference file before working in that area:
|
||||
|
||||
| Read this reference for... | ...this kind of work |
|
||||
| --- | --- |
|
||||
| `references/mvvm-and-binding.md` | MVVM, data binding, property change notifications, dependency/attached properties |
|
||||
| `references/commands-and-async.md` | Commands, async/threading, UI-thread work, events |
|
||||
| `references/collections-and-xaml.md` | Collections, virtualization, layout, XAML |
|
||||
| `references/resources-and-lifecycle.md` | Resources/styles, windows/dialogs, navigation, memory, images/media |
|
||||
| `references/security-and-errors.md` | Security, file/process access, error handling, logging, validation |
|
||||
| `references/architecture-and-quality.md` | Architecture, DI, testing, code quality, performance |
|
||||
| Topic | Codex rule | Claude skill |
|
||||
| --- | --- | --- |
|
||||
| MVVM and binding | `references/mvvm-and-binding.md` | `rules-wpf-mvvm-and-binding` |
|
||||
| Commands, async, and threading | `references/commands-and-async.md` | `rules-wpf-commands-and-async` |
|
||||
| Collections and XAML | `references/collections-and-xaml.md` | `rules-wpf-collections-and-xaml` |
|
||||
| Resources and lifecycle | `references/resources-and-lifecycle.md` | `rules-wpf-resources-and-lifecycle` |
|
||||
| Security and errors | `references/security-and-errors.md` | `rules-wpf-security-and-errors` |
|
||||
| Architecture, testing, and performance | `references/architecture-and-quality.md` | `rules-wpf-architecture-and-quality` |
|
||||
@@ -1,5 +1,8 @@
|
||||
## Architecture
|
||||
|
||||
* Use modern C# and current WPF conventions. Prefer MVVM for non-trivial views and keep code-behind limited to view-specific behavior.
|
||||
* Keep UI, application, and domain logic separate. Avoid business logic in views and direct service access from controls.
|
||||
* Keep dependencies explicit and testable; prefer composition over inheritance and avoid unnecessary abstractions or framework wrappers.
|
||||
* Keep presentation, application, domain and infrastructure concerns separated.
|
||||
* Avoid direct database access from views or ViewModels.
|
||||
* Avoid direct HTTP access from controls.
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
## UI Thread
|
||||
|
||||
* Treat the UI thread as a scarce resource.
|
||||
* Keep the interface responsive and do not block the UI thread with I/O or expensive CPU work. Move CPU work off-thread only when needed and marshal UI changes back explicitly.
|
||||
* Avoid expensive loops, parsing, serialization, database access or network calls on the UI thread.
|
||||
* Avoid excessive Dispatcher invocations.
|
||||
* Batch UI updates where practical.
|
||||
|
||||
Reference in new issue
Block a user