private void ExecuteLogin(object param) { var password = (PasswordBox)param; var user = _repository.GetUser(UserName); Error = _userValidationService.ValidateUserInput(user, UserName, password.Password); if (Error.Length > 0) { return; } var mainWindow = new MainView(); mainWindow.DataContext = _mainViewModel; mainWindow.Show(); Application.Current.MainWindow.Close(); }