using System.Windows;
using System.Windows.Controls;
using Valg.EVA.Skanning.UserInterfaceElements.Help;

namespace Valg.EVA.Skanning.UserInterfaceElements.InstallClientCertificate
{
    public partial class InstallClientCertificateWindow : IHelpContributor
    {
        public InstallClientCertificateWindow(InstallClientCertificateWindowViewModel viewModel)
        {
            InitializeComponent();
            DataContext = ViewModel = viewModel;
        }
        public string HelpContributionId => HelpContributionIds.Nødmodus;
        public InstallClientCertificateWindowViewModel ViewModel { get; set; }

        private void PasswordBox_OnPasswordChanged(object sender, RoutedEventArgs e)
        {
            ((InstallClientCertificateWindowViewModel)DataContext).Password = ((PasswordBox)sender).Password;
        }

        private void ShowPasswordCharsCheckBox_Checked(object sender, RoutedEventArgs e)
        {
            PasswordBoxShowCharacters.Visibility = Visibility.Visible;
            PasswordBox.Visibility = Visibility.Collapsed;
            PasswordBoxShowCharacters.Text = PasswordBox.Password;
        }

        private void ShowPasswordCharsCheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            PasswordBoxShowCharacters.Visibility = Visibility.Collapsed;
            PasswordBox.Visibility = Visibility.Visible;
        }
    }
}
