public void Initialize( List <TimelineEvent> events, bool sorted = false ) { Debug.Assert(events != null); if (!sorted) { events.Sort(new Comparison <TimelineEvent>((l, r) => DateTime.Compare(l.StartDate, r.StartDate))); } m_list = events; m_hasDuration = false; m_initialized = false; if (m_list.Count > 0) { SingleDelayedInvoke.Invoke(new Action(() => { InitSearch(); m_initialized = true; }), INDEX_CREATION_DELAY); } else { m_byStart = null; m_initialized = false; } }
public static void Invoke( Action action, int delay ) { SingleDelayedInvoke d; d = new SingleDelayedInvoke(delay); d.Invoke(action); }
public TimelineBuilder( TimelineBand band, Canvas canvas, DataTemplate template, DataTemplate textTemplate, int columnCount, TimelineCalendar timeline, DataTemplate eventTemplate, double maxEventHeight, bool assignRows, DateTime currDateTime ) { SingleDelayedInvoke poolBuilder; Debug.Assert(template != null); Debug.Assert(canvas != null); Debug.Assert(eventTemplate != null); Debug.Assert(band != null); Debug.Assert(columnCount > 0); Debug.Assert(timeline != null); Debug.Assert(maxEventHeight > 0); m_parent = band; m_eventTemplate = eventTemplate; m_canvas = canvas; m_template = template;; m_columnCount = columnCount; m_timeline = timeline; m_assignRows = assignRows; m_markerTemplate = textTemplate; m_visibleEvents = new Dictionary <TimelineEvent, object>(); m_dispEvents = new Dictionary <TimelineEvent, TimelineDisplayEvent>(); m_maxEventHeight = maxEventHeight; CurrentDateTime = currDateTime; // // precreate some elements, so that we can later take them from pool // poolBuilder = new SingleDelayedInvoke(); for (int i = 0; i < INITIAL_EVENT_POOL_SIZE; ++i) { m_elementPool.Push((UIElement)CreateEventElement()); } Utilities.Trace(this); }