/// <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()...
        private delegate void Data_Transfer_UI_Text_Delegate(string message); //and a delegate for the above method must be called if we want to update the UI, hence we declare this line

        #endregion methods and their delegates which the callback threads call, so that the UI can be updated

        #endregion this region is all the code needed to integrate the CALLBACK functions for the sc copy, segment, and delete functions (they may take a bit of time, so let's not slow the UI)



        #region user interface buttons

        /// <summary>
        /// called when the close button is clicked by the user, i.e. so we can hide the control...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            //let's log this interaction
            play_sound();
            Record_User_Interactions.log_interaction_to_database("UploadNewImages_btnclose_click");

            this.Visibility = Visibility.Collapsed;
        } //end method btnClose_Click()...
        } //close method btnSettings_Click()...

        /// <summary>
        /// this method hides the settings options from the user...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSettings_hide_Click(object sender, RoutedEventArgs e)
        {
            //let's log this interaction
            play_sound();
            Record_User_Interactions.log_interaction_to_database("UploadNewImages_btnSettings_hide_click");

            btnSettings_show.Visibility = Visibility.Visible;
            btnSettings_hide.Visibility = Visibility.Hidden;
        } //close btnSettings_hide_Click()...
        } //close method update_list_on_display_with_latest_database_snapshot()...

        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CloseBtn1_Click(object sender, RoutedEventArgs e)
        {
            //let's first of all send a callback to notify the image viewer that there's now a new list of annotations available and the viewer should be updated to reflect this...
            current_annotation_types_updated_callback();

            Visibility = Visibility.Collapsed; //and let's close/collapse this user control

            //let's log this interaction
            Record_User_Interactions.log_interaction_to_database("EditListofEventTypes_Close_UserControl", "");
        }
        }     //close method btnRemove_EventType_Name_Click()...

        /// <summary>
        /// this method removes all items from the list of event types...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRemove_All_EventType_Names_Click(object sender, RoutedEventArgs e)
        {
            Annotation_Rep.RmAllAnnotationTypes();

            //and 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_All_Typenames", "");
        } //close method btnRemove_All_EventType_Names_Click()...
        } //close method btnSCPath_Click()...

        /// <summary>
        /// to help users select the destination folder on their PC...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPCPath_Click(object sender, RoutedEventArgs e)
        {
            FolderSelecter f = new FolderSelecter();

            f.select_file_rather_than_folder = false;
            f.selected_path = txtPCPath.Text;
            f.Show();
            txtPCPath.Text = f.selected_path;
            f.Close();

            //let's log this interaction
            play_sound();
            Record_User_Interactions.log_interaction_to_database("UploadNewImages_btnPCPath_click", txtPCPath.Text);
        } //close method btnPCPath_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()...
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            //todo for some reason, calling User_Object below causes a problem
            //on some computers (try testing this more thoroughly)
            string suggestedPath = "";// User_Object.get_likely_PC_destination_root(
            //userId, userName);

            //prompt researcher on where to store annotations
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.InitialDirectory = suggestedPath;
            saveFileDialog.FileName         = "myAnnotationSchema.csv";
            if (saveFileDialog.ShowDialog() == true)
            {
                //save annotations for this day to file
                string fileName = saveFileDialog.FileName;
                Daily_Annotation_Summary.writeAnnotationSchemaToCsv(fileName);
                Record_User_Interactions.log_interaction_to_database(
                    "EditListOfEventTypes_btnExportClick", fileName);
            }
        }
        private void btnImport_Click(object sender, RoutedEventArgs e)
        {
            //todo for some reason, calling User_Object below causes a problem
            //on some computers (try testing this more thoroughly)
            string suggestedPath = "";// User_Object.get_likely_PC_destination_root(
            //userId, userName);

            //prompt researcher on where to store annotations
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = suggestedPath;
            if (openFileDialog.ShowDialog() == true)
            {
                //save annotations for this day to file
                string fileName = openFileDialog.FileName;
                Daily_Annotation_Summary.readAnnotationSchemaCsv(fileName);
                Record_User_Interactions.log_interaction_to_database(
                    "EditListOfEventTypes_btnImportClick", fileName);
                update_list_on_display_with_latest_database_snapshot();
            }
        }
        } //close btnSettings_hide_Click()...

        /// <summary>
        /// this method is the code to enable the researcher upload old data gathered before they had access to the DCU SenseCam management system...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSCOldImages_Click(object sender, RoutedEventArgs e)
        {
            //let's toggle if we're uploading from the flash drive...
            uploading_from_flash_drive = !uploading_from_flash_drive;

            //if not uploading from the flash drive, i.e. we're uploading old images from another folder on the PC...
            if (!uploading_from_flash_drive)
            {
                lblImages_Source.Content = "Path of images already on your PC:";
                btnSCOldImages.Content   = "Download from SenseCam/Revue...";
                txtPCPath.Text           = "Images already stored on PC...";
                txtPCPath.IsEnabled      = false;
                btnPCPath.Visibility     = Visibility.Hidden;

                //let's log this interaction
                Record_User_Interactions.log_interaction_to_database("UploadNewImages_btnSCOldImages_Click", "upload_from_PC");
            }
            else //else we are uploading from the flash drive (i.e. SC should be connected)...
            {
                lblImages_Source.Content = "SenseCam or Vicon Revue path:";
                btnSCOldImages.Content   = "Download from PC...";
                txtSCPath.Text           = detect_Autographer_USB_data_directory("");
                txtPCPath.IsEnabled      = false;
                txtPCPath.Text           = User_Object.get_likely_PC_destination_root(object_userID, object_user_name);
                btnPCPath.Visibility     = Visibility.Visible;

                if (detect_Autographer_USB_data_directory("").Equals(""))
                {
                    btnUpload.Visibility = Visibility.Hidden;
                }
                else
                {
                    btnUpload.Visibility = Visibility.Visible;
                }

                //let's log this interaction
                Record_User_Interactions.log_interaction_to_database("UploadNewImages_btnSCOldImages_Click", "upload_from_Revue");
            } //close else ... if (!uploading_from_flash_drive)
        }     //close method btnSCOldImages_Click()...
        } //end method get_number_of_images_in_event()

        /// <summary>
        /// to help users select the source folder on the SenseCam...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSCPath_Click(object sender, RoutedEventArgs e)
        {
            FolderSelecter f = new FolderSelecter();

            f.select_file_rather_than_folder = false;
            f.selected_path = txtSCPath.Text;
            f.Show();
            txtSCPath.Text = f.selected_path;
            f.Close();

            //to allow user then upload images
            if ((!uploading_from_flash_drive && !txtSCPath.Text.Equals("")) ||
                (uploading_from_flash_drive && !detect_Autographer_USB_data_directory(txtSCPath.Text).Equals(""))
                )
            {
                btnUpload.Visibility = Visibility.Visible;
            }

            //let's log this interaction
            play_sound();
            Record_User_Interactions.log_interaction_to_database("UploadNewImages_btnSCPath_click", txtSCPath.Text);
        } //close method btnSCPath_Click()...
        } //end method btnClose_Click()...

        /// <summary>
        /// this method is called when the user commits to uploading images form the SenseCam
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpload_Click(object sender, RoutedEventArgs e)
        {
            //firstly let's log this interaction...
            string sc_path_for_log = txtSCPath.Text;

            if (sc_path_for_log.Length > 100)
            {
                sc_path_for_log = sc_path_for_log.Substring(sc_path_for_log.Length - 51, 50);
            }

            string pc_path_for_log = txtPCPath.Text;

            if (pc_path_for_log.Length > 100)
            {
                pc_path_for_log = pc_path_for_log.Substring(pc_path_for_log.Length - 51, 50);
            }
            //let's log this interaction
            play_sound();
            Record_User_Interactions.log_interaction_to_database("UploadNewImages_btnupload_click", sc_path_for_log + "," + pc_path_for_log);
            //end logging this interaction

            initiate_data_transfer_process(txtSCPath.Text, txtPCPath.Text, uploading_from_flash_drive);
        } //end method get_number_of_images_in_event()