public override void Show(MvxViewModelRequest request)
        {
            var viewCreator = Mvx.Resolve <IMvxIosViewCreator>();
            var view        = viewCreator.CreateView(request);
            var uiView      = view as UIViewController;

            if (uiView == null)
            {
                throw new InvalidOperationException("Asking to show a view which is not a UIViewController!");
            }

            if (uiView is IMvxModalIosView)
            {
                _window?.GetVisibleViewController()?.PresentViewController(uiView, true, null);
                return;
            }

            if (request.PresentationValues != null && request.PresentationValues.ContainsKey(PresentationValues.SlideoutRootPresentation))
            {
                var openButton = new UIBarButtonItem {
                    Image = Images.Buttons.ThreeLinesButton
                };
                var mainNavigationController = new MainNavigationController(uiView, SlideoutNavigationController, openButton);
                SlideoutNavigationController.SetMainViewController(mainNavigationController, true);
            }
            else
            {
                var navController = SlideoutNavigationController.MainViewController as UINavigationController;
                navController?.PushViewController(uiView, true);
            }
        }
            public override void PresentViewController(UIViewController viewControllerToPresent, bool animated, NSAction completionHandler)
            {
                var openMenuButton = new UIBarButtonItem(CodeFramework.iOS.Images.MenuButton, UIBarButtonItemStyle.Plain, (s, e) => _slideoutNavigationController.Open(true));
                var ctrl           = new MainNavigationController(viewControllerToPresent, _slideoutNavigationController, openMenuButton);

                _slideoutNavigationController.SetMainViewController(ctrl, animated);
            }
Exemple #3
0
        public override void Show(MvxViewModelRequest request)
        {
            var uiView = this.CreateViewControllerFor(request) as UIViewController;

            if (uiView == null)
            {
                throw new InvalidOperationException("Asking to show a view which is not a UIViewController!");
            }

            if (request.PresentationValues != null && request.PresentationValues.ContainsKey(PresentationValues.SlideoutRootPresentation))
            {
                var openButton = new UIBarButtonItem {
                    Image = Images.Buttons.ThreeLines
                };
                var mainNavigationController = new MainNavigationController(uiView, SlideoutNavigationController, openButton);
                _generalNavigationController = mainNavigationController;
                SlideoutNavigationController.SetMainViewController(mainNavigationController, true);
            }
            else
            {
                _generalNavigationController.PushViewController(uiView, true);
            }
        }
        private void GoToMenu()
        {
            var vc = new MenuViewController();
            var slideoutController = new SlideoutNavigationController();

            slideoutController.MenuViewController = new MenuNavigationController(vc, slideoutController);

            var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;

            if (appDelegate != null)
            {
                appDelegate.Presenter.SlideoutNavigationController = slideoutController;
            }

            var openButton = new UIBarButtonItem {
                Image = Images.Buttons.ThreeLinesButton
            };
            var mainNavigationController = new MainNavigationController(GetInitialMenuViewController(), slideoutController, openButton);

            slideoutController.SetMainViewController(mainNavigationController, false);

            slideoutController.ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve;
            PresentViewController(slideoutController, true, null);
        }
        public override void Show(MvxViewModelRequest request)
        {
            var viewCreator = Mvx.Resolve <IMvxTouchViewCreator>();
            var view        = viewCreator.CreateView(request);
            var uiView      = view as UIViewController;

            if (uiView == null)
            {
                throw new InvalidOperationException("Asking to show a view which is not a UIViewController!");
            }

            if (uiView is IMvxModalTouchView)
            {
                _currentModal = (IMvxModalTouchView)uiView;
                var modalNavigationController = new UINavigationController(uiView);
                modalNavigationController.NavigationBar.Translucent = false;
                modalNavigationController.Toolbar.Translucent       = false;
                uiView.NavigationItem.LeftBarButtonItem             = new UIBarButtonItem(Theme.CurrentTheme.CancelButton, UIBarButtonItemStyle.Plain, (s, e) =>
                {
                    var vm = ((IMvxModalTouchView)uiView).ViewModel;
                    Mvx.Resolve <Cirrious.MvvmCross.Plugins.Messenger.IMvxMessenger>().Publish(new CodeFramework.Core.Messages.CancelationMessage(vm));
                    modalNavigationController.DismissViewController(true, null);
                    _currentModal = null;
                });
                PresentModalViewController(modalNavigationController, true);
            }
            else if (uiView is StartupView)
            {
                _window.RootViewController = uiView;
            }
            else if (uiView is AccountsView)
            {
                _slideoutController          = null;
                _generalNavigationController = new UINavigationController(uiView);
                _generalNavigationController.NavigationBar.Translucent = false;
                _generalNavigationController.Toolbar.Translucent       = false;
                Transition(_generalNavigationController);
            }
            else if (uiView is MenuBaseViewController)
            {
                _slideoutController = new SimpleSlideoutNavigationController();
                _slideoutController.MenuViewController = new MenuNavigationController(uiView, _slideoutController);
                uiView.NavigationController.NavigationBar.Translucent  = false;
                uiView.NavigationController.Toolbar.Translucent        = false;
                uiView.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(50, 50, 50);
                Transition(_slideoutController);
            }
            else
            {
                if (request.PresentationValues != null && request.PresentationValues.ContainsKey(PresentationValues.SlideoutRootPresentation))
                {
                    var mainNavigationController = new MainNavigationController(uiView, _slideoutController, new UIBarButtonItem(Theme.CurrentTheme.ThreeLinesButton, UIBarButtonItemStyle.Plain, (s, e) => _slideoutController.Open(true)));
                    _generalNavigationController = mainNavigationController;
                    _slideoutController.SetMainViewController(mainNavigationController, true);


                    //_generalNavigationController.NavigationBar.BarTintColor = Theme.CurrentTheme.ApplicationNavigationBarTint;
                    _generalNavigationController.NavigationBar.Translucent = false;
                    _generalNavigationController.Toolbar.Translucent       = false;
                }
                else
                {
                    _generalNavigationController.PushViewController(uiView, true);
                }
            }
        }