示例#1
0
        public void RefreshEvents(bool checkInit)
        {
            if (IsTimelineInitialized || !checkInit)
            {
                Utilities.Trace(this);

                foreach (TimelineBand b in m_bands)
                {
                    Debug.Assert(b.Calculator != null);

                    b.ClearEvents();

                    if (b.IsMainBand)
                    {
                        b.EventStore = m_eventStore;
                    }
                }

                MainBand.CalculateEventRows();

                foreach (TimelineBand b in m_bands)
                {
                    b.CalculateEventPositions();
                }

                foreach (TimelineBand b in m_bands)
                {
                    b.DisplayEvents();
                }

                TimelineUpdated?.Invoke(this, EventArgs.Empty);
            }

            EventsRefreshed?.Invoke(this, EventArgs.Empty);
        }
示例#2
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 (MainBand == null)
            {
                throw new Exception("At least one main timeline band should be specified");
            }

            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 = MainBand.Calculator.MaxVisibleDateTime - 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;
            IsTimelineInitialized = true;

            RefreshEvents(false);

            TimelineReady?.Invoke(this, new EventArgs());
        }