Exemplo n.º 1
0
        private void PageFrame_Navigating(object sender, NavigatingCancelEventArgs e)
        {
            if (start > 0)
            {
                start--;
                return;
            }

            if (Content != null && !_allowDirectNavigation)
            {
                e.Cancel = true;

                _navArgs = e;

                DoubleAnimation animation0 = new DoubleAnimation();
                animation0.EasingFunction = new ExponentialEase()
                {
                    EasingMode = EasingMode.EaseOut, Exponent = 1
                };
                animation0.From       = 1;
                animation0.To         = 0;
                animation0.Duration   = _duration;
                animation0.Completed += SlideCompleted;
                PageFrame.BeginAnimation(OpacityProperty, animation0);
            }
            _allowDirectNavigation = false;
        }
Exemplo n.º 2
0
        private void SlideCompleted(object sender, EventArgs e)
        {
            _allowDirectNavigation = true;
            switch (_navArgs.NavigationMode)
            {
            case NavigationMode.New:
                if (_navArgs.Uri == null)
                {
                    PageFrame.Navigate(_navArgs.Content);
                }
                else
                {
                    PageFrame.Navigate(_navArgs.Uri);
                }
                break;

            case NavigationMode.Back:
                PageFrame.GoBack();
                break;

            case NavigationMode.Forward:
                PageFrame.GoForward();
                break;

            case NavigationMode.Refresh:
                PageFrame.Refresh();
                break;
            }

            Dispatcher.BeginInvoke(DispatcherPriority.Loaded,
                                   (ThreadStart) delegate()
            {
                DoubleAnimation animation0 = new DoubleAnimation();
                animation0.EasingFunction  = new ExponentialEase()
                {
                    EasingMode = EasingMode.EaseOut, Exponent = 1
                };
                animation0.From     = 0;
                animation0.To       = 1;
                animation0.Duration = _duration;
                PageFrame.BeginAnimation(OpacityProperty, animation0);
            });
        }