private void OkClicked(object sender, RoutedEventArgs e) { if (UserAttemptingToLogin != null) { UserAttemptingToLogin.Invoke(this, EventArgs.Empty); } UserCredentialsViewModel vm = DataContext as UserCredentialsViewModel; string login = vm.Model.Username; string password = vm.Model.Password; LoggedUserContext.Logon(login, password); }
private void OkButtonClick(object sender, RoutedEventArgs e) { SetWaitingState(); UserCredentialsViewModel vm = DataContext as UserCredentialsViewModel; // TODO: add some basic validation here if (vm == null) { throw new Exception("Wrong viewmodel type!"); } string login = vm.Model.Username; string password = vm.Model.Password; LoggedUserContext.Logon(login, password); }