/// <summary> /// Resets the UI with the XML provided in the XML document. /// </summary> /// <param name="doc">The XML document that contains the data for the timeline events.</param> public void ResetEvents( XDocument doc ) { m_eventStore = new TimelineEventStore(LoadEventDocument(doc)); ClearSelection(); RefreshEvents(); }
public TimelineTray() { m_bands = new List <TimelineBand>(); m_eventStore = new TimelineEventStore(new List <TimelineEvent>()); MoreLinkText = MORE_LINK_TEXT; this.Loaded += OnControlLoaded; this.SizeChanged += OnSizeChanged; this.MouseWheel += OnMouseWheel; }
/// <summary> /// Remove all events from timeline screen</summary> public void ClearEvents() { if (m_visibleEvents != null) { foreach (object e in m_visibleEvents.Values) { RemoveEvent(e); } } m_visibleEvents = new Dictionary <TimelineEvent, object>(); m_dispEvents = new Dictionary <TimelineEvent, TimelineDisplayEvent>(); m_events = new TimelineEventStore(new List <TimelineEvent>()); }
public TimelineTray( ) { m_dataUrls = new TimelineUrlCollection(); m_bands = new List <TimelineBand>(); m_eventStore = new TimelineEventStore(new List <TimelineEvent>()); MoreLinkText = MORE_LINK_TEXT; this.Loaded += OnControlLoaded; this.SizeChanged += OnSizeChanged; this.MouseWheel += OnMouseWheel; #if SILVERLIGHT Application.Current.Host.Content.FullScreenChanged += OnFullScreenChanged; #endif }
/// <summary> /// Resets the timeline using a list of events to provide to the UI. /// </summary> /// <param name="events">The events to reset the UI with.</param> public void ResetEvents(List <TimelineEvent> passEvents, bool fixDates = true) { // fix event dates if (fixDates) { foreach (TimelineEvent e in passEvents) { if (!e.IsDuration) { e.EndDate = e.StartDate; } } } m_eventStore = new TimelineEventStore(passEvents); ClearSelection(); RefreshEvents(); }
/// /// <summary> /// Removes all events from all timeline bands</summary> /// public void ClearEvents( ) { m_eventStore = new TimelineEventStore(new List <TimelineEvent>()); RefreshEvents(); }
/// /// <summary> /// This happens when we have all data and all timeline band controls have /// completed resizing, so we ready to show content</summary> /// private void OnControlAndDataComlete( object sender, EventArgs e ) { TimeSpan visibleWindow; List <TimelineEvent> events = new List <TimelineEvent>(); TimelineDisplayEvent.MoreLinkText = MoreLinkText; TimelineDisplayEvent.TeaserSize = TeaserSize; m_currentDateTime = CurrentDateTime; #if SILVERLIGHT if (m_notifier != null) { m_notifier.StreamList.ForEach(s => events.AddRange(LoadEventDocument(XDocument.Load(s, LoadOptions.None)))); } #else if (m_notifier != null) { foreach (Stream s in m_notifier.StreamList) { System.Xml.XmlTextReader reader; reader = new System.Xml.XmlTextReader(s); events.AddRange(LoadEventDocument(XDocument.Load(reader, LoadOptions.None))); } } #endif if (m_notifier != null && m_notifier.StreamList.Count > 0) { m_eventStore = new TimelineEventStore(events); } if (m_mainBand == null) { throw new Exception("At least one main timeline band should be specified"); } m_mainBand.CreateTimelineCalculator( CalendarType, CurrentDateTime, MinDateTime, MaxDateTime ); m_bands.ForEach(b => b.CreateTimelineCalculator(CalendarType, CurrentDateTime, MinDateTime, MaxDateTime)); // // now we need to calculate visible timeline window and // assign it to all timelineband controls // visibleWindow = m_mainBand.Calculator.MaxVisibleDateTime - m_mainBand.Calculator.MinVisibleDateTime; foreach (TimelineBand band in m_bands) { band.VisibleTimeSpan = visibleWindow; band.ResetVisibleDaysHighlight(); band.Calculator.BuildColumns(); band.OnCurrentDateChanged += OnCurrentDateChanged; if (band.IsMainBand) { band.OnSelectionChanged += OnSelectionChanged; } } m_notifier = null; m_initialized = true; RefreshEvents(false); if (TimelineReady != null) { TimelineReady(this, new EventArgs()); } }