コード例 #1
0
        private void PopupAnimation_Completed(object sender, EventArgs e)
        {
            if (HideBoard == null)
            {
                var board = new Storyboard();

                foreach (FanIconControl ctrl in spContent.Children)
                {
                    if (spContent.Children.IndexOf(ctrl) < spContent.Children.Count - 1)
                    {
                        ctrl.GridContent.Effect = ShadowEffect;

                        var anim = new DoubleAnimationUsingKeyFrames();
                        anim.SetValue(Storyboard.TargetNameProperty, ctrl.GridContent.Tag);
                        anim.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Effect).(Opacity)"));
                        anim.KeyFrames.Add(new SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0))));
                        anim.KeyFrames.Add(new SplineDoubleKeyFrame(0.3, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(800))));

                        board.Children.Add(anim);
                    }
                    if (!ctrl.IsRendered)
                    {
                        ctrl.Render();
                    }
                }

                board.Begin(this);

                Activate();
            }
        }
コード例 #2
0
ファイル: Elevator.xaml.cs プロジェクト: steamypassion/X
        public static void addCarts(Grid grd, int noOfCarts)
        {
            Grid grdCarts         = (Grid)grd.FindName("grdCarts");
            var  currentCartCount = grdCarts.Children.Count();

            for (var i = 0; i < noOfCarts; i++)
            {
                var id = currentCartCount + i;

                Image img = new Image();
                img.Name = $"elCart{id}";
                img.VerticalAlignment     = VerticalAlignment.Top;
                img.Source                = new BitmapImage(new Uri("ms-appx:///Assets/elevator-compartment-empty.png"));
                img.Margin                = new Thickness(2, 0, 0, 3);
                img.RenderTransformOrigin = new Point(0.5, 0.5);
                img.RenderTransform       = new CompositeTransform();
                img.Projection            = new PlaneProjection();

                Storyboard sb = new Storyboard();
                DoubleAnimationUsingKeyFrames dauk = new DoubleAnimationUsingKeyFrames();
                dauk.SetValue(Storyboard.TargetNameProperty, $"elCart{id}");
                dauk.SetValue(Storyboard.TargetPropertyProperty, "(UIElement.RenderTransform).(CompositeTransform.TranslateY)");
                dauk.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.Parse("00:00:01")), Value = 0
                });
                sb.Children.Add(dauk);
                grd.Resources.Add($"sbMoveElevator{id}", sb);


                grdCarts.Children.Add(img);
            }
        }
コード例 #3
0
        /// <summary>
        /// 使用透明度和显示状态的改变来进行动画隐藏该控件
        /// </summary>
        /// <param name="element">要执行动画的控件</param>
        /// <param name="duration">持续时间</param>
        /// <param name="completed">执行完成后的行为</param>
        public static void BeginHideWithOpacityAndVisibility(this DependencyObject element, TimeSpan duration, Action completed)
        {
            Storyboard sb = new Storyboard();
            DoubleAnimationUsingKeyFrames daukf = new DoubleAnimationUsingKeyFrames();

            daukf.SetValue(Storyboard.TargetProperty, element);
            daukf.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Opacity)"));
            EasingDoubleKeyFrame f1 = new EasingDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)));
            EasingDoubleKeyFrame f2 = new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(duration));

            daukf.KeyFrames.Add(f1);
            daukf.KeyFrames.Add(f2);
            ObjectAnimationUsingKeyFrames oaukf = new ObjectAnimationUsingKeyFrames();

            oaukf.SetValue(Storyboard.TargetProperty, element);
            oaukf.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(UIElement.Visibility)"));
            DiscreteObjectKeyFrame f3 = new DiscreteObjectKeyFrame(Visibility.Visible, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)));
            DiscreteObjectKeyFrame f4 = new DiscreteObjectKeyFrame(Visibility.Collapsed, KeyTime.FromTimeSpan(duration));

            oaukf.KeyFrames.Add(f3);
            oaukf.KeyFrames.Add(f4);
            sb.Children.Add(daukf);
            sb.Children.Add(oaukf);

            sb.Completed += (s, e) =>
            {
                if (completed != null)
                {
                    completed();
                }
            };
            sb.Begin();
        }
