Example #1
0
 /// <summary>
 /// Selects all childs ViewModels <see cref="TimelineEventVM"/> of a <see cref="EventTypeTimelineVM"/>
 /// </summary>
 /// <param name="vm">The EventTypeTimelineVM element in the collection</param>
 public void SelectAllFrom(EventTypeTimelineVM vm)
 {
     EventTypesTimeline.Select(vm);
     vm.Selection.Replace(vm.ViewModels);
     foreach (var timelineEvent in vm.Selection)
     {
         timelineEvent.Selected = true;
     }
 }
Example #2
0
        void RemoveTimelineForEventType(EventType evtType)
        {
            EventTypeTimelineVM timeline = FindTimelineForEventType(evtType);

            // If the timeline is empty and it does not have an associated dashboard
            // button, get rid of it
            if (!timeline.Any() && !eventTypes.Any(evt => evt.Model == evtType))
            {
                EventTypesTimeline.ViewModels.Remove(timeline);
                timeline.Dispose();
                eventTypeToTimeline.Remove(evtType);
            }
        }
Example #3
0
        void ReplaceToEventTypesTimeline(IEnumerable <TimelineEventVM> viewModels)
        {
            var groupVMs = viewModels.GroupBy(ev => ev.Model.EventType);

            foreach (var grouping in groupVMs)
            {
                EventTypeTimelineVM timeline = FindTimelineForEventType(grouping.Key);
                var timelineEvents           = timeline.ViewModels;
                timelineEvents.Replace(grouping);
            }
            //Clear the Rest of EventTypeTimelines if necessary
            foreach (var eventType in eventTypeToTimeline.Keys.ToList().Except(groupVMs.Select(g => g.Key)))
            {
                if (eventTypeToTimeline [eventType].ViewModels.Any())
                {
                    eventTypeToTimeline [eventType].ViewModels.Clear();
                }
            }
        }
Example #4
0
        EventTypeTimelineVM FindTimelineForEventType(EventType evtType)
        {
            EventTypeTimelineVM timeline = null;

            if (!eventTypeToTimeline.TryGetValue(evtType, out timeline))
            {
                var eventType = evtType;
                if (GroupEventsByEventTypeName)
                {
                    timeline = eventTypeToTimeline.FirstOrDefault(kv => kv.Key.Name == evtType.Name).Value;
                }
                if (timeline == null)
                {
                    timeline = new EventTypeTimelineVM {
                        Model = evtType
                    };
                    EventTypesTimeline.ViewModels.Add(timeline);
                }
                eventTypeToTimeline [evtType] = timeline;
            }
            return(timeline);
        }