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);
        }
        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);
        }