コード例 #4
0
        private Storyboard ResizeBox(float f, int num)
        {
            Storyboard sb = new Storyboard();
            DoubleAnimationUsingKeyFrames dauk1 = new DoubleAnimationUsingKeyFrames();

            dauk1.BeginTime = new TimeSpan(0);
            dauk1.SetValue(Storyboard.TargetNameProperty, "Box" + num.ToString());
            dauk1.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("RenderTransform.ScaleX"));
            SplineDoubleKeyFrame sdkf1 = new SplineDoubleKeyFrame();

            sdkf1.KeyTime = TimeSpan.FromSeconds(0.5);
            sdkf1.Value   = f;
            dauk1.KeyFrames.Add(sdkf1);
            sb.Children.Add(dauk1);

            DoubleAnimationUsingKeyFrames dauk2 = new DoubleAnimationUsingKeyFrames();

            dauk2.BeginTime = new TimeSpan(0);
            dauk2.SetValue(Storyboard.TargetNameProperty, "Box" + num.ToString());
            dauk2.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("RenderTransform.ScaleY"));
            SplineDoubleKeyFrame sdkf2 = new SplineDoubleKeyFrame();

            sdkf2.KeyTime = TimeSpan.FromSeconds(0.5);
            sdkf2.Value   = f;
            dauk2.KeyFrames.Add(sdkf2);
            sb.Children.Add(dauk2);
            return(sb);
        }
コード例 #5
0
ファイル: Sudoku.xaml.cs プロジェクト: DeeJee/SilverSudoku
        private DoubleAnimationUsingKeyFrames CreateDoubleAnimation(TimeSpan begintime, string targetproperty, string targetName)
        {
            DoubleAnimationUsingKeyFrames da = new DoubleAnimationUsingKeyFrames();

            da.BeginTime = begintime;
            da.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(targetproperty, new Object[0]));
            da.SetValue(Storyboard.TargetNameProperty, targetName);
            return(da);
        }
コード例 #6
0
        public void MovePeicesFromPosition()
        {
            sb.Completed -= new EventHandler(sb_Completed);
            sb.Completed += new EventHandler(sb_Completed);
            double LengthPerPeice   = AnimationLength.TotalMilliseconds / _canvasPeices.Children.Count;
            double currentPeiceTime = 0;


            for (int i = _canvasPeices.Children.Count; i > 1; i--)
            {
                Grid item = _canvasPeices.Children[i - 1] as Grid;

                DoubleAnimationUsingKeyFrames frame = new DoubleAnimationUsingKeyFrames();
                frame.SetValue(Storyboard.TargetProperty, item);
                frame.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Canvas.LeftProperty));
                DoubleAnimationUsingKeyFrames frameY = new DoubleAnimationUsingKeyFrames();
                frameY.SetValue(Storyboard.TargetProperty, item);
                frameY.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(Canvas.TopProperty));


                SplineDoubleKeyFrame startFrame = new SplineDoubleKeyFrame();
                startFrame.KeyTime = TimeSpan.FromMilliseconds(currentPeiceTime);
                startFrame.Value   = (double)item.GetValue(Canvas.LeftProperty);// -item.Width;
                SplineDoubleKeyFrame startFrameY = new SplineDoubleKeyFrame();
                startFrameY.KeyTime = TimeSpan.FromMilliseconds(currentPeiceTime);
                startFrameY.Value   = (double)item.GetValue(Canvas.TopProperty);// -item.Height;

                currentPeiceTime = currentPeiceTime + LengthPerPeice;

                SplineDoubleKeyFrame endFrame = new SplineDoubleKeyFrame();
                endFrame.KeyTime = TimeSpan.FromMilliseconds(currentPeiceTime);
                endFrame.Value   = -item.Width;// (double)item.GetValue(Canvas.LeftProperty);
                SplineDoubleKeyFrame endFrameY = new SplineDoubleKeyFrame();
                endFrameY.KeyTime = TimeSpan.FromMilliseconds(currentPeiceTime);
                endFrameY.Value   = -item.Height;// (double)item.GetValue(Canvas.TopProperty);


                frame.KeyFrames.Add(startFrame);
                frame.KeyFrames.Add(endFrame);
                sb.Children.Add(frame);

                frameY.KeyFrames.Add(startFrameY);
                frameY.KeyFrames.Add(endFrameY);
                sb.Children.Add(frameY);
            }
            //foreach (Grid item in _canvasPeices.Children)
            //{
            //    item.SetValue(Canvas.LeftProperty, -item.Width);
            //    item.SetValue(Canvas.TopProperty, -item.Height);

            //}

            _canvasPeices.BeginStoryboard(sb);
        }
