Files
Sharepoint-Toolbox/SharepointToolbox/MainWindow.xaml.cs
Dev 1f2a49d7d3 feat(03-08): DI registration + MainWindow wiring for Search and Duplicates tabs
- App.xaml.cs: register ISearchService, SearchCsvExportService, SearchHtmlExportService, SearchViewModel, SearchView, IDuplicatesService, DuplicatesHtmlExportService, DuplicatesViewModel, DuplicatesView
- MainWindow.xaml: add x:Name to SearchTabItem and DuplicatesTabItem (remove FeatureTabBase stubs)
- MainWindow.xaml.cs: wire SearchTabItem.Content and DuplicatesTabItem.Content via DI
2026-04-02 15:45:29 +02:00

49 lines
1.8 KiB
C#

using System.Windows;
using System.Windows.Controls;
using Microsoft.Extensions.DependencyInjection;
using SharepointToolbox.ViewModels;
using SharepointToolbox.Views.Dialogs;
using SharepointToolbox.Views.Tabs;
namespace SharepointToolbox;
public partial class MainWindow : Window
{
private readonly MainWindowViewModel _viewModel;
public MainWindow(MainWindowViewModel viewModel, IServiceProvider serviceProvider)
{
InitializeComponent();
_viewModel = viewModel;
DataContext = viewModel;
// Wire profile management dialog factory
viewModel.OpenProfileManagementDialog = () => serviceProvider.GetRequiredService<ProfileManagementDialog>();
// Replace Permissions tab placeholder with the DI-resolved PermissionsView
PermissionsTabItem.Content = serviceProvider.GetRequiredService<PermissionsView>();
// Replace Storage tab placeholder with the DI-resolved StorageView
StorageTabItem.Content = serviceProvider.GetRequiredService<StorageView>();
// Replace Search tab placeholder with the DI-resolved SearchView
SearchTabItem.Content = serviceProvider.GetRequiredService<SearchView>();
// Replace Duplicates tab placeholder with the DI-resolved DuplicatesView
DuplicatesTabItem.Content = serviceProvider.GetRequiredService<DuplicatesView>();
// Replace Settings tab placeholder with the DI-resolved SettingsView
SettingsTabItem.Content = serviceProvider.GetRequiredService<SettingsView>();
Loaded += OnLoaded;
}
private async void OnLoaded(object sender, RoutedEventArgs e)
{
await _viewModel.LoadProfilesAsync();
}
// Expose the LogPanel RichTextBox (generated by x:Name="LogPanel") for LogPanelSink wiring
public RichTextBox GetLogPanel() => LogPanel;
}