Beispiel #1
0
        protected virtual bool ShowPanelAndResetToRoot(MvxSidebarPresentationAttribute attribute, UIViewController viewController)
        {
            var navigationController = (SideBarViewController as MvxSidebarViewController).NavigationController;

            if (navigationController == null)
            {
                return(false);
            }

            navigationController.ViewControllers = new[] { viewController };

            switch (attribute.Panel)
            {
            case MvxPanelEnum.Left:
            case MvxPanelEnum.Right:
                break;

            case MvxPanelEnum.Center:
            default:
                viewController.ShowMenuButton(SideBarViewController);
                break;

            case MvxPanelEnum.CenterWithLeft:
                viewController.ShowMenuButton(SideBarViewController, showLeft: true, showRight: false);
                break;

            case MvxPanelEnum.CenterWithRight:
                viewController.ShowMenuButton(SideBarViewController, showLeft: false, showRight: true);
                break;
            }

            return(true);
        }
Beispiel #2
0
        protected virtual void ShowSidebarViewController(
            UIViewController viewController,
            MvxSidebarPresentationAttribute attribute,
            MvxViewModelRequest request)
        {
            if (SideBarViewController == null)
            {
                ShowRootViewController(new MvxSidebarViewController(), null, request);
            }

            switch (attribute.HintType)
            {
            case MvxPanelHintType.PopToRoot:
                ShowPanelAndPopToRoot(attribute, viewController);
                break;

            case MvxPanelHintType.ResetRoot:
                ShowPanelAndResetToRoot(attribute, viewController);
                break;

            case MvxPanelHintType.PushPanel:
            default:
                ShowPanel(attribute, viewController);
                break;
            }

            if (!attribute.ShowPanel)
            {
                var menu = Mvx.Resolve <IMvxSidebarViewController>();
                menu?.CloseMenu();
            }
        }
Beispiel #3
0
        protected virtual bool ShowPanel(MvxSidebarPresentationAttribute attribute, UIViewController viewController)
        {
            var navigationController = SideBarViewController.NavigationController;

            if (navigationController == null)
            {
                return(false);
            }

            switch (attribute.Panel)
            {
            case MvxPanelEnum.Left:
            case MvxPanelEnum.Right:
                break;

            case MvxPanelEnum.Center:
            default:
                navigationController.PushViewController(viewController, attribute.Animated);
                break;

            case MvxPanelEnum.CenterWithLeft:
                navigationController.PushViewController(viewController, attribute.Animated);
                viewController.ShowMenuButton(SideBarViewController, showLeft: true, showRight: false);
                break;

            case MvxPanelEnum.CenterWithRight:
                navigationController.PushViewController(viewController, attribute.Animated);
                viewController.ShowMenuButton(SideBarViewController, showLeft: false, showRight: true);
                break;
            }

            return(true);
        }
Beispiel #4
0
        protected virtual bool CloseSidebarViewController(IMvxViewModel viewModel, MvxSidebarPresentationAttribute attribute)
        {
            if (SideBarViewController != null && SideBarViewController.CloseChildViewModel(viewModel))
            {
                return(true);
            }

            return(false);
        }
Beispiel #5
0
        protected virtual bool ShowPanelAndPopToRoot(MvxSidebarPresentationAttribute attribute, UIViewController viewController)
        {
            var navigationController = (SideBarViewController as MvxSidebarViewController).NavigationController;

            if (navigationController == null)
            {
                return(false);
            }

            navigationController.PopToRootViewController(false);
            navigationController.PushViewController(viewController, false);

            return(true);
        }