예제 #1
0
        }     //close method show_new_day_on_UI()...

        private void update_display_page_events(DateTime day_to_display)
        {
            //an array to store the total list of events to be displayed...
            Event_Rep.EventList =
                Event_Rep.GetDayEvents(
                    Window1.OVERALL_userID, day_to_display, false);

            // add info to UI on how many events there are in this time period...
            txtEventNumber.Text = Event_Rep.EventList.Count + " Events";

            // make UI display the first page of events
            LstDisplayEvents.ItemsSource = Event_Rep.EventList;
            if (LstDisplayEvents.Items.Count == 0)
            {
                No_Images.Visibility = Visibility.Visible;
            }
            else
            {
                No_Images.Visibility = Visibility.Hidden;
                startLoadingImageBitmaps();
            }

            //in the background, start loading all the images for this event
            //startLoadingImageBitmaps();
        }     //close method update_display_page_events()...
예제 #2
0
        }     //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()...
예제 #3
0
        }     //close method Images_Moved_Between_Events_Callback()...

        /// <summary>
        /// this method is called when the user has deleted the event in question, so we want to update the main UI to reflect this change...
        /// </summary>
        public void Event_Deleted_Callback(Event_Rep param_deleted_event)
        {
            //let's firstly just make sure this isn't the only event in the day that we've just deleted
            //if so, let's refresh the list of available days, and then show the most recent...
            if (LstDisplayEvents.Items.Count == 1)
            {
                refresh_calendar_to_reflect_updated_list_of_available_days();
            }     //close if (LstDisplayEvents.Items.Count == 1)...
            else
            {
                //todo bug when I delete all images in event?
                LstDisplayEvents.Items.Remove(param_deleted_event);
                LstDisplayEvents.Items.Refresh();
            } //close else ... if (LstDisplayEvents.Items.Count == 1)...
        }     //close method Event_Deleted_Callback()...
예제 #4
0
        public static void rewriteEventList(
            int userId,
            string csvFile)
        {
            //remove all existing annotations
            Annotation_Rep.RmAllAnnotations(userId);

            //This method rewrites the whole list of events
            SQLiteConnection con     = new SQLiteConnection(DbString);
            SQLiteCommand    command = new SQLiteCommand(con);

            con.Open();

            //first, for each day, merge all events into one (1st event)
            DateTime[] dayList = calendar_control.get_list_of_available_days_for_user(userId);
            for (int d = 0; d < dayList.Length; d++)
            {
                //get events in day
                DateTime         day       = dayList[d];
                List <Event_Rep> dayEvents = GetDayEvents(userId, day, false);
                int firstEventId           = dayEvents[0].eventID;
                //set id of events 2:n to firstEventId
                for (int e = 1; e < dayEvents.Count; e++)
                {
                    int currentEvent = dayEvents[e].eventID;
                    command.CommandText =
                        Database_Versioning.text_for_stored_procedures.spUpdate_image_sensors_tables_with_new_event_id_after_target_time(
                            userId, firstEventId, currentEvent, day);
                    command.ExecuteNonQuery();
                    //now delete existing event id
                    DeleteEvent(userId, currentEvent);
                }
                //update db event info (i.e. new start/end times, num images, etc.)
                UpdateDBEventInfo(userId, firstEventId);

                //there should only be 1 event for this day...
                Event_Rep firstEvent = Event_Rep.GetDayEvents(userId, day, false)[0];

                //read list of boundary times from csv (i.e. episode start times)
                List <DateTime> boundaryList   = new List <DateTime>();
                List <string>   annotationList = new List <string>();
                Daily_Annotation_Summary.getBoundInfoFromCsv(csvFile, firstEvent.startTime, firstEvent.endTime, ref boundaryList, ref annotationList);

                //split into multiple events based on list of boundary times
                Event_Rep.SplitMultipleEvents(userId, firstEvent.eventID, boundaryList, annotationList);
            }
            con.Close();
        } //close method split_event_into_two()...
예제 #5
0
        }     //close method btnExport_Click()...

        private void btnImport_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
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = suggestedPath;
            openFileDialog.ShowDialog();
            string fileName = openFileDialog.FileName;

            if (!fileName.Equals(""))
            {
                Event_Rep.rewriteEventList(userId, fileName);
                show_new_day_on_UI(current_day_on_display);
            }
        }