docs(01-07): complete ProfileManagementDialog + SettingsView plan

- Create 01-07-SUMMARY.md with full documentation
- Update STATE.md: progress 88%, decisions added, session recorded
- Update ROADMAP.md: Phase 1 at 7/8 plans
This commit is contained in:
Dev
2026-04-02 12:40:36 +02:00
parent 0665152e0d
commit 405a013375
3 changed files with 161 additions and 6 deletions

View File

@@ -0,0 +1,151 @@
---
phase: 01-foundation
plan: 07
subsystem: ui
tags: [wpf, dotnet10, csharp, mvvm, xaml, localization, community-toolkit-mvvm, dependency-injection]
# Dependency graph
requires:
- 01-06 (ProfileManagementViewModel + SettingsViewModel + MainWindow shell + FeatureTabBase + App DI registration)
- 01-05 (TranslationSource.Instance for all XAML bindings; profile.* and settings.* resx keys)
provides:
- ProfileManagementDialog: modal Window for profile CRUD (Name/TenantUrl/ClientId fields), wired to ProfileManagementViewModel via DI
- SettingsView: UserControl with language ComboBox (en/fr) and data folder TextBox + Browse button, wired to SettingsViewModel via DI
- MainWindow Settings tab: SettingsView injected as tab content from code-behind (DI-resolved)
- ManageProfilesCommand: now opens ProfileManagementDialog as modal, reloads profiles on close
affects:
- 01-08 (visual checkpoint — all Phase 1 UI is now complete)
- 02-xx (SettingsView provides language switching in production UX; ProfileManagementDialog enables profile management)
# Tech tracking
tech-stack:
added: []
patterns:
- View-layer dialog factory: MainWindowViewModel.OpenProfileManagementDialog Func<Window> delegate set by MainWindow constructor — keeps ViewModel free of Window references
- DI-resolved tab content: SettingsTabItem.Content set programmatically from MainWindow constructor via serviceProvider.GetRequiredService<SettingsView>() — enables constructor injection for UserControl
- Dialog modal pattern: ProfileManagementDialog opened via factory, Owner=Application.Current.MainWindow, ShowDialog() blocks; LoadProfilesAsync() called after close to refresh ComboBox
key-files:
created:
- SharepointToolbox/Views/Dialogs/ProfileManagementDialog.xaml
- SharepointToolbox/Views/Dialogs/ProfileManagementDialog.xaml.cs
- SharepointToolbox/Views/Tabs/SettingsView.xaml
- SharepointToolbox/Views/Tabs/SettingsView.xaml.cs
modified:
- SharepointToolbox/ViewModels/MainWindowViewModel.cs
- SharepointToolbox/MainWindow.xaml
- SharepointToolbox/MainWindow.xaml.cs
- SharepointToolbox/App.xaml.cs
key-decisions:
- "ProfileManagementViewModel dialog factory pattern — ViewModel exposes Func<Window>? OpenProfileManagementDialog set by View layer; avoids Window/DI coupling in ViewModel"
- "IServiceProvider injected into MainWindow constructor — required to resolve DI-registered ProfileManagementDialog and SettingsView at runtime"
- "ProfileManagementDialog and SettingsView registered as Transient — each dialog open or tab init creates fresh instance with fresh ViewModel"
patterns-established:
- "Dialog factory via ViewModel delegate: ViewModel exposes Func<Window>? delegate, View layer sets it in constructor — ViewModel stays testable without Window dependency"
- "UserControl DI injection: SettingsView receives SettingsViewModel via constructor injection; content set on TabItem from code-behind using serviceProvider"
requirements-completed:
- FOUND-02
- FOUND-09
- FOUND-12
# Metrics
duration: 3min
completed: 2026-04-02
---
# Phase 1 Plan 07: Views (ProfileManagementDialog + SettingsView) Summary
**ProfileManagementDialog modal and SettingsView UserControl wired into MainWindow via DI factory pattern, completing all Phase 1 user-facing UI**
## Performance
- **Duration:** 3 min
- **Started:** 2026-04-02T10:36:05Z
- **Completed:** 2026-04-02T10:38:57Z
- **Tasks:** 2
- **Files modified:** 8
## Accomplishments
- ProfileManagementDialog is a modal Window with Name / Tenant URL / Client ID input fields, all labels using TranslationSource bindings, wired to ProfileManagementViewModel via DI constructor injection; LoadAsync called on Loaded event
- ManageProfilesCommand now fully functional: opens dialog as modal with Owner=MainWindow, reloads TenantProfiles ObservableCollection after ShowDialog() returns
- SettingsView UserControl contains language ComboBox with Tag="en"/Tag="fr" items and data folder TextBox + Browse button, bound to SettingsViewModel, LoadAsync on Loaded
- Settings TabItem content replaced at runtime with DI-resolved SettingsView (from Transient registration), eliminating the placeholder TextBlock
- All 42 unit tests pass (0 regressions), 0 build errors
## Task Commits
1. **Task 1: ProfileManagementDialog XAML and code-behind** - `cb7cf93` (feat)
2. **Task 2: SettingsView XAML and MainWindow Settings tab wiring** - `0665152` (feat)
**Plan metadata:** (docs commit follows)
## Files Created/Modified
- `SharepointToolbox/Views/Dialogs/ProfileManagementDialog.xaml` — Modal Window with ListBox (profile list), three input fields (Name/TenantUrl/ClientId), Add/Rename/Delete/Close buttons
- `SharepointToolbox/Views/Dialogs/ProfileManagementDialog.xaml.cs` — DI constructor injection of ProfileManagementViewModel; LoadAsync on Loaded; CloseButton_Click calls Close()
- `SharepointToolbox/Views/Tabs/SettingsView.xaml` — UserControl with language ComboBox (en/fr with TranslationSource bindings) and DockPanel data folder row
- `SharepointToolbox/Views/Tabs/SettingsView.xaml.cs` — DI constructor injection of SettingsViewModel; LoadAsync on Loaded
- `SharepointToolbox/ViewModels/MainWindowViewModel.cs` — Added OpenProfileManagementDialog Func<Window>? delegate; OpenProfileManagement() now opens dialog, sets Owner, calls ShowDialog(), reloads profiles
- `SharepointToolbox/MainWindow.xaml` — Added xmlns:views namespace; removed placeholder TextBlock from SettingsTabItem
- `SharepointToolbox/MainWindow.xaml.cs` — Accepts IServiceProvider; sets OpenProfileManagementDialog factory; sets SettingsTabItem.Content to DI-resolved SettingsView
- `SharepointToolbox/App.xaml.cs` — Registered ProfileManagementDialog and SettingsView as Transient; added using directives for Views.Dialogs and Views.Tabs
## Decisions Made
- `ProfileManagementViewModel` exposes `Func<Window>? OpenProfileManagementDialog` delegate set by `MainWindow.xaml.cs` — keeps ViewModel free from Window/UI references while enabling full dialog lifecycle control (Owner, ShowDialog, post-close reload).
- `IServiceProvider` injected into `MainWindow` constructor — automatically resolved by Microsoft.Extensions.DI since `IServiceProvider` is registered as singleton in every host; allows resolving Transient views without `ServiceLocator` antipattern.
- `ProfileManagementDialog` and `SettingsView` registered as `Transient` — each invocation produces a fresh instance with a fresh ViewModel, avoiding state leakage between dialog opens.
## Deviations from Plan
### Auto-fixed Issues
**1. [Rule 3 - Blocking] Created SettingsView before Task 1 build verification**
- **Found during:** Task 1 (dotnet build after adding SettingsView usings to App.xaml.cs and MainWindow.xaml.cs)
- **Issue:** App.xaml.cs and MainWindow.xaml.cs reference `SharepointToolbox.Views.Tabs.SettingsView` which did not exist yet; build failed with CS0234
- **Fix:** Created SettingsView.xaml and SettingsView.xaml.cs as part of Task 1 execution before first build verification; committed both tasks as separate commits once both verified clean
- **Files modified:** SharepointToolbox/Views/Tabs/SettingsView.xaml, SharepointToolbox/Views/Tabs/SettingsView.xaml.cs
- **Verification:** Build succeeded with 0 errors; all 42 unit tests pass
- **Committed in:** 0665152 (Task 2 commit)
---
**Total deviations:** 1 auto-fixed (1 Rule 3 blocking build issue)
**Impact on plan:** Fix necessary for compilation — Tasks 1 and 2 share compile-time dependencies that required creating SettingsView before the first Task 1 build check. Plan intent fully preserved.
## Issues Encountered
None beyond the auto-fixed deviation above.
## User Setup Required
None — no external service configuration required.
## Next Phase Readiness
- All Phase 1 UI is now built: shell (plan 01-06) + ProfileManagementDialog + SettingsView (this plan)
- Application is ready for the Phase 1 visual checkpoint (plan 01-08): user can create tenant profile, connect, switch language, configure data folder
- Language switching is immediate (TranslationSource.Instance.CurrentCulture) with no restart required
- Profile CRUD fully wired: Add/Rename/Delete commands in dialog refresh MainWindow toolbar ComboBox after close
- SettingsView language and folder settings persist to Sharepoint_Settings.json via SettingsService
## Self-Check: PASSED
- FOUND: SharepointToolbox/Views/Dialogs/ProfileManagementDialog.xaml
- FOUND: SharepointToolbox/Views/Dialogs/ProfileManagementDialog.xaml.cs
- FOUND: SharepointToolbox/Views/Tabs/SettingsView.xaml
- FOUND: SharepointToolbox/Views/Tabs/SettingsView.xaml.cs
- FOUND: SharepointToolbox/ViewModels/MainWindowViewModel.cs (contains OpenProfileManagementDialog)
- FOUND: SharepointToolbox/MainWindow.xaml (contains xmlns:views)
- FOUND: SharepointToolbox/MainWindow.xaml.cs (contains IServiceProvider injection)
- FOUND: SharepointToolbox/App.xaml.cs (contains ProfileManagementDialog registration)
- Commit cb7cf93: feat(01-07): add ProfileManagementDialog with DI factory wiring
- Commit 0665152: feat(01-07): add SettingsView and wire into MainWindow Settings tab
---
*Phase: 01-foundation*
*Completed: 2026-04-02*