docs/docs-as-code.md defines the workflow; docs/adr holds 31 ADRs (retroactive, reconstructed from code and changelog) with a template and index. docs/check-docs.sh validates ADR structure, index, cited code paths, relative links and CLAUDE.md/AGENTS.md sync.
1.0 KiB
1.0 KiB
0020. A single ViewModel split into partial classes by feature
- Status: Accepted
- Area: UI
- Recorded: 2026-11-03 (retroactive: reconstructed from code, comments and changelog)
Context
The UI is one MainView with many overlays sharing wallet, sync and connection state; many small ViewModels would need heavy cross-wiring.
Decision
Use one MainWindowViewModel (CommunityToolkit.Mvvm: [ObservableProperty], [RelayCommand]) that drives Core directly, split into partial classes by feature (.Send, .Receive, .Sync, .Settings, .Wizard, .Contacts, .Update, .WalletInfo, .Donate). New feature logic goes into the matching partial or a new one.
Consequences
- Shared state needs no messaging layer.
- The class is large; discipline on partial boundaries is what keeps it navigable.
- Heavy network work must run off the UI thread (
Task.Run).
References
src/App/ViewModels/MainWindowViewModel.cssrc/App/ViewModels/MainWindowViewModel.Send.cssrc/App/ViewModels/MainWindowViewModel.Sync.cs