コード例 #7
0
        private void ResetRotation_Click(object sender, RoutedEventArgs e)
        {
            Storyboard s = new Storyboard();

            s.Duration = TimeSpan.FromMilliseconds(500);
            DoubleAnimationUsingKeyFrames anim   = new DoubleAnimationUsingKeyFrames();
            SplineDoubleKeyFrame          spline = new SplineDoubleKeyFrame()
            {
                KeyTime = s.Duration.TimeSpan, Value = 0, KeySpline = new KeySpline()
                {
                    ControlPoint1 = new System.Windows.Point(0, 0.1), ControlPoint2 = new System.Windows.Point(0.1, 1)
                }
            };

            anim.KeyFrames.Add(spline);
            spline.Value = 0;
            anim.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Rotation"));
            s.Children.Add(anim);
            Storyboard.SetTarget(anim, Map);
            s.Completed += (sender2, e2) =>
            {
                s.Stop();
                Map.Rotation = 0;
            };
            s.Begin();
        }
コード例 #8
0
        /// <summary>
        /// Updates the delay between consecutive timelines
        /// </summary>
        /// <param name="newDelay">Delay duration</param>
        private void UpdateTimelineDelay(Duration newDelay)
        {
            Duration nextDelay = new Duration(TimeSpan.FromSeconds(0));

            if (sb != null)
            {
                for (int i = 0; i < sb.Children.Count; i++)
                {
                    // The first five animations are for translation
                    // The next five animations are for opacity
                    if (i == 5)
                    {
                        nextDelay = newDelay;
                    }
                    else
                    {
                        nextDelay += newDelay;
                    }


                    DoubleAnimationUsingKeyFrames timeline = sb.Children[i] as DoubleAnimationUsingKeyFrames;
                    if (timeline != null)
                    {
                        timeline.SetValue(DoubleAnimationUsingKeyFrames.BeginTimeProperty, nextDelay.TimeSpan);
                    }
                }
            }
        }
コード例 #9
0
ファイル: MapNavigator.cs プロジェクト: thindev/SmartScene
        private void ResetRotation_Click(object sender, RoutedEventArgs e)
        {
            Storyboard s = new Storyboard {
                Duration = TimeSpan.FromMilliseconds(500.0)
            };
            DoubleAnimationUsingKeyFrames frames = new DoubleAnimationUsingKeyFrames();
            SplineDoubleKeyFrame          frame2 = new SplineDoubleKeyFrame {
                KeyTime = s.Duration.TimeSpan,
                Value   = 0.0
            };
            KeySpline spline = new KeySpline {
                ControlPoint1 = new Point(0.0, 0.1),
                ControlPoint2 = new Point(0.1, 1.0)
            };

            frame2.KeySpline = spline;
            SplineDoubleKeyFrame keyFrame = frame2;

            frames.KeyFrames.Add(keyFrame);
            keyFrame.Value = 0.0;
            frames.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Rotation", new object[0]));
            s.Children.Add(frames);
            Storyboard.SetTarget(frames, this.Map);
            s.Completed += delegate(object sender2, EventArgs e2) {
                s.Stop();
                this.Map.Rotation = 0.0;
            };
            s.Begin();
        }
