public static Storyboard CreateAnimation(this DependencyObject target, Dictionary<string, StoryboardInfo> storyboards, DependencyProperty animatingDependencyProperty, string propertyPath, string propertyKey, object initialValue, object targetValue, TimeSpan timeSpan, IEasingFunction easingFunction, Action releaseAction)
 {
     StoryboardInfo storyboardInfo;
     storyboards.TryGetValue(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey), out storyboardInfo);
     if (storyboardInfo != null)
     {
         DependencyObject storyboardTarget = storyboardInfo.StoryboardTarget;
         storyboardInfo.Storyboard.Stop();
         storyboards.Remove(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey));
         if (storyboardInfo.ReleaseAction != null)
         {
             storyboardInfo.ReleaseAction();
             storyboardInfo.ReleaseAction = (Action)null;
         }
     }
     storyboardInfo = new StoryboardInfo();
     storyboardInfo.Storyboard = DependencyPropertyAnimationHelper.CreateStoryboard(target, animatingDependencyProperty, propertyPath, propertyKey, ref targetValue, timeSpan, easingFunction);
     storyboardInfo.ReleaseAction = releaseAction;
     storyboardInfo.StoryboardTarget = target;
     storyboardInfo.AnimateFrom = initialValue;
     storyboardInfo.Storyboard.Completed += (EventHandler)((source, args) =>
        {
        storyboards.Remove(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey));
        if (storyboardInfo.ReleaseAction == null)
            return;
        storyboardInfo.ReleaseAction();
        storyboardInfo.ReleaseAction = (Action)null;
        });
     storyboards.Add(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey), storyboardInfo);
     return storyboardInfo.Storyboard;
 }
        public static Storyboard CreateAnimation(this DependencyObject target, Dictionary <string, StoryboardInfo> storyboards, DependencyProperty animatingDependencyProperty, string propertyPath, string propertyKey, object initialValue, object targetValue, TimeSpan timeSpan, IEasingFunction easingFunction, Action releaseAction)
        {
            StoryboardInfo storyboardInfo;

            storyboards.TryGetValue(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey), out storyboardInfo);
            if (storyboardInfo != null)
            {
                DependencyObject storyboardTarget = storyboardInfo.StoryboardTarget;
                storyboardInfo.Storyboard.Stop();
                storyboards.Remove(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey));
                if (storyboardInfo.ReleaseAction != null)
                {
                    storyboardInfo.ReleaseAction();
                    storyboardInfo.ReleaseAction = (Action)null;
                }
            }
            storyboardInfo                       = new StoryboardInfo();
            storyboardInfo.Storyboard            = DependencyPropertyAnimationHelper.CreateStoryboard(target, animatingDependencyProperty, propertyPath, propertyKey, ref targetValue, timeSpan, easingFunction);
            storyboardInfo.ReleaseAction         = releaseAction;
            storyboardInfo.StoryboardTarget      = target;
            storyboardInfo.AnimateFrom           = initialValue;
            storyboardInfo.Storyboard.Completed += (EventHandler)((source, args) =>
            {
                storyboards.Remove(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey));
                if (storyboardInfo.ReleaseAction == null)
                {
                    return;
                }
                storyboardInfo.ReleaseAction();
                storyboardInfo.ReleaseAction = (Action)null;
            });
            storyboards.Add(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey), storyboardInfo);
            return(storyboardInfo.Storyboard);
        }
Exemplo n.º 3
0
        internal void SkipToFillValueAnimation(XYDataPoint dataPoint, string propertyName)
        {
            string         storyboardKey  = DependencyPropertyAnimationHelper.GetStoryboardKey(propertyName);
            StoryboardInfo storyboardInfo = (StoryboardInfo)null;

            if (!dataPoint.Storyboards.TryGetValue(storyboardKey, out storyboardInfo) || storyboardInfo.Storyboard.Children.Count <= 0)
            {
                return;
            }
            storyboardInfo.Storyboard.SkipToFill();
        }
