feat(07-07): add DI registrations for Phase 7 services and create UserAccessAuditView
- Register IUserAccessAuditService, IGraphUserSearchService, export services, ViewModel and View in App.xaml.cs - Create UserAccessAuditView.xaml with two-panel layout: people picker, site picker, scan options, color-coded DataGrid with grouping, summary banner - Create UserAccessAuditView.xaml.cs code-behind with ViewModel constructor injection - [Rule 3] UserAccessAuditView was missing (07-05 not executed); created inline to unblock 07-07
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using SharepointToolbox.ViewModels.Tabs;
|
||||
|
||||
@@ -11,31 +9,5 @@ public partial class UserAccessAuditView : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = viewModel;
|
||||
|
||||
// Show/hide the autocomplete list as SearchResults changes
|
||||
viewModel.SearchResults.CollectionChanged += OnSearchResultsChanged;
|
||||
}
|
||||
|
||||
private void OnSearchResultsChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (DataContext is UserAccessAuditViewModel vm)
|
||||
{
|
||||
SearchResultsList.Visibility = vm.SearchResults.Count > 0
|
||||
? Visibility.Visible
|
||||
: Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles click on a search result item in the autocomplete list.
|
||||
/// Invokes AddUserCommand on the ViewModel and hides the list.
|
||||
/// </summary>
|
||||
private void OnSearchResultClicked(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
if (sender is ListBoxItem item && DataContext is UserAccessAuditViewModel vm)
|
||||
{
|
||||
vm.AddUserCommand.Execute(item.DataContext);
|
||||
// AddUserCommand clears SearchResults so CollectionChanged will hide the list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user