예제 #1
0
        public async Task RemovePageAsync(PopupPage page, bool animate = true)
        {
            if (page == null)
            {
                throw new NullReferenceException("Page can not be null");
            }

            if (page.IsBeingDismissed)
            {
                return;
            }

            animate = CanBeAnimated(animate);

            page.IsBeingDismissed = true;

            if (animate)
            {
                await page.DisappearingAnimation();
            }

            await RemoveAsync(page);

            await Task.Delay(50);

            if (animate)
            {
                page.DisposingAnimation();
            }

            page.IsBeingDismissed = false;

            await Task.Delay(5);
        }
예제 #2
0
        public Task RemovePageAsync(PopupPage page, bool animate = true)
        {
            lock (_locker)
            {
                if (page == null)
                {
                    throw new NullReferenceException("Page can not be null");
                }

                if (!_popupStack.Contains(page))
                {
                    throw new InvalidOperationException("The page has not been pushed yet or has been removed already");
                }

                if (page.DisappearingTransactionTask != null)
                {
                    return(page.DisappearingTransactionTask);
                }

                var task = InvokeThreadSafe(async() =>
                {
                    if (page.AppearingTransactionTask != null)
                    {
                        await page.AppearingTransactionTask;
                    }

                    lock (_locker)
                    {
                        if (!_popupStack.Contains(page))
                        {
                            return;
                        }
                    }

                    animate = CanBeAnimated(animate);

                    if (animate)
                    {
                        await page.DisappearingAnimation();
                    }

                    await RemoveAsync(page);

                    if (animate)
                    {
                        page.DisposingAnimation();
                    }

                    lock (_locker)
                    {
                        _popupStack.Remove(page);
                        page.DisappearingTransactionTask = null;
                    }
                });

                page.DisappearingTransactionTask = task;

                return(task);
            }
        }
        public async static Task RemovePageAsync(PopupPage page, bool animate = true)
        {
            if (page == null)
            {
                throw new NullReferenceException("Page can not be null");
            }

            if (!page.IsAnimate)
            {
                if (animate)
                {
                    await page.DisappearingAnimation();
                }
                RemovePopup(page);
                await Task.Delay(50);

                page.DisposingAnimation();
            }
        }
        public async Task RemovePageAsync(PopupPage page, bool animate = true)
        {
            lock (_popupStack)
            {
                if (!_popupStack.Contains(page))
                {
                    return;
                }

                _popupStack.Remove(page);
                page.IsBeingDismissed = true;
            }
            while (page.IsBeingAppear)
            {
                await Task.Delay(50);
            }

            animate = CanBeAnimated(animate);

            try
            {
                if (animate)
                {
                    await page.DisappearingAnimation();
                }

                await RemoveAsync(page);

                if (animate)
                {
                    page.DisposingAnimation();
                }
            }
            finally
            {
                page.IsBeingDismissed = false;
            }
        }
        public Task RemovePageAsync(PopupPage page, bool animate = true)
        {
            lock (_locker)
            {
                if (page == null)
                {
                    throw new RGPageInvalidException("Page cannot be null");
                }

                if (!_popupStack.Contains(page))
                {
                    throw new RGPopupStackInvalidException("The page has not been pushed yet or has been removed already");
                }

                if (page.DisappearingTransactionTask != null)
                {
                    return(page.DisappearingTransactionTask);
                }

                var task = InvokeThreadSafe(async() =>
                {
                    if (page.AppearingTransactionTask != null)
                    {
                        await page.AppearingTransactionTask;
                    }

                    lock (_locker)
                    {
                        if (!_popupStack.Contains(page))
                        {
                            return;
                        }
                    }

                    Popping?.Invoke(this, new PopupNavigationEventArgs(page, animate));

                    animate = CanBeAnimated(animate);

                    if (animate)
                    {
                        await page.DisappearingAnimation();
                    }

                    await RemoveAsync(page);

                    if (animate)
                    {
                        page.DisposingAnimation();
                    }

                    lock (_locker)
                    {
                        _popupStack.Remove(page);
                        page.DisappearingTransactionTask = null;

                        Popped?.Invoke(this, new PopupNavigationEventArgs(page, animate));
                    }
                });

                page.DisappearingTransactionTask = task;

                return(task);
            }
        }