feat(01-07): add ProfileManagementDialog with DI factory wiring
- Create Views/Dialogs/ProfileManagementDialog.xaml (modal Window with Name/TenantUrl/ClientId fields and TranslationSource bindings) - Create Views/Dialogs/ProfileManagementDialog.xaml.cs (DI constructor injection, LoadAsync on Loaded) - Add OpenProfileManagementDialog factory delegate to MainWindowViewModel - Wire ManageProfilesCommand to open dialog via factory, reload profiles after close - Register ProfileManagementDialog as Transient in DI (App.xaml.cs) - Inject IServiceProvider into MainWindow constructor for DI-resolved dialog factory
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
@@ -15,6 +16,9 @@ public partial class MainWindowViewModel : ObservableRecipient
|
||||
private readonly SessionManager _sessionManager;
|
||||
private readonly ILogger<MainWindowViewModel> _logger;
|
||||
|
||||
// Set by the view layer (MainWindow.xaml.cs) to open the dialog using DI
|
||||
public Func<Window>? OpenProfileManagementDialog { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
private TenantProfile? _selectedProfile;
|
||||
|
||||
@@ -122,6 +126,12 @@ public partial class MainWindowViewModel : ObservableRecipient
|
||||
|
||||
private void OpenProfileManagement()
|
||||
{
|
||||
// Profile management dialog opened by View layer (plan 01-07)
|
||||
if (OpenProfileManagementDialog == null) return;
|
||||
var dialog = OpenProfileManagementDialog();
|
||||
dialog.Owner = Application.Current.MainWindow;
|
||||
dialog.ShowDialog();
|
||||
|
||||
// Reload profiles after dialog closes (modal — ShowDialog blocks until closed)
|
||||
_ = LoadProfilesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user