Files
Sharepoint-Toolbox/SharepointToolbox/MainWindow.xaml.cs
Dev e08452d1bf feat(03-07): create StorageView XAML, DI registration, and MainWindow wiring
- StorageView.xaml: DataGrid with IndentLevel-based name indentation
- StorageView.xaml.cs: code-behind wiring DataContext to StorageViewModel
- IndentConverter.cs: IndentConverter, BytesConverter, InverseBoolConverter
- App.xaml: register converters and RightAlignStyle as Application.Resources
- App.xaml.cs: register IStorageService, StorageCsvExportService, StorageHtmlExportService, StorageViewModel, StorageView
- MainWindow.xaml: add x:Name=StorageTabItem to Storage TabItem
- MainWindow.xaml.cs: wire StorageTabItem.Content from DI
2026-04-02 15:38:20 +02:00

43 lines
1.5 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 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;
}