This class aggregates resize events of TimelineBand controls and loadcomplete of datasources, so that we know when all controls are resized and all xml files downloaded.
Ejemplo n.º 1
0
        private void OnControlLoaded(
            object sender,
            RoutedEventArgs e
            )
        {
            Utilities.Trace(this);

            if (!m_loaded)
            {
                HookChildElements(this.Children);

                if (m_bands.Count > 0 && m_mainBand != null)
                {
                    // we are in silverlight mode, so all bands and urls are specified in
                    // xaml and we can start data load immediately
                    m_isJavascriptMode = false;

                    m_notifier = new DataControlNotifier(m_dataUrls, m_bands);
                    m_notifier.LoadComplete += OnControlAndDataComlete;
                    m_notifier.Start();
                    m_notifier.CheckCompleted();
                }
                else
                {
                    // we will need to wait till Run method is called from javascript
                    m_isJavascriptMode       = true;
                    m_notifier               = new DataControlNotifier();
                    m_notifier.LoadComplete += OnControlAndDataComlete;
                }
                m_loaded = true;
            }

            // Do not remove copyright notice
            AddCopyrightElement();
        }
Ejemplo n.º 2
0
        public void Reload(
            )
        {
            if (m_bands.Count > 0 && m_mainBand != null)
            {
                m_isJavascriptMode = false;

                m_notifier = new DataControlNotifier(m_dataUrls, m_bands);
                m_notifier.LoadComplete += OnControlAndDataComlete;
                m_notifier.Start();
                m_notifier.CheckCompleted();
            }
        }
Ejemplo n.º 3
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());
            }
        }
Ejemplo n.º 4
0
        private void OnControlLoaded(
            object                                      sender, 
            RoutedEventArgs                             e
        )
        {

            Utilities.Trace(this);
            
            if (!m_loaded) 
            {
                HookChildElements(this.Children);
        
                if (m_bands.Count > 0 && m_mainBand != null)
                {
                    // we are in silverlight mode, so all bands and urls are specified in 
                    // xaml and we can start data load immediately
                    m_isJavascriptMode = false;

                    m_notifier = new DataControlNotifier(m_dataUrls, m_bands);
                    m_notifier.LoadComplete += OnControlAndDataComlete; 
                    m_notifier.Start();
                    m_notifier.CheckCompleted();
                }
                else
                {
                    // we will need to wait till Run method is called from javascript
                    m_isJavascriptMode = true;
                    m_notifier = new DataControlNotifier();
                    m_notifier.LoadComplete += OnControlAndDataComlete; 
                }
                m_loaded = true;
            }

            // Do not remove copyright notice
            AddCopyrightElement();
        }
Ejemplo n.º 5
0
        public void Reload(
        )
        {
            if (m_bands.Count > 0 && m_mainBand != null)
            {
                m_isJavascriptMode = false;

                m_notifier = new DataControlNotifier(m_dataUrls, m_bands);
                m_notifier.LoadComplete += OnControlAndDataComlete;
                m_notifier.Start();
                m_notifier.CheckCompleted();
            }
        }
Ejemplo n.º 6
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());
            }
        }