Exemplo n.º 4
0
 private bool IsAnimationDirectionChanged(StoryboardInfo si, double oldAnimateTo, double newAnimateTo)
 {
     if (si.AnimateFrom is double)
     {
         double num = (double)si.AnimateFrom;
         if (num > oldAnimateTo && num > newAnimateTo || num < oldAnimateTo && num < newAnimateTo)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
        internal virtual void OnXScaleChanged()
        {
            DateTime now = DateTime.Now;

            if (this.ChartArea == null)
            {
                return;
            }
            this.ChartArea.UpdateSession.BeginUpdates();
            bool flag = true;

            foreach (XYDataPoint xyDataPoint in (Collection <DataPoint>) this.Series.DataPoints)
            {
                xyDataPoint.XValueInScaleUnitsWithoutAnimation = this.Series.XAxis.Scale.ProjectDataValue(xyDataPoint.XValue);
                string         storyboardKey = DependencyPropertyAnimationHelper.GetStoryboardKey("XValueInScaleUnits");
                StoryboardInfo si            = (StoryboardInfo)null;
                if (xyDataPoint.Storyboards.TryGetValue(storyboardKey, out si) && si.Storyboard.Children.Count > 0)
                {
                    DoubleAnimation doubleAnimation = si.Storyboard.Children[0] as DoubleAnimation;
                    if (doubleAnimation != null && xyDataPoint.XValue != null)
                    {
                        double?to = doubleAnimation.To;
                        double xvalueInScaleUnits = xyDataPoint.XValueInScaleUnits;
                        if ((to.GetValueOrDefault() != xvalueInScaleUnits ? 1 : (!to.HasValue ? 1 : 0)) != 0)
                        {
                            if (!this.IsAnimationDirectionChanged(si, doubleAnimation.To.Value, xyDataPoint.XValueInScaleUnitsWithoutAnimation))
                            {
                                flag = false;
                            }
                            doubleAnimation.To = new double?(xyDataPoint.XValueInScaleUnitsWithoutAnimation);
                            continue;
                        }
                    }
                }
                xyDataPoint.XValueInScaleUnits = xyDataPoint.XValueInScaleUnitsWithoutAnimation;
            }
            if (!flag)
            {
                foreach (XYDataPoint dataPoint in (Collection <DataPoint>) this.Series.DataPoints)
                {
                    this.SkipToFillValueAnimation(dataPoint, "XValueInScaleUnits");
                }
            }
            if (this.Series.LabelVisibility == Visibility.Visible)
            {
                LabelVisibilityManager manager = this.LabelVisibilityManager;
                manager.InvalidateXIntervals();
                this.ChartArea.UpdateSession.ExecuteOnceAfterUpdating((Action)(() => manager.UpdateDataPointLabelVisibility()), (object)"LabelVisibilityManager_UpdateDataPointLabelVisibility", (string)null);
            }
            this.ChartArea.UpdateSession.EndUpdates();
        }
Exemplo n.º 6
0
        private void UpdateActualDataPointOpacity()
        {
            double         opacity        = this.Opacity;
            double         num            = this.Series == null || !this.Series.IsDataPointAppearsUnselected(this) ? (this.Series == null ? this.Opacity : Math.Min(this.Series.Opacity, this.Opacity)) : Math.Min(this.Series.UnselectedDataPointOpacity, this.UnselectedOpacity);
            string         storyboardKey  = DependencyPropertyAnimationHelper.GetStoryboardKey("ActualOpacity");
            StoryboardInfo storyboardInfo = (StoryboardInfo)null;

            if (this.Storyboards.TryGetValue(storyboardKey, out storyboardInfo) && storyboardInfo.Storyboard.Children.Count > 0)
            {
                DoubleAnimation doubleAnimation = storyboardInfo.Storyboard.Children[0] as DoubleAnimation;
                if (doubleAnimation != null)
                {
                    doubleAnimation.To = new double?(num);
                    return;
                }
            }
            this.ActualOpacity = num;
        }
Exemplo n.º 7
0
 internal void UpdateAllDataPointsSize()
 {
     foreach (BubbleDataPoint bubbleDataPoint in (Collection <DataPoint>) this.DataPoints)
     {
         if (bubbleDataPoint.IsSizeValueUsed)
         {
             bubbleDataPoint.SizeValueInScaleUnitsWithoutAnimation = bubbleDataPoint.SizeValue == null ? 0.0 : ((BubbleSeriesPresenter)this.SeriesPresenter).ProjectSizeToPixels((DataPoint)bubbleDataPoint, ValueHelper.ToDouble(bubbleDataPoint.SizeValue));
             string         storyboardKey  = DependencyPropertyAnimationHelper.GetStoryboardKey("SizeValueInScaleUnits");
             StoryboardInfo storyboardInfo = (StoryboardInfo)null;
             if (bubbleDataPoint.Storyboards.TryGetValue(storyboardKey, out storyboardInfo) && storyboardInfo.Storyboard.Children.Count > 0)
             {
                 DoubleAnimation doubleAnimation = storyboardInfo.Storyboard.Children[0] as DoubleAnimation;
                 if (doubleAnimation != null)
                 {
                     doubleAnimation.To = new double?(bubbleDataPoint.SizeValueInScaleUnitsWithoutAnimation);
                     continue;
                 }
             }
             bubbleDataPoint.SizeValueInScaleUnits = bubbleDataPoint.SizeValueInScaleUnitsWithoutAnimation;
         }
     }
 }
Exemplo n.º 8
0
 private bool IsAnimationDirectionChanged(StoryboardInfo si, double oldAnimateTo, double newAnimateTo)
 {
     if (si.AnimateFrom is double)
     {
         double num = (double)si.AnimateFrom;
         if (num > oldAnimateTo && num > newAnimateTo || num < oldAnimateTo && num < newAnimateTo)
             return true;
     }
     return false;
 }