private void appBarOkButton_Click(object sender, EventArgs e) { // Confirm there is some text in the text box. if (newTaskNameTextBox.Text.Length > 0) { // Create a new task. CondItem newCondItem = new CondItem { ItemName = newTaskNameTextBox.Text, //Category = (CondCategory)categoriesListPicker.SelectedItem, // Set the priority of the new task to the specified priority. // Added in Version 2 of the application. //Priority = (int)priorityListPicker.SelectedItem }; // Add the item to the ViewModel. //App.ViewModel.AddCondItem(newCondItem); // Return to the main page. if (NavigationService.CanGoBack) { NavigationService.GoBack(); } } }
private void newCondAddButton_Click(object sender, RoutedEventArgs e) { //sets maximum characters at 30 if (newCondTextBox.Text.Length >= 5 && newCondTextBox.Text != "Add medical condition") { // Create a new to-do item based on the text box. CondItem newCond = new CondItem { ItemName = newCondTextBox.Text }; // Add a to-do item to the observable collection. CondItems.Add(newCond); // Add a to-do item to the local database. CondDB.CondItems.InsertOnSubmit(newCond); } else { //create error message //for Minimum length } }