/// <summary> /// this method adds the text box entry to the list of event types... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAdd_New_EventType_Name_Click(object sender, RoutedEventArgs e) { //1. get new item type name from the relevant textbox... string annotation_type_name = txtNew_EventType_Name.Text; if (lst_Current_Event_Types.SelectedItem != null) { Annotation_Rep_Tree_Data_Model tree_node = (Annotation_Rep_Tree_Data_Model)lst_Current_Event_Types.SelectedItem; string tree_node_db_entry = Annotation_Rep_Tree_Data.convert_tree_node_to_delimited_string(tree_node); if (!tree_node_db_entry.Equals("")) { annotation_type_name = tree_node_db_entry + ";" + annotation_type_name; } } if (!annotation_type_name.Equals("")) //let's just make sure the user didn't click the button by mistake... { //2. then add it to the database... Annotation_Rep.AddAnnotationType(annotation_type_name); //3. finally update the display list to reflect this new change... update_list_on_display_with_latest_database_snapshot(); //and also reset the relevant textbox back to appear blank... txtNew_EventType_Name.Text = ""; //let's log this interaction Record_User_Interactions.log_interaction_to_database("EditListofEventTypes_New_Typename", annotation_type_name); } //close error checking... if (!annotation_type_name.Equals("")) } //close method btnAdd_New_EventType_Name_Click()...
} //close method btnAdd_New_EventType_Name_Click()... /// <summary> /// this method removes an item from the list of event types... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRemove_EventType_Name_Click(object sender, RoutedEventArgs e) { if (lst_Current_Event_Types.SelectedItem != null) { //1. get item selected in the list Annotation_Rep_Tree_Data_Model annotation_type_delete = (Annotation_Rep_Tree_Data_Model)lst_Current_Event_Types.SelectedItem; //2. convert it to the database storage type... string annotation_type_database_text_entry = Annotation_Rep_Tree_Data.convert_tree_node_to_delimited_string(annotation_type_delete); //3. then delete it from the database... Annotation_Rep.RmAnnotationType(annotation_type_database_text_entry); //4. finally update the display list to reflect this new change... update_list_on_display_with_latest_database_snapshot(); //let's log this interaction Record_User_Interactions.log_interaction_to_database("EditListofEventTypes_Remove_Typename", annotation_type_database_text_entry); } //close if (lst_Current_Event_Types.SelectedItem != null)... } //close method btnRemove_EventType_Name_Click()...