private async void LoadForm(string transaction, Validator validator = null) { ValidatorForm form = new ValidatorForm() { TransactionForm = transaction, ValidatorData = (validator == null) ? new Validator() : validator, PrimaryButtonText = (transaction == "Add External Validator") ? "Save" : "Update" }; var result = await form.ShowAsync(); if (result == ContentDialogResult.Primary) { string message = ""; switch (form.TransactionResult) { case 0: message = (form.TransactionForm == "Add External Validator") ? "External Validator Inserted to the Database" : "External Validator Updated in the Database"; break; case 1: message = "The System had run to an Error"; break; case 2: message = "Information is Already Exists in the Database"; break; } MessageDialog dialog = new MessageDialog(message); await dialog.ShowAsync(); this.InitializePage(); } }
private async void btnAddValidator_Click(object sender, RoutedEventArgs e) { ValidatorForm form = new ValidatorForm() { TransactionForm = "Add External Validator", IsMaintenance = false, PrimaryButtonText = "Save" }; var result = await form.ShowAsync(); if (result == ContentDialogResult.Primary) { var NewData = form.ValidatorData; NewData.FullName = (NewData.FirstName + " " + NewData.LastName + " " + NewData.NameSuffix).Trim(); NewValidator = NewData; cbxValidator.Visibility = Visibility.Collapsed; btnAddValidator.Visibility = Visibility.Collapsed; txfValidator.Visibility = Visibility.Visible; btnDeleteValidator.Visibility = Visibility.Visible; } }