Esempio n. 1
0
        public async Task TransitionAsync()
        {
            if (activeControllers == null)
            {
                activeControllers = ListPool <IPanelViewController> .Get();
            }

            var showControllers = ListPool <IPanelViewController> .Get();

            try
            {
                PanelStackUtility.GetVisiblePanelViewControllers(panelStackSystem, showControllers);
            }
            catch (Exception e)
            {
                throw new AggregateException("Unable to get visible panel view controllers.", e);
            }

            var hideControllers = activeControllers.Where(x => !showControllers.Contains(x));

            try
            {
                //Not using null propagation because this would bypass the unity null check
                // ReSharper disable once UseNullPropagation
                if (null != eventManager)
                {
                    eventManager.Lock();
                }

                //Load Views
                await LoadViews(showControllers).ConfigureAwait(true);

                //Sort Views so things overlay property
                SortViews();

                //Simultaneous Show/Hide
                //TODO: Support Instant, ShowThenHide, HideThenShow, etc
                var transitionTask = TransitionDefault(hideControllers, showControllers);

                ListPool <IPanelViewController> .Release(activeControllers);

                activeControllers = showControllers;

                await transitionTask.ConfigureAwait(true);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            finally
            {
                //Not using null propagation because this would bypass the unity null check
                // ReSharper disable once UseNullPropagation
                if (null != eventManager)
                {
                    eventManager.Unlock();
                }
            }
        }
Esempio n. 2
0
        public async Task TransitionAsync()
        {
            try
            {
                //Not using null propagation because this would bypass the unity null check
                // ReSharper disable once UseNullPropagation
                if (null != eventManager)
                {
                    eventManager.Lock();
                }

                var hideController = activePanelController;
                var showController = panelSwapSystem.CurrentViewController;

                //Load Views
                if (showController != null)
                {
                    await LoadView(showController).ConfigureAwait(true);
                }

                var transitionTask = TransitionDefault(hideController, showController);
                await transitionTask.ConfigureAwait(true);

                activePanelController = showController;
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            finally
            {
                //Not using null propagation because this would bypass the unity null check
                // ReSharper disable once UseNullPropagation
                if (null != eventManager)
                {
                    eventManager.Unlock();
                }
            }
        }