using System.Windows;
using System.Windows.Controls;
using NexusShell.ViewModels;

namespace NexusShell.Views;

public partial class DeveloperConsoleWindow : Window
{
    public DeveloperConsoleWindow()
    {
        InitializeComponent();
    }

    private void DevPasswordBox_OnPasswordChanged(object sender, RoutedEventArgs e)
    {
        if (DataContext is DeveloperConsoleViewModel vm)
        {
            vm.Password = DevPasswordBox.Password;
        }
    }

    protected override void OnClosed(EventArgs e)
    {
        if (DataContext is DeveloperConsoleViewModel vm)
        {
            vm.CloseSession();
        }

        base.OnClosed(e);
    }
}
