Untitled
unknown
plain_text
a year ago
1.2 kB
7
Indexable
using System.Windows;
using System.Windows.Controls;
using Airline_Reservation_System.ViewModels;
namespace Airline_Reservation_System.Views
{
public partial class RegistrationWindow : Window
{
private readonly RegistrationViewModel _viewModel;
public RegistrationWindow()
{
InitializeComponent();
_viewModel = new RegistrationViewModel();
DataContext = _viewModel;
}
private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
{
if (_viewModel != null)
{
_viewModel.Password = PasswordBox.Password;
ValidatePasswords();
}
}
private void ConfirmPasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
{
ValidatePasswords();
}
private void ValidatePasswords()
{
if (PasswordBox.Password != ConfirmPasswordBox.Password)
{
_viewModel.ErrorMessage = "Passwords do not match.";
}
else
{
_viewModel.ErrorMessage = string.Empty;
}
}
}
}Editor is loading...
Leave a Comment