private async void LoadForm(string transaction, HerbariumBox box = null) { HerbariumBoxForm form = new HerbariumBoxForm() { TransactionForm = transaction, BoxData = (box == null) ? new HerbariumBox() : box, PrimaryButtonText = (transaction == "Add Herbarium Box") ? "Save" : "Update" }; var result = await form.ShowAsync(); if (result == ContentDialogResult.Primary) { string message = ""; switch (form.TransactionResult) { case 0: message = (form.TransactionForm == "Add Herbarium Box") ? "Herbarium Box Inserted to the Database" : "Herbarium Box 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() { msgFamilyName.Visibility = Visibility.Collapsed; msgBoxLimit.Visibility = Visibility.Collapsed; msgRack.Visibility = Visibility.Collapsed; msgRackRow.Visibility = Visibility.Collapsed; msgRackColumn.Visibility = Visibility.Collapsed; BoxData = new HerbariumBox(); cbxFamilyName.ItemsSource = new TaxonFamily().GetFamilyList(); TransactionForm = "Add Herbarium Box"; PrimaryButtonText = "Save"; }