using System.Windows;
using SharepointToolbox.ViewModels;

namespace SharepointToolbox.Views.Dialogs;

public partial class ProfileManagementDialog : Window
{
    public ProfileManagementDialog(ProfileManagementViewModel viewModel)
    {
        InitializeComponent();
        DataContext = viewModel;
        viewModel.ConfirmRegisterApp = msg =>
        {
            var result = MessageBox.Show(
                this, msg,
                Localization.TranslationSource.Instance["profile.register"],
                MessageBoxButton.OKCancel,
                MessageBoxImage.Information);
            return result == MessageBoxResult.OK;
        };
        Loaded += async (_, _) => await viewModel.LoadAsync();
    }

    private void CloseButton_Click(object sender, RoutedEventArgs e)
    {
        Close();
    }
}
