private async void LoadForm(string transaction, SpeciesAuthor author = null) { SpeciesAuthorForm form = new SpeciesAuthorForm() { TransactionForm = transaction, AuthorData = (author == null) ? new SpeciesAuthor() : author, PrimaryButtonText = (transaction == "Add Species Author") ? "Save" : "Update" }; var result = await form.ShowAsync(); if (result == ContentDialogResult.Primary) { string message = ""; switch (form.TransactionResult) { case 0: message = (form.TransactionForm == "Add Species Author") ? "Species Author Inserted to the Database" : "Species Author 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 void ClearForm() { msgAuthorsName.Visibility = Visibility.Collapsed; msgAuthorsSuffix.Visibility = Visibility.Collapsed; AuthorData = new SpeciesAuthor(); TransactionForm = "Add Species Author"; PrimaryButtonText = "Save"; }