Пример #1
0
        public override void RegisterAttributeTypes()
        {
            AttributeTypesToActionsDictionary.Add(
                typeof(MvxRootPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (UIViewController)this.CreateViewControllerFor(request);
                    ShowRootViewController(viewController,
                                           (MvxRootPresentationAttribute)attribute,
                                           request);
                },
                CloseAction = (viewModel, attribute) => CloseRootViewController(viewModel,
                                                                                (MvxRootPresentationAttribute)attribute)
            });

            AttributeTypesToActionsDictionary.Add(
                typeof(MvxChildPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (UIViewController)this.CreateViewControllerFor(request);
                    ShowChildViewController(viewController,
                                            (MvxChildPresentationAttribute)attribute,
                                            request);
                },
                CloseAction = (viewModel, attribute) => CloseChildViewController(viewModel,
                                                                                 (MvxChildPresentationAttribute)attribute)
            });


            AttributeTypesToActionsDictionary.Add(
                typeof(MvxTabPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (UIViewController)this.CreateViewControllerFor(request);
                    ShowTabViewController(viewController,
                                          (MvxTabPresentationAttribute)attribute,
                                          request);
                },
                CloseAction = (viewModel, attribute) => CloseTabViewController(viewModel,
                                                                               (MvxTabPresentationAttribute)attribute)
            });

            AttributeTypesToActionsDictionary.Add(
                typeof(MvxModalPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (UIViewController)this.CreateViewControllerFor(request);
                    ShowModalViewController(viewController, (MvxModalPresentationAttribute)attribute, request);
                },
                CloseAction = (viewModel, attribute) => CloseModalViewController(viewModel, (MvxModalPresentationAttribute)attribute)
            });

            AttributeTypesToActionsDictionary.Add(
                typeof(MvxMasterDetailPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (UIViewController)this.CreateViewControllerFor(request);
                    ShowMasterDetailSplitViewController(viewController, (MvxMasterDetailPresentationAttribute)attribute, request);
                },
                CloseAction = (viewModel, attribute) => CloseMasterSplitViewController(viewModel, (MvxMasterDetailPresentationAttribute)attribute)
            });
        }
        public override void RegisterAttributeTypes()
        {
            AttributeTypesToActionsDictionary.Add(
                typeof(MvxWindowPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (NSViewController)this.CreateViewControllerFor(request);
                    return(ShowWindowViewController(viewController, (MvxWindowPresentationAttribute)attribute, request));
                },
                CloseAction = (viewModel, attribute) => Close(viewModel)
            });

            AttributeTypesToActionsDictionary.Add(
                typeof(MvxContentPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (NSViewController)this.CreateViewControllerFor(request);
                    return(ShowContentViewController(viewController, (MvxContentPresentationAttribute)attribute, request));
                },
                CloseAction = (viewModel, attribute) => Close(viewModel)
            });

            AttributeTypesToActionsDictionary.Add(
                typeof(MvxModalPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (NSViewController)this.CreateViewControllerFor(request);
                    return(ShowModalViewController(viewController, (MvxModalPresentationAttribute)attribute, request));
                },
                CloseAction = (viewModel, attribute) => Close(viewModel)
            });

            AttributeTypesToActionsDictionary.Add(
                typeof(MvxSheetPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (NSViewController)this.CreateViewControllerFor(request);
                    return(ShowSheetViewController(viewController, (MvxSheetPresentationAttribute)attribute, request));
                },
                CloseAction = (viewModel, attribute) => Close(viewModel)
            });

            AttributeTypesToActionsDictionary.Add(
                typeof(MvxTabPresentationAttribute),
                new MvxPresentationAttributeAction
            {
                ShowAction = (viewType, attribute, request) =>
                {
                    var viewController = (NSViewController)this.CreateViewControllerFor(request);
                    return(ShowTabViewController(viewController, (MvxTabPresentationAttribute)attribute, request));
                },
                CloseAction = (viewModel, attribute) => Close(viewModel)
            });
        }