コード例 #10
0
        private static SplineDoubleKeyFrame CreateDoubleAnimation(ref Storyboard sb,
                                                                  TranslateTransform translation, PropertyPath property)
        {
            DoubleAnimationUsingKeyFrames da = new DoubleAnimationUsingKeyFrames();

            da.SetValue(NameProperty, string.Concat("da_", property));

            SplineDoubleKeyFrame sdkf = new SplineDoubleKeyFrame();

            sdkf.SetValue(NameProperty, string.Concat("sdkf_", property));

            sdkf.Value   = 0;
            sdkf.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.25));

            //define the KeySpline
            KeySpline ksX = new KeySpline();

            ksX.ControlPoint1 = new Point(1.0, 0.25);
            ksX.ControlPoint2 = new Point(0.75, 1.0);
            sdkf.KeySpline    = ksX;

            //add the SplineDoubleKeyFrame to the DoubleAnimationUsingKeyFrames
            da.KeyFrames.Add(sdkf);

            //define which TranslateTransform property will be targeted by the DoubleAnimation
            Storyboard.SetTarget(da, translation);
            Storyboard.SetTargetProperty(da, property);
            sb.Children.Add(da);
            return(sdkf);
        }
コード例 #11
0
        public Storyboard FadeInAndAnimateHeight(UIElement control, bool setOpacityToZero, double oldHeight, double newHeight)
        {
            Storyboard sb = new Storyboard();
            // Opacity
            DoubleAnimation daOpacity = new DoubleAnimation()
            {
                Duration       = TimeSpan.FromMilliseconds(150),
                To             = 1,
                EasingFunction = new CircleEase {
                    EasingMode = EasingMode.EaseInOut
                }
            };

            if (setOpacityToZero)
            {
                daOpacity.From = 0;
            }

            daOpacity.SetValue(Storyboard.TargetPropertyProperty, "UIElement.Opacity");
            Storyboard.SetTarget(daOpacity, control);

            sb.Children.Add(daOpacity);


            // Height
            DoubleAnimationUsingKeyFrames da = new DoubleAnimationUsingKeyFrames()
            {
                EnableDependentAnimation = true
            };

            da.SetValue(Storyboard.TargetPropertyProperty, "FrameworkElement.Height");

            EasingDoubleKeyFrame oldHeightKeyFrame = new EasingDoubleKeyFrame()
            {
                KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)),
                Value   = oldHeight
            };

            EasingDoubleKeyFrame heightKeyFrame = new EasingDoubleKeyFrame()
            {
                KeyTime        = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200)),
                Value          = newHeight,
                EasingFunction = new CircleEase {
                    EasingMode = EasingMode.EaseInOut
                }
            };

            da.KeyFrames.Add(oldHeightKeyFrame);
            da.KeyFrames.Add(heightKeyFrame);

            Storyboard.SetTarget(da, control);

            sb.Children.Add(da);

            return(sb);
        }
コード例 #12
0
        /// <summary>
        /// 使用宽度改变来进行动画
        /// </summary>
        /// <param name="element">要执行动画的控件</param>
        /// <param name="from">开始值</param>
        /// <param name="to">结束值</param>
        /// <param name="duration">持续时间</param>
        /// <param name="completed">执行完成后的行为</param>
        public static void BeginWidth(this UIElement element, double from, double to, TimeSpan duration, Action completed)
        {
            Storyboard sb = new Storyboard();
            DoubleAnimationUsingKeyFrames daukf = new DoubleAnimationUsingKeyFrames();

            daukf.SetValue(Storyboard.TargetProperty, element);
            daukf.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Width)"));
            EasingDoubleKeyFrame f1 = new EasingDoubleKeyFrame(from, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)));
            EasingDoubleKeyFrame f2 = new EasingDoubleKeyFrame(to, KeyTime.FromTimeSpan(duration));

            daukf.KeyFrames.Add(f1);
            daukf.KeyFrames.Add(f2);
            sb.Children.Add(daukf);

            sb.Completed += (s, e) =>
            {
                if (completed != null)
                {
                    completed();
                }
            };
            sb.Begin();
        }
コード例 #13
0
        private DoubleAnimationUsingKeyFrames CreateOpacityKeyFrame(string propertypath, double value)
        {
            DoubleAnimationUsingKeyFrames keyframes = new DoubleAnimationUsingKeyFrames
            {
                BeginTime = TimeSpan.Zero
            };

            keyframes.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(propertypath));

            SplineDoubleKeyFrame spkeyframe = new SplineDoubleKeyFrame()
            {
                KeySpline = new KeySpline(0.25, 1, 0.05, 1),
                KeyTime   = TimeSpan.FromMilliseconds(750),
                Value     = value
            };

            keyframes.KeyFrames.Add(spkeyframe);

            return(keyframes);
        }
