Exemple #1
0
        private async Task TransitionDefault(IPanelViewController hideController, IPanelViewController showController)
        {
            Task hideTask = null;
            Task showTask = null;

            if (hideController != null)
            {
                hideTask = hideController.HideAsync();
            }

            if (showController != null)
            {
                showController.SetParentViewContainer(container);
                showTask = showController.ShowAsync();
            }

            if (hideTask != null)
            {
                await hideTask.ConfigureAwait(true);
            }

            if (showTask != null)
            {
                await showTask.ConfigureAwait(true);
            }
        }
Exemple #2
0
 private void Start()
 {
     controller = GetComponent <IPanelViewController>();
     if (controller != null)
     {
         provider.Add(controller);
     }
 }
 public async Task ShowAsync(IPanelViewController panelViewController)
 {
     currentViewController = panelViewController;
     foreach (var swapController in controllers)
     {
         await swapController.TransitionAsync();
     }
 }
Exemple #4
0
 private async Task LoadView(IPanelViewController controller)
 {
     if (controller.IsViewLoaded)
     {
         return;
     }
     controller.SetParentViewContainer(container);
     await controller.LoadViewAsync();
 }
Exemple #5
0
 /// <summary>
 /// This method allows popping and pushing as one action with no transition required between.
 /// </summary>
 /// <param name="popCount">number of panels to pop</param>
 /// <param name="controller">controller to push</param>
 public async Task PopAndPushAsync(int popCount, IPanelViewController controller)
 {
     if (popCount > stack.Count)
     {
         popCount = stack.Count;
     }
     stack.RemoveRange(stack.Count - popCount, popCount);
     stack.Add(controller);
     await TransitionAsync().ConfigureAwait(false);
 }
Exemple #6
0
        public async void Swap()
        {
            IPanelViewController swapController = controller;

            if (swapController == null)
            {
                swapController = controllerProvider.Get(panelType);
            }
            await swapSystem.ShowAsync(swapController);

            Refresh();
        }
Exemple #7
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();
                }
            }
        }
 public ChangeVisibilityCommand([NotNull] IPanelViewController panelViewController)
 {
     if (panelViewController == null) throw new ArgumentNullException("panelViewController");
     m_PanelViewController = panelViewController;
 }
 public void Remove(IPanelViewController controller)
 {
     controllers.Remove(controller.PanelType);
 }
 /// <summary>
 /// Clear all panels from the stack and then push a panel on top
 /// </summary>
 public async void ClearAndPush(IPanelViewController viewController)
 {
     await ClearAndPushAsync(viewController);
 }
Exemple #11
0
 /// <summary>
 /// Push panel options onto top of panel stack
 /// </summary>
 /// <param name="controller"></param>
 public async void Push(IPanelViewController controller)
 {
     await PushAsync(controller).ConfigureAwait(false);
 }
Exemple #12
0
 /// <summary>
 /// Clear all panels from the stack and then push a panel on top
 /// </summary>
 /// <returns>Awaitable task that completes when the panel transitions complete</returns>
 public async Task ClearAndPushAsync(IPanelViewController viewController)
 {
     stack.Clear();
     stack.Add(viewController);
     await TransitionAsync().ConfigureAwait(false);
 }
Exemple #13
0
 public async void Show(IPanelViewController controller)
 {
     await ShowAsync(controller).ConfigureAwait(false);
 }
 /// <summary>
 /// Push panel options onto top of panel stack
 /// </summary>
 /// <param name="options"></param>
 /// <returns>Task that completes when panel is done being pushed</returns>
 public async Task PushAsync(IPanelViewController controller)
 {
     stack.Add(controller);
     await TransitionAsync();
 }
 /// <summary>
 /// Push panel options onto top of panel stack
 /// </summary>
 /// <param name="controller"></param>
 public async void Push(IPanelViewController controller)
 {
     await PushAsync(controller);
 }
Exemple #16
0
 /// <summary>
 /// This method allows popping and pushing as one action with no transition required between.
 /// </summary>
 /// <param name="popCount">number of panels to pop</param>
 /// <param name="controller">controller to push</param>
 public async void PopAndPush(int popCount, IPanelViewController controller)
 {
     await PopAndPushAsync(popCount, controller).ConfigureAwait(false);
 }
 public async void Show(IPanelViewController controller)
 {
     await ShowAsync(controller);
 }
Exemple #18
0
 /// <summary>
 /// Clear all panels from the stack and then push a panel on top
 /// </summary>
 public async void ClearAndPush(IPanelViewController viewController)
 {
     await ClearAndPushAsync(viewController).ConfigureAwait(false);
 }
 public ChangeOrientationToLeftCommand(IPanelViewController panelViewController)
 {
     m_PanelViewController = panelViewController;
 }
Exemple #20
0
 /// <summary>
 /// Push panel options onto top of panel stack
 /// </summary>
 /// <param name="options"></param>
 /// <returns>Task that completes when panel is done being pushed</returns>
 public async Task PushAsync(IPanelViewController controller)
 {
     stack.Add(controller);
     await TransitionAsync().ConfigureAwait(false);
 }
 public void Add(IPanelViewController controller)
 {
     controllers.Add(controller.PanelType, controller);
 }
Exemple #22
0
 public void Push(IPanelViewController panelController)
 {
     panelController.ShowAsync(true).Wait();
     controllerList.Add(panelController);
 }
 /// <summary>
 /// This method allows popping and pushing as one action with no transition required between.
 /// </summary>
 /// <param name="popCount">number of panels to pop</param>
 /// <param name="controller">controller to push</param>
 public async void PopAndPush(int popCount, IPanelViewController controller)
 {
     await PopAndPushAsync(popCount, controller);
 }