Пример #3
0
        public override void RegisterAttributeTypes()
        {
            base.RegisterAttributeTypes();

            AttributeTypesToActionsDictionary.Register <MvxCustomMasterDetailPagePresentationAttribute>(ShowMasterDetailPage, CloseMasterDetailPage);
        }
Пример #4
0
 public override void RegisterAttributeTypes()
 {
     base.RegisterAttributeTypes();
     AttributeTypesToActionsDictionary.Register <MvxWindowPresentationAttribute>(ShowWindow, CloseWindow);
 }
Пример #5
0
 public override void RegisterAttributeTypes()
 {
     AttributeTypesToActionsDictionary.Register <MvxActivityPresentationAttribute>(ShowActivity, CloseActivity);
     AttributeTypesToActionsDictionary.Register <MvxFragmentPresentationAttribute>(ShowFragment, CloseFragment);
     AttributeTypesToActionsDictionary.Register <MvxDialogFragmentPresentationAttribute>(ShowDialogFragment, CloseFragmentDialog);
 }
Пример #6
0
        public override void RegisterAttributeTypes()
        {
            if (AttributeTypesToActionsDictionary == null)
            {
                throw new InvalidOperationException("Cannot register attribute types on null dictionary");
            }

            AttributeTypesToActionsDictionary.Register <MvxRootPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowRootViewController(viewController, attribute, request));
            },
                CloseRootViewController);

            AttributeTypesToActionsDictionary.Register <MvxChildPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowChildViewController(viewController, attribute, request));
            },
                CloseChildViewController);

            AttributeTypesToActionsDictionary.Register <MvxTabPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowTabViewController(viewController, attribute, request));
            },
                CloseTabViewController);

            AttributeTypesToActionsDictionary.Register <MvxPagePresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowPageViewController(viewController, attribute, request));
            },
                ClosePageViewController);

            AttributeTypesToActionsDictionary.Register <MvxModalPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowModalViewController(viewController, attribute, request));
            },
                CloseModalViewController);

            AttributeTypesToActionsDictionary.Register <MvxSplitViewPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                var splitAttribute = attribute;
                return(splitAttribute.Position switch
                {
                    MasterDetailPosition.Master =>
                    ShowMasterSplitViewController(viewController, splitAttribute, request),
                    MasterDetailPosition.Detail =>
                    ShowDetailSplitViewController(viewController, splitAttribute, request),
                    _ => Task.FromResult(true)
                });
            },
Пример #7
0
        public override void RegisterAttributeTypes()
        {
            AttributeTypesToActionsDictionary.Register <MvxRootPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowRootViewController(viewController, attribute, request));
            },
                CloseRootViewController);

            AttributeTypesToActionsDictionary.Register <MvxChildPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowChildViewController(viewController, attribute, request));
            },
                CloseChildViewController);

            AttributeTypesToActionsDictionary.Register <MvxTabPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowTabViewController(viewController, attribute, request));
            },
                CloseTabViewController);

            AttributeTypesToActionsDictionary.Register <MvxPagePresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowPageViewController(viewController, attribute, request));
            },
                ClosePageViewController);

            AttributeTypesToActionsDictionary.Register <MvxModalPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                return(ShowModalViewController(viewController, attribute, request));
            },
                CloseModalViewController);

            AttributeTypesToActionsDictionary.Register <MvxSplitViewPresentationAttribute>(
                (viewType, attribute, request) =>
            {
                var viewController = (UIViewController)this.CreateViewControllerFor(request);
                var splitAttribute = attribute;
                switch (splitAttribute.Position)
                {
                case MasterDetailPosition.Master:
                    return(ShowMasterSplitViewController(viewController, splitAttribute, request));

                case MasterDetailPosition.Detail:
                    return(ShowDetailSplitViewController(viewController, splitAttribute, request));
                }
                return(Task.FromResult(true));
            },
                (viewModel, attribute) =>
            {
                var splitAttribute = attribute;
                switch (splitAttribute.Position)
                {
                case MasterDetailPosition.Master:
                    return(CloseMasterSplitViewController(viewModel, splitAttribute));

                case MasterDetailPosition.Detail:
                default:
                    return(CloseDetailSplitViewController(viewModel, splitAttribute));
                }
            });
        }