} //close method btnClose_App_Click()... /// <summary> /// this method is called whenever the user wants to export annotations... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnExport_Click(object sender, RoutedEventArgs e) { int userId = User_Object.OVERALL_userID; string userName = User_Object.OVERALL_USER_NAME; //will suggest saving output to participant's most recent data folder //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 = userName + ".csv"; saveFileDialog.ShowDialog(); if (!saveFileDialog.FileName.Equals("")) { //save annotations for this day to file string fileName = saveFileDialog.FileName; Daily_Annotation_Summary.writeAllAnnotationsToCsv(userId, fileName); Record_User_Interactions.log_interaction_to_database( "Window1_btnExport_Click", fileName); } } //close method btnExport_Click()...
/// <summary> /// the constructor which is called when the application first loads up... /// </summary> public Window1() { //let's firstly get all the components initialised and set up... InitializeComponent(); //let's provide reaffirmation on what user we're showing images for... lblUserName.Content = User_Object.OVERALL_USER_NAME; //for some reason, the lstDisplayEvents isn't at the top of the layout in XAML code //therefore here we programatically bring it to the front Canvas.SetZIndex(LstDisplayEvents, 10); //initialise the calendar, so that we can use it to select new dates calSenseCamDay.initialise_calendar_popup_datecallback(Calendar_Data_Selected_Callback); //and now let's show the most recent day's data... show_new_day_on_UI(calSenseCamDay.list_of_available_days[0]); //to enable scrolling of the listbox containing all the events in a day double screen_resolution_height = System.Windows.SystemParameters.PrimaryScreenHeight; LstDisplayEvents.Height = screen_resolution_height - 230; //for some strange reason I've got to set the height of this listbox so that the automatic scrolling kicks in (can't set the height to "auto" or "*", and I don't know why not) //let's log this interaction Record_User_Interactions.log_interaction_to_database("Window1_appload", current_day_on_display.ToString()); } //end Window1()...
} //close LstDisplayEvents_MouseLeftButtonUp()... /// <summary> /// the method is called when the user wishes to upload new images from the SenseCam... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpload_New_Images_Click(object sender, RoutedEventArgs e) { //let's log this interaction Record_User_Interactions.log_interaction_to_database("Window1_btnupload_new_images_click"); ucUploadNewImages.update_user_control_with_drive_information(User_Object.OVERALL_userID, User_Object.OVERALL_USER_NAME, All_Images_Deleted_from_SenseCam); ucUploadNewImages.Visibility = Visibility.Visible; } //close btnUpload_New_Images_Click()...
/// <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()...
/// <summary> /// this method is responsible for highlighting all events belonging to a certain activity... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstDailyActivitySummary_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (lstDailyActivitySummary.SelectedItem != null) //firstly check whether a valid item has been selected... { //firstly get the type of activity we want to highlight... Daily_Annotation_Summary selected_activity = (Daily_Annotation_Summary)lstDailyActivitySummary.SelectedItem; //then find the event ids displayed today which are part of the given activity type List <int> eventIDs_to_highlight = Daily_Annotation_Summary.ActivityEventIds(Window1.OVERALL_userID, current_day_on_display, selected_activity.annType); foreach (Event_Rep displayed_event in LstDisplayEvents.Items) { //by defaut reset the border colour for this event... displayed_event.borderColour = Event_Rep.DefaultKeyframeBorderColour; //then we try to see if this event is in our list of target event ids to highlight foreach (int target_id in eventIDs_to_highlight) { if (displayed_event.eventID == target_id) { displayed_event.borderColour = "red"; //if this is the target event, let's highlight it's border colour... } } //close foreach(int target_id in eventIDs_to_highlight)... } //close foreach (Event_Rep displayed_event in LstDisplayEvents.Items)... //finally refresh the list of events on display to highlight the target events... LstDisplayEvents.Items.Refresh(); //let's record this user interaction for later analysis... Record_User_Interactions.log_interaction_to_database("Window1_lstDailyActivitySummary_SelectionChanged", selected_activity.annType); } //close if (lstDailyActivitySummary.SelectedItem != null) //firstly check whether a valid item has been selected... } //close method lstDailyActivitySummary_SelectionChanged()...
} //close method lstDailyActivitySummary_SelectionChanged()... /// <summary> /// this method is responsible for highlighting an individual annotated event... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstIndividual_Journeys_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (lstIndividual_Journeys.SelectedItem != null) //firstly check whether a valid item has been selected... { //firstly get the event we to highlight... Interface_Code.Event_Activity_Annotation selected_event = (Interface_Code.Event_Activity_Annotation)lstIndividual_Journeys.SelectedItem; //then store the event id that we'll want to highlight... int eventID_to_highlight = selected_event.eventID; foreach (Event_Rep displayed_event in LstDisplayEvents.Items) { //by defaut reset the border colour for this event... displayed_event.borderColour = Event_Rep.DefaultKeyframeBorderColour; //then let's see if this is the event we want to highlight... if (displayed_event.eventID == eventID_to_highlight) { displayed_event.borderColour = "red"; //if this is the target event, let's highlight it's border colour... } } //close foreach (Event_Rep displayed_event in LstDisplayEvents.Items)... //finally refresh the list of events on display to highlight the target events... LstDisplayEvents.Items.Refresh(); //let's record this user interaction for later analysis... Record_User_Interactions.log_interaction_to_database("Window1_lstIndividual_Journeys_PreviewMouseLeftButtonUp", selected_event.eventID + "," + selected_event.annotation); } //if (lstIndividual_Journeys.SelectedItem != null) //firstly check whether a valid item has been selected... } //close method lstIndividual_Journeys_PreviewMouseLeftButtonUp()...
} //close method initialise_calendar_popup_datecallback()... #endregion startup methods that should be called before the calendar is displayed to the user #region interface control methods /// <summary> /// to close the Calendar control view... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CloseBtn_Click(object sender, RoutedEventArgs e) { //let's log this interaction play_sound(); Record_User_Interactions.log_interaction_to_database("CalendarView_CloseBtn_click", calSenseCamDay.DisplayDate.ToString()); close_control(); } //close method CloseBtn_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 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 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 small_rectangle_icon_MouseLeftButtonDown()... /// <summary> /// clicking on this should increase the zooming size of the keyframes on display... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void large_rectangle_icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { //we'll move up in incraments of 10% ... range is 640-80 = 560 ... then 10% of that is 56 if (ZoomSlider.Value < 586) //i.e. 640-56 { ZoomSlider.Value += 56; //i.e. 10% of range of 80-640... } //let's record this user interaction for later analysis... Record_User_Interactions.log_interaction_to_database("Window1_large_rectangle_icon_MouseLeftButtonDown", "increase_size"); } //close method large_rectangle_icon_MouseLeftButtonDown()...
} //close method CalendarView_Click()... /// <summary> /// this method is called when the user selects one of the events on display, which means that they want to see the images within this event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LstDisplayEvents_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (LstDisplayEvents.SelectedIndex >= 0) { txtEventNumber.UpdateLayout(); Event_Rep event_rep = (Event_Rep)LstDisplayEvents.SelectedItem; //let's log this interaction Record_User_Interactions.log_interaction_to_database("Window1_eventdetail_click", event_rep.eventID.ToString()); sc_img_viewer.update_event_on_display(Window1.OVERALL_userID, event_rep, New_Event_Comment_Callback, Event_Deleted_Callback, Images_Moved_Between_Events_Callback); sc_img_viewer.Visibility = Visibility.Visible; } //close if (LstDisplayEvents.SelectedIndex >= 0) } //close LstDisplayEvents_MouseLeftButtonUp()...
} //close method CloseBtn_Click()... /// <summary> /// this is called when the user selects a new day... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void calSenseCamDay_SelectedDatesChanged(object sender, SelectionChangedEventArgs e) { //PreviewMouseLeftButtonUp="calSenseCamDay_MouseLeftButtonUp" ... used on touchscreen device... //SelectedDatesChanged="calSenseCamDay_SelectedDatesChanged" ... old "reliable" method should we have problems with this method firing if (calSenseCamDay.SelectedDate.HasValue) //this is also fired when the user toggles through the months, so we only call this when a date is selected (i.e. when the user wants to view some data) { //let's log this interaction play_sound(); Record_User_Interactions.log_interaction_to_database("CalendarView_calSenseCamDay_MouseLeftButtonUp", calSenseCamDay.SelectedDate.Value.ToString()); date_selected_callback(calSenseCamDay.SelectedDate.Value); close_control(); } //close if (calSenseCamDay.SelectedDate.HasValue) } //close method calSenseCamDay_SelectedDatesChanged()...
} //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 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(); } }
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); } }
} //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()...
} //close btnUpload_New_Images_Click()... /// <summary> /// this method is called whenever the user wants to exit our SenseCam browser... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnClose_App_Click(object sender, RoutedEventArgs e) { //incase any threads have been left running Event_Rep.eventLoadingId = int.MinValue; image_loading_thread.Abort(); //let's log this interaction Record_User_Interactions.log_interaction_to_database("Window1_appclose", current_day_on_display.ToString()); //and now's let's close the application if (!ucUploadNewImages.Is_Deletion_Process_Currently_Running()) { //shut_down_pc(); Application.Current.Shutdown(); } //close if (ucUploadNewImages.Is_Deletion_Process_Currently_Running())... else { MessageBox.Show("Please wait a few more minutes while the SenseCam is being cleared so that you can use it again i.e. unto the red light at the top of the camera goes off"); //let's log this interaction Record_User_Interactions.log_interaction_to_database("Window1_appclose_denied_currently_deleting_images_from_SenseCam"); } //close else ... if (ucUploadNewImages.Is_Deletion_Process_Currently_Running())... } //close method btnClose_App_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()
} //close method refresh_calendar_to_reflect_updated_list_of_available_days()... #endregion receiving callbacks from other classes #region interface control methods... /// <summary> /// when the user wants to select a new day from the calendar, they click on the "calendar" button and we show this user control as visible /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CalendarView_Click(object sender, RoutedEventArgs e) { //let's log this interaction Record_User_Interactions.log_interaction_to_database("Window1_calendar_click", current_day_on_display.ToString()); calSenseCamDay.Visibility = Visibility.Visible; } //close method CalendarView_Click()...