public async Task ExecuteAsyncAdd(object parameter) { AddPatientDialogV addPatientUC = (AddPatientDialogV)parameter; addPatientUC.addNewPatientProggressBar.IsIndeterminate = true; String errorMessage = null; await Task.Run(() => { try { ExecuteSyncAdd(); } catch (Exception e) { errorMessage = e.Message; } }); if (errorMessage == null) { addPatientUC.Hide(); } else { MessageBox.Show("Error: " + errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } addPatientUC.addNewPatientProggressBar.IsIndeterminate = false; }
public object ExecuteCancel(object parameter) { AddPatientDialogV addPatientUC = (AddPatientDialogV)parameter; addPatientUC.Hide(); return(null); }
// Add Patient public bool CanExecuteAdd(object parameter) { AddPatientDialogV addPatientUC = (AddPatientDialogV)parameter; if (addPatientUC == null) { return(false); } return(!string.IsNullOrEmpty(addPatientUC.FirstName.Text) && !string.IsNullOrEmpty(addPatientUC.LastName.Text) && !string.IsNullOrEmpty(addPatientUC.ID.Text) && !string.IsNullOrEmpty(addPatientUC.Address.Text) && !string.IsNullOrEmpty(addPatientUC.BirthDate.Text)); }