using Avalonia.Controls;
using OTSSignsOrchestrator.Desktop.ViewModels;

namespace OTSSignsOrchestrator.Desktop.Views;

public partial class InstanceDetailsWindow : Window
{
    public InstanceDetailsWindow()
    {
        InitializeComponent();
        DataContextChanged += OnDataContextChanged;
    }

    private void OnDataContextChanged(object? sender, EventArgs e)
    {
        if (DataContext is InstanceDetailsViewModel vm)
        {
            vm.ConfirmAsync = async (title, message) =>
                await ConfirmationDialog.ShowAsync(this, title, message);
        }
    }
}
