Ejemplo n.º 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()...
Ejemplo n.º 2
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()...