Ejemplo n.º 1
0
        public async Task PopViewAsync(DefaultAnimationBehavior defaultAnimation, bool animateIn = false, bool animateOut = true, Animation otherAnimation = null)
        {
            //TODO: Exception handling
            if (CurrentIndex > 0)
            {
                // Animate transition
                await AnimateTransitioning.DefaultTransitioning(
                    CurrentView,
                    defaultAnimation,
                    false,
                    animateIn || animateOut || otherAnimation != null,
                    (animateIn)?PreviousView : null,
                    otherAnimation);

                await Task.Delay(1000);

                // After awaiting, the thread will not be on the UI thread, thus needing the dispatcher
                // Change the content view whenever the stack changes (always show the top one)
                ContentGrid.Dispatcher.BeginInvokeOnMainThread(() =>
                {
                    ContentGrid.Children.Remove(CurrentView);

                    // Remove top view from stack
                    ViewStack.Remove(CurrentView);

                    // This is the new current view after the old current view being removed
                    CurrentView.Appeared = true;
                });
            }
        }
Ejemplo n.º 2
0
        public async Task PushViewAsync(NavigatableView view, DefaultAnimationBehavior defaultAnimation, bool animateIn = true, bool animateOut = false, Animation otherAnimations = null)
        {
            // Add to stack
            ViewStack.Add(view);
            view.Parent = this;

            // Initialize the position
            if (animateIn)
            {
                view.InitializeDefaultTransitionPosition(defaultAnimation);
            }

            // Change the content view whenever the stack changes (always show the top one)
            ContentGrid.Children.Add(view);

            await AnimateTransitioning.DefaultTransitioning(
                view,
                defaultAnimation,
                true,
                animateIn || animateOut || otherAnimations != null,
                (animateOut)?PreviousView : null,
                otherAnimations);

            CurrentView.Appeared = true;
            if (PreviousView != null)
            {
                PreviousView.Appeared = false;
            }
        }
Ejemplo n.º 3
0
        public async Task PopViewAsync(bool animateIn = false, bool animateOut = true, Animation otherAnimations = null)
        {
            //TODO: Exception handling
            if (CurrentIndex > 0)
            {
                // Animate transition
                await AnimateTransitioning.CustomTransitioning(CurrentView, PreviousView, false, animateIn, animateOut, otherAnimations);

                // After awaiting, the thread will not be on the UI thread, thus needing the dispatcher
                // Change the content view whenever the stack changes (always show the top one)
                ContentGrid.Dispatcher.BeginInvokeOnMainThread(() =>
                {
                    ContentGrid.Children.Remove(CurrentView);

                    // Remove top view from stack
                    ViewStack.Remove(CurrentView);
                });

                CurrentView.Appeared = true;
            }
        }
Ejemplo n.º 4
0
        public async Task PushViewAsync(NavigatableView view, bool animateIn = true, bool animateOut = false, Animation otherAnimations = null)
        {
            // Add to stack
            ViewStack.Add(view);
            view.Parent = this;

            // Initialize the position
            if (animateIn)
            {
                view.InitializePosition();
            }

            // Change the content view whenever the stack changes (always show the top one)
            ContentGrid.Children.Add(view);

            // Animate transition
            await AnimateTransitioning.CustomTransitioning(CurrentView, PreviousView, true, animateIn, animateOut, otherAnimations);

            CurrentView.Appeared = true;
            if (PreviousView != null)
            {
                PreviousView.Appeared = false;
            }
        }