Пример #1
0
 /// 
 /// <summary>
 /// Removes all events from all timeline bands</summary>
 /// 
 public void ClearEvents(
 )
 {
     m_eventStore = new TimelineEventStore(new List<TimelineEvent>());
     RefreshEvents();
 }
Пример #2
0
		/// <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>                         events,
            bool                                        fixDates = true
        )
        {
            //
            // fix event dates
            //
            if (fixDates)
            { 
                foreach (TimelineEvent e in events)
                {
                    if (!e.IsDuration)
                    {
                        e.EndDate = e.StartDate;
                    }
                }
            }

            m_eventStore = new TimelineEventStore(events);
            ClearSelection();
            RefreshEvents();
        }
Пример #3
0
        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
        }
Пример #4
0
		/// <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();
        }
Пример #5
0
        /// 
        /// <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.VisibleTimeSpan = TimeSpan.FromDays(1);
                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());
            }
        }