Example #1
0
        /// <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()...