Example #1
0
        protected virtual Task <bool> ShowModalViewController(
            UIViewController viewController,
            MvxModalPresentationAttribute attribute,
            MvxViewModelRequest request)
        {
            // Content size should be set to a target view controller, not the navigation one
            if (attribute.PreferredContentSize != default(CGSize))
            {
                viewController.PreferredContentSize = attribute.PreferredContentSize;
            }

            // setup modal based on attribute
            if (attribute.WrapInNavigationController)
            {
                viewController = CreateNavigationController(viewController);
            }

            viewController.ModalPresentationStyle = attribute.ModalPresentationStyle;
            viewController.ModalTransitionStyle   = attribute.ModalTransitionStyle;

            // Check if there is a modal already presented first. Otherwise use the window root
            var modalHost = ModalViewControllers.LastOrDefault() ?? _window.RootViewController;

            modalHost.PresentViewController(
                viewController,
                attribute.Animated,
                null);

            ModalViewControllers.Add(viewController);
            return(Task.FromResult(true));
        }
Example #2
0
        protected virtual void ShowModalViewController(
            UIViewController viewController,
            MvxModalPresentationAttribute attribute,
            MvxViewModelRequest request)
        {
            // setup modal based on attribute
            if (attribute.WrapInNavigationController)
            {
                viewController = CreateNavigationController(viewController);
            }

            viewController.ModalPresentationStyle = attribute.ModalPresentationStyle;
            viewController.ModalTransitionStyle   = attribute.ModalTransitionStyle;
            if (attribute.PreferredContentSize != default(CGSize))
            {
                viewController.PreferredContentSize = attribute.PreferredContentSize;
            }

            // Check if there is a modal already presented first. Otherwise use the window root
            var modalHost = ModalViewControllers.LastOrDefault() ?? _window.RootViewController;

            modalHost.PresentViewController(
                viewController,
                attribute.Animated,
                null);

            ModalViewControllers.Add(viewController);
        }
Example #3
0
        private void showModalDialogViewController(UIViewController viewController, MvxBasePresentationAttribute attribute, MvxViewModelRequest request)
        {
            viewController.ModalPresentationStyle = UIModalPresentationStyle.Custom;
            viewController.TransitioningDelegate  = modalTransitionDelegate;

            getCurrentControllerForPresenting(MasterNavigationController).PresentViewController(viewController, true, null);

            ModalViewControllers.Add(viewController);
        }
Example #4
0
        protected virtual void ShowModalCardViewController(UIViewController viewController, MvxBasePresentationAttribute attribute, MvxViewModelRequest request)
        {
            viewController.ModalPresentationStyle = UIModalPresentationStyle.Custom;
            viewController.TransitioningDelegate  = FromBottomTransitionDelegate;
            MasterNavigationController.PresentViewController(viewController, true, null);

            ModalViewControllers.Add(viewController);

            FromBottomTransitionDelegate.WireToViewController(viewController, () => ModalViewControllers.Remove(viewController));
        }
Example #5
0
        private void showModalDialogViewController(Type viewType, MvxBasePresentationAttribute attribute, MvxViewModelRequest request)
        {
            var viewController = (UIViewController)this.CreateViewControllerFor(request);

            viewController.ModalPresentationStyle = UIModalPresentationStyle.Custom;
            viewController.TransitioningDelegate  = modalTransitionDelegate;

            TopViewController.PresentViewController(viewController, true, null);

            ModalViewControllers.Add(viewController);
        }
Example #6
0
        private void showModalCardViewController(Type viewType, MvxBasePresentationAttribute attribute, MvxViewModelRequest request)
        {
            var viewController     = (UIViewController)this.CreateViewControllerFor(request);
            var transitionDelegate = new FromBottomTransitionDelegate(
                () => ModalViewControllers.Remove(viewController)
                );

            viewController.ModalPresentationStyle = UIModalPresentationStyle.Custom;
            viewController.TransitioningDelegate  = transitionDelegate;

            TopViewController.PresentViewController(viewController, true, null);

            ModalViewControllers.Add(viewController);
        }
Example #7
0
        private void showModalCardViewController(UIViewController viewController, MvxBasePresentationAttribute attribute, MvxViewModelRequest request)
        {
            var transitionDelegate = new FromBottomTransitionDelegate(
                () => ModalViewControllers.Remove(viewController)
                );

            viewController.ModalPresentationStyle = UIModalPresentationStyle.Custom;
            viewController.TransitioningDelegate  = transitionDelegate;

            getCurrentControllerForPresenting(MasterNavigationController).PresentViewController(viewController, true, null);

            ModalViewControllers.Add(viewController);

            transitionDelegate.WireToViewController(viewController);
        }