private async void ExecuteDeleteStation() { bool result = false; try { result = await stationManager.DeleteStation(this.selectedStation); } catch (BusinessSqlException ex) { notifierManager.ShowError(ex.Message); } if (!result) { notifierManager.ShowError("Could not delete Station"); } else { notifierManager.ShowSuccess("Station deleted"); } await LoadStations(); this.SelectedStation = this.Stations.First(); RaisePropertyChanged(nameof(SelectedStation)); RaisePropertyChanged(nameof(Stations)); }
// we should not use binding to the password directly // http://gigi.nullneuron.net/gigilabs/security-risk-in-binding-wpf-passwordbox-password/ // instead: // https://stackoverflow.com/questions/15390727/passwordbox-and-mvvm/15391318#15391318 public async void ExecuteLoginCommand(object obj) { PasswordBox pwBox = obj as PasswordBox; try { loggedInUser = await userManager.UserCredentialValidation(email, pwBox.Password); } catch (BusinessSqlException ex) { notifierManager.ShowError(ex.Message); return; } if (loggedInUser == null) { //LoginMessage = "Login failed!"; notifierManager.ShowError($"Login failed!"); } else { LoginMessage = string.Empty; notifierManager.ShowSuccess($"Welcome {loggedInUser.FirstName}"); MainWindow.SetContentControl(new MainContentView()); } }