---
phase: 06-global-site-selection
plan: 03
type: execute
wave: 2
depends_on: [06-02]
files_modified:
- SharepointToolbox/MainWindow.xaml
- SharepointToolbox/MainWindow.xaml.cs
- SharepointToolbox/Localization/Strings.resx
- SharepointToolbox/Localization/Strings.fr.resx
- SharepointToolbox/ViewModels/MainWindowViewModel.cs
autonomous: true
requirements:
- SITE-01
must_haves:
truths:
- "A 'Select Sites' button is visible in the toolbar after the Clear Session button"
- "A label next to the button shows the count of selected sites (e.g., '3 site(s) selected') or 'No sites selected'"
- "Clicking the button opens SitePickerDialog and updates the global selection"
- "The button is disabled when no tenant profile is connected"
- "The button and label use localized strings (EN + FR)"
- "The global site selection persists across tab switches (lives on MainWindowViewModel)"
artifacts:
- path: "SharepointToolbox/MainWindow.xaml"
provides: "Toolbar with global site picker button and count label"
contains: "OpenGlobalSitePickerCommand"
- path: "SharepointToolbox/MainWindow.xaml.cs"
provides: "SitePickerDialog factory wiring for toolbar"
contains: "OpenGlobalSitePickerDialog"
- path: "SharepointToolbox/Localization/Strings.resx"
provides: "EN localization keys for global site picker"
contains: "toolbar.selectSites"
- path: "SharepointToolbox/Localization/Strings.fr.resx"
provides: "FR localization keys for global site picker"
contains: "toolbar.selectSites"
key_links:
- from: "SharepointToolbox/MainWindow.xaml"
to: "SharepointToolbox/ViewModels/MainWindowViewModel.cs"
via: "Command binding for OpenGlobalSitePickerCommand"
pattern: "OpenGlobalSitePickerCommand"
- from: "SharepointToolbox/MainWindow.xaml.cs"
to: "SharepointToolbox/Views/Dialogs/SitePickerDialog.xaml.cs"
via: "Dialog factory lambda using DI"
pattern: "OpenGlobalSitePickerDialog"
---
Add the global site picker button and count label to the main toolbar, wire the SitePickerDialog factory from code-behind, add localization keys for all new toolbar strings, and update MainWindowViewModel to use localized label text.
Purpose: Makes the global site selection visible and interactive in the UI. Users see the button at all times regardless of active tab.
Output: Updated MainWindow.xaml with toolbar controls, MainWindow.xaml.cs with dialog wiring, localization files with new EN/FR keys, MainWindowViewModel using localized label.
@C:/Users/SebastienQUEROL/.claude/get-shit-done/workflows/execute-plan.md
@C:/Users/SebastienQUEROL/.claude/get-shit-done/templates/summary.md
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/06-global-site-selection/06-CONTEXT.md
@.planning/phases/06-global-site-selection/06-02-SUMMARY.md
```csharp
public ObservableCollection GlobalSelectedSites { get; }
public string GlobalSitesSelectedLabel { get; } // "3 site(s) selected" or "No sites selected"
public RelayCommand OpenGlobalSitePickerCommand { get; }
public Func? OpenGlobalSitePickerDialog { get; set; } // Factory set by code-behind
```
From SharepointToolbox/MainWindow.xaml (ToolBar section):
```xml
```
From SharepointToolbox/Views/Tabs/PermissionsView.xaml.cs:
```csharp
vm.OpenSitePickerDialog = () =>
{
var factory = serviceProvider.GetRequiredService>();
return factory(vm.CurrentProfile ?? new TenantProfile());
};
```
```xml
Content="{Binding Source={x:Static loc:TranslationSource.Instance}, Path=[toolbar.connect]}"
```
```csharp
Localization.TranslationSource.Instance["key"]
```
Task 1: Add localization keys for global site picker (EN + FR)SharepointToolbox/Localization/Strings.resx, SharepointToolbox/Localization/Strings.fr.resx
Add the following localization keys to both resource files.
In `Strings.resx` (English), add these data entries (maintain alphabetical ordering with existing keys if the file is sorted, otherwise append at the end before the closing `` tag):
```xml
Select SitesSelect target sites for all tabsConnect to a tenant first{0} site(s) selectedNo sites selected
```
In `Strings.fr.resx` (French), add the matching entries:
```xml
Choisir les sitesChoisir les sites cibles pour tous les ongletsConnectez-vous d'abord{0} site(s) selectionne(s)Aucun site selectionne
```
Verify the resx files are well-formed XML after editing.
cd "C:\Users\dev\Documents\projets\Sharepoint" && dotnet build SharepointToolbox/SharepointToolbox.csproj --no-incremental 2>&1 | tail -5Both Strings.resx and Strings.fr.resx contain the 5 new keys each. Build succeeds (resx compiles).Task 2: Update MainWindowViewModel label to use localized stringsSharepointToolbox/ViewModels/MainWindowViewModel.cs
Update the GlobalSitesSelectedLabel property (added in plan 06-02) to use the new localization keys instead of hardcoded strings.
Replace the GlobalSitesSelectedLabel property with:
```csharp
public string GlobalSitesSelectedLabel =>
GlobalSelectedSites.Count > 0
? string.Format(Localization.TranslationSource.Instance["toolbar.globalSites.count"], GlobalSelectedSites.Count)
: Localization.TranslationSource.Instance["toolbar.globalSites.none"];
```
This follows the same pattern used by PermissionsViewModel.SitesSelectedLabel.
cd "C:\Users\dev\Documents\projets\Sharepoint" && dotnet build SharepointToolbox/SharepointToolbox.csproj --no-incremental 2>&1 | tail -5GlobalSitesSelectedLabel uses TranslationSource localized keys instead of hardcoded strings.Task 3: Add toolbar UI controls and wire SitePickerDialog factorySharepointToolbox/MainWindow.xaml, SharepointToolbox/MainWindow.xaml.cs
**MainWindow.xaml** — Add a Separator, "Select Sites" button, and count label to the ToolBar, after the existing Clear Session button:
```xml
```
Place these three elements immediately after the existing `` line, before the closing `` tag.
Note: The button is automatically disabled when SelectedProfile is null because OpenGlobalSitePickerCommand's CanExecute checks `SelectedProfile != null`. A disabled tooltip would require a style trigger — defer that (per context, it's Claude's discretion for exact XAML layout).
**MainWindow.xaml.cs** — Wire the SitePickerDialog factory for the global site picker. In the constructor, after the existing line that wires `OpenProfileManagementDialog`, add:
```csharp
// Wire global site picker dialog factory (same pattern as PermissionsView)
viewModel.OpenGlobalSitePickerDialog = () =>
{
var factory = serviceProvider.GetRequiredService>();
return factory(viewModel.SelectedProfile ?? new TenantProfile());
};
```
This requires adding a using directive for SitePickerDialog if not already present:
```csharp
using SharepointToolbox.Views.Dialogs; // already imported for ProfileManagementDialog
```
Also add using for TenantProfile if not already present:
```csharp
using SharepointToolbox.Core.Models; // already imported
```
cd "C:\Users\dev\Documents\projets\Sharepoint" && dotnet build SharepointToolbox/SharepointToolbox.csproj --no-incremental 2>&1 | tail -5MainWindow.xaml shows "Select Sites" button + count label in toolbar. MainWindow.xaml.cs wires the SitePickerDialog factory to MainWindowViewModel.OpenGlobalSitePickerDialog. Build succeeds.
- `dotnet build SharepointToolbox/SharepointToolbox.csproj` succeeds with 0 errors
- MainWindow.xaml ToolBar contains the Select Sites button bound to OpenGlobalSitePickerCommand
- MainWindow.xaml ToolBar contains a TextBlock bound to GlobalSitesSelectedLabel
- MainWindow.xaml.cs sets viewModel.OpenGlobalSitePickerDialog factory
- Strings.resx contains 5 new toolbar.* keys
- Strings.fr.resx contains 5 matching FR translations
- MainWindowViewModel.GlobalSitesSelectedLabel uses localized strings
The toolbar displays a "Select Sites" button and a site count label. Clicking the button opens SitePickerDialog (when connected to a tenant). The label updates to show the count of selected sites. All strings are localized in EN and FR.