コード例 #1
0
        private static void OnTimeFrameCollectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimelineBand timelineBand = d as TimelineBand;

            if (timelineBand == null)
            {
                return;
            }

            ObservableCollection <ITimeRange> oldTimeFrameCollection = e.OldValue as ObservableCollection <ITimeRange>;

            if (oldTimeFrameCollection != null)
            {
                oldTimeFrameCollection.CollectionChanged -= timelineBand.TimeFrameCollection_CollectionChanged;
            }

            ObservableCollection <ITimeRange> newTimeFrameCollection = e.NewValue as ObservableCollection <ITimeRange>;

            if (newTimeFrameCollection != null)
            {
                newTimeFrameCollection.CollectionChanged += timelineBand.TimeFrameCollection_CollectionChanged;;
            }

            if (timelineBand._isLoaded)
            {
                timelineBand.InitTimeFrameElements();
            }
        }
コード例 #2
0
        private static void OnCurrentDateTimeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TimelineBand timelineBand = d as TimelineBand;

            if (timelineBand == null)
            {
                return;
            }

            DateTime oldDateTime = (DateTime)e.OldValue;
            DateTime newDateTime = (DateTime)e.NewValue;

            timelineBand.UpdateTimelineBandElementsPositionByDateTime(oldDateTime, newDateTime);

            if (timelineBand.HostTimeline != null)
            {
                timelineBand.HostTimeline.CurrentDateTime = timelineBand.CurrentDateTime;
            }
        }
コード例 #3
0
 private void HookTimelineBands(object element)
 {
     if (element is TimelineBand)
     {
         TimelineBand timelineBand = element as TimelineBand;
         timelineBand.HostTimeline = this;
         if (timelineBand.IsMainBand && _mainTimelineBand == null)
         {
             _mainTimelineBand = timelineBand;
         }
     }
     else if (element is Panel)
     {
         Panel panel = element as Panel;
         foreach (object childElement in panel.Children)
         {
             HookTimelineBands(childElement);
         }
     }
 }