コード例 #14
0
        private void SendToLocation(DragablzItem dragablzItem, double location)
        {
            double activeTarget;

            if (Math.Abs(_getLocation(dragablzItem) - location) < 1.0
                ||
                _activeStoryboardTargetLocations.TryGetValue(dragablzItem, out activeTarget) &&
                Math.Abs(activeTarget - location) < 1.0)
            {
                return;
            }

            _activeStoryboardTargetLocations[dragablzItem] = location;

            var storyboard = new Storyboard {
                FillBehavior = FillBehavior.Stop
            };

            storyboard.WhenComplete(sb =>
            {
                _setLocation(dragablzItem, location);
                sb.Remove(dragablzItem);
                _activeStoryboardTargetLocations.Remove(dragablzItem);
            });

            var timeline = new DoubleAnimationUsingKeyFrames();

            timeline.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(_canvasDependencyProperty));
            timeline.KeyFrames.Add(
                new EasingDoubleKeyFrame(location, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(200)))
            {
                EasingFunction = new CubicEase()
                {
                    EasingMode = EasingMode.EaseOut
                }
            });
            storyboard.Children.Add(timeline);
            storyboard.Begin(dragablzItem, true);
        }
コード例 #15
0
        public Storyboard AnimateHeight(DependencyObject control, double oldHeight, double newHeight)
        {
            Storyboard sbFadeAnimateHeight = new Storyboard();

            sbFadeAnimateHeight.Completed += animateHeight;

            DoubleAnimationUsingKeyFrames da = new DoubleAnimationUsingKeyFrames()
            {
                EnableDependentAnimation = true
            };

            da.SetValue(Storyboard.TargetPropertyProperty, "FrameworkElement.Height");

            EasingDoubleKeyFrame oldHeightKeyFrame = new EasingDoubleKeyFrame()
            {
                KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)),
                Value   = oldHeight
            };

            EasingDoubleKeyFrame heightKeyFrame = new EasingDoubleKeyFrame()
            {
                KeyTime        = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400)),
                Value          = newHeight,
                EasingFunction = new CircleEase {
                    EasingMode = EasingMode.EaseInOut
                }
            };

            da.KeyFrames.Add(oldHeightKeyFrame);
            da.KeyFrames.Add(heightKeyFrame);

            Storyboard.SetTarget(da, control);

            sbFadeAnimateHeight.Children.Add(da);
            return(sbFadeAnimateHeight);
        }
コード例 #16
0
 public static void SetStoryBoardTarget(DoubleAnimationUsingKeyFrames animation, string targetName)
 {
     animation.SetValue(Storyboard.TargetNameProperty, targetName);
 }
