Beispiel #1
0
        /// <summary>
        /// Hide current overlay panel
        /// </summary>
        /// <param name="length"></param>
        /// <param name="left_right"></param>
        void HideOverlayPanel(double length, bool left_right)
        {
            _leftRightAnimation = left_right;
            _tempPaneAnimation  = _tempPane;
            _lengthAnimation    = length;

            _animation            = new DoubleAnimation();
            _animation.From       = length;
            _animation.To         = 0.0;
            _animation.Duration   = new Duration(TimeSpan.FromMilliseconds(200));
            _animation.Completed += new EventHandler(HideOverlayPanel_Completed);

            if (left_right)
            {
                _tempPaneAnimation.BeginAnimation(FrameworkElement.WidthProperty, _animation);
            }
            else
            {
                _tempPaneAnimation.BeginAnimation(FrameworkElement.HeightProperty, _animation);
            }

            DoubleAnimation anOpacity = new DoubleAnimation();

            anOpacity.From     = 1.0;
            anOpacity.To       = 0.0;
            anOpacity.Duration = new Duration(TimeSpan.FromMilliseconds(200));
            panelFront.BeginAnimation(DockPanel.OpacityProperty, anOpacity);
        }
Beispiel #2
0
        /// <summary>
        /// Showing animation completed event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>Set final lenght and reset animation object on temp overlay panel</remarks>
        void ShowOverlayPanel_Completed(object sender, EventArgs e)
        {
            _animation.Completed -= new EventHandler(ShowOverlayPanel_Completed);

            if (_tempPaneAnimation != null)
            {
                if (_leftRightAnimation)
                {
                    _tempPaneAnimation.BeginAnimation(FrameworkElement.WidthProperty, null);
                    _tempPaneAnimation.Width = _lengthAnimation;
                }
                else
                {
                    _tempPaneAnimation.BeginAnimation(FrameworkElement.HeightProperty, null);
                    _tempPaneAnimation.Height = _lengthAnimation;
                }
            }

            _tempPaneAnimation = null;
        }
Beispiel #3
0
        /// <summary>
        /// Forces to hide current overlay panel
        /// </summary>
        /// <remarks>Usually used when a second animation is about to start from a different button</remarks>
        void ForceHideOverlayPanel()
        {
            if (_tempPaneAnimation != null)
            {
                _animation.Completed -= new EventHandler(HideOverlayPanel_Completed);
                _animation.Completed -= new EventHandler(ShowOverlayPanel_Completed);
                if (_leftRightAnimation)
                {
                    _tempPaneAnimation.BeginAnimation(FrameworkElement.WidthProperty, null);
                    //_tempPaneAnimation.Width = 0;
                }
                else
                {
                    _tempPaneAnimation.BeginAnimation(FrameworkElement.HeightProperty, null);
                    //_tempPaneAnimation.Height = 0;
                }

                _tempPaneAnimation.Close();
                _tempPaneAnimation = null;
            }
        }
        /// <summary>
        /// Show current overlay pane which hosts current auto-hiding content
        /// </summary>
        /// <param name="length">Target length</param>
        /// <param name="left_right">Resize orientaion</param>
        void ShowOverlayPanel(double length, bool left_right)
        {
            ForceHideOverlayPanel();

            _leftRightAnimation = left_right;
            _tempPaneAnimation = _tempPane;
            _lengthAnimation = length;

            _animation = new DoubleAnimation();
            _animation.From = 0.0;
            _animation.To = length;
            _animation.Duration = new Duration(TimeSpan.FromMilliseconds(200));
            _animation.Completed += new EventHandler(ShowOverlayPanel_Completed);
            if (_leftRightAnimation)
                _tempPaneAnimation.BeginAnimation(FrameworkElement.WidthProperty, _animation);
            else
                _tempPaneAnimation.BeginAnimation(FrameworkElement.HeightProperty, _animation);

            DoubleAnimation anOpacity = new DoubleAnimation();
            anOpacity.From = 0.0;
            anOpacity.To = 1.0;
            anOpacity.Duration = new Duration(TimeSpan.FromMilliseconds(200));
            panelFront.BeginAnimation(DockPanel.OpacityProperty, anOpacity);
        }