コード例 #17
0
        private void Window_Activated(object sender, EventArgs e)
        {
            if (IsClosing || IsOpened)
            {
                return;
            }
            IsOpened = true;

            DockIcon.IconName = App.StartupPath + "Container-Opened.png";

            PopupBoard            = new Storyboard();
            PopupBoard.Completed += new EventHandler(PopupAnimation_Completed);

            var rect = DockIcon.IconRect;

            var delay = Config.PopupDelay;

            if ((System.Windows.Forms.Control.ModifierKeys & System.Windows.Forms.Keys.Shift) == System.Windows.Forms.Keys.Shift)
            {
                delay = 5000;
            }

            for (var i = 0; i < spContent.Children.Count; i++)
            {
                var ctrl = spContent.Children[i] as FanIconControl;

                var k = (double)(spContent.Children.Count - 1 - i) / MaxItems;

                var animRotate = new DoubleAnimationUsingKeyFrames();
                animRotate.SetValue(Storyboard.TargetNameProperty, ctrl.Name);
                animRotate.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)"));
                animRotate.KeyFrames.Add(new SplineDoubleKeyFrame(k * Angle, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(delay))));
                animRotate.DecelerationRatio = 0.8;

                var animMargin = new ThicknessAnimationUsingKeyFrames();
                animMargin.SetValue(Storyboard.TargetNameProperty, ctrl.Name);
                animMargin.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Margin)"));
                animMargin.KeyFrames.Add(new SplineThicknessKeyFrame(
                                             new Thickness(0, 0, -IconSize / 2 * (1 - Math.Sin((1 - k) * Math.PI / 2)) - (IconSize - rect.Width) / 2,
                                                           rect.Height + IconSize * (spContent.Children.Count - 1 - i)),
                                             KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(delay))));
                animMargin.DecelerationRatio = 0.8;

                var animOpacity = new DoubleAnimationUsingKeyFrames();
                animOpacity.SetValue(Storyboard.TargetNameProperty, ctrl.BorderTitle.Tag);
                animOpacity.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Opacity)"));
                animOpacity.KeyFrames.Add(new SplineDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(delay))));
                animOpacity.DecelerationRatio = 1;

                var animIconSize = new Int32AnimationUsingKeyFrames();
                animIconSize.SetValue(Storyboard.TargetNameProperty, ctrl.Name);
                animIconSize.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.IconSize)"));
                animIconSize.KeyFrames.Add(new SplineInt32KeyFrame(rect.Width, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0))));
                animIconSize.KeyFrames.Add(new SplineInt32KeyFrame(IconSize, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(delay))));
                animIconSize.DecelerationRatio = 1;

                PopupBoard.Children.Add(animRotate);
                PopupBoard.Children.Add(animMargin);
                PopupBoard.Children.Add(animOpacity);
                PopupBoard.Children.Add(animIconSize);
            }

            PopupBoard.Begin(this);
        }
コード例 #18
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            if (IsClosing)
            {
                e.Cancel = !AllowClose;
            }
            else
            {
                IsClosing  = true;
                AllowClose = false;

                e.Cancel = true;

                if (PopupBoard is Storyboard)
                {
                    PopupBoard.Stop(this);
                    PopupBoard = null;
                }
                HideBoard            = new Storyboard();
                HideBoard.Completed += new EventHandler((od, ed) =>
                {
                    AllowClose = true;
                    Close();
                });

                var rect = DockIcon.IconRect;

                var delay = Config.HideDelay;
                if ((System.Windows.Forms.Control.ModifierKeys & System.Windows.Forms.Keys.Shift) == System.Windows.Forms.Keys.Shift)
                {
                    delay = 5000;
                }

                for (var i = 0; i < spContent.Children.Count; i++)
                {
                    var ctrl = spContent.Children[i] as FanIconControl;

                    ctrl.GridContent.Effect = null;

                    var animRotate = new DoubleAnimationUsingKeyFrames();
                    animRotate.SetValue(Storyboard.TargetNameProperty, ctrl.Name);
                    animRotate.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)"));
                    animRotate.KeyFrames.Add(new SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(delay))));
                    animRotate.DecelerationRatio = 0.8;

                    var animMargin = new ThicknessAnimationUsingKeyFrames();
                    animMargin.SetValue(Storyboard.TargetNameProperty, ctrl.Name);
                    animMargin.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Margin)"));
                    animMargin.KeyFrames.Add(new SplineThicknessKeyFrame(
                                                 new Thickness(0),
                                                 KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(delay))));
                    animMargin.DecelerationRatio = 0.8;

                    var animOpacity = new DoubleAnimationUsingKeyFrames();
                    animOpacity.SetValue(Storyboard.TargetNameProperty, ctrl.BorderTitle.Tag);
                    animOpacity.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.Opacity)"));
                    animOpacity.KeyFrames.Add(new SplineDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(delay))));
                    animOpacity.DecelerationRatio = 1;

                    var animIconSize = new Int32AnimationUsingKeyFrames();
                    animIconSize.SetValue(Storyboard.TargetNameProperty, ctrl.Name);
                    animIconSize.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("(FrameworkElement.IconSize)"));
                    animIconSize.KeyFrames.Add(new SplineInt32KeyFrame(rect.Width, KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(delay))));
                    animIconSize.DecelerationRatio = 1;

                    HideBoard.Children.Add(animRotate);
                    HideBoard.Children.Add(animMargin);
                    HideBoard.Children.Add(animOpacity);
                    HideBoard.Children.Add(animIconSize);
                }

                HideBoard.Begin(this);
            }
            base.OnClosing(e);
        }