Beispiel #1
0
        public override ValueTask <MvxBasePresentationAttribute?> CreatePresentationAttribute(Type?viewModelType, Type?viewType)
        {
            if (MasterNavigationController == null &&
                (TabBarViewController == null || !TabBarViewController.CanShowChildView()))
            {
                MvxLog.Instance.Trace($"PresentationAttribute nor MasterNavigationController found for {viewType.Name}. " +
                                      $"Assuming Root presentation");
                var rootAttribute = new MvxRootPresentationAttribute()
                {
                    WrapInNavigationController = true,
                    ViewType      = viewType,
                    ViewModelType = viewModelType
                };
                return(new ValueTask <MvxBasePresentationAttribute?>(rootAttribute));
            }
            MvxLog.Instance.Trace($"PresentationAttribute not found for {viewType?.Name}. " +
                                  $"Assuming animated Child presentation");
            var childAttribute = new MvxChildPresentationAttribute()
            {
                ViewType      = viewType,
                ViewModelType = viewModelType
            };

            return(new ValueTask <MvxBasePresentationAttribute?>(childAttribute));
        }
Beispiel #2
0
        protected MvxBasePresentationAttribute GetPresentationAttributes(UIViewController viewController)
        {
            if (viewController is IMvxOverridePresentationAttribute vc)
            {
                var presentationAttribute = vc.PresentationAttribute();

                if (presentationAttribute != null)
                {
                    return(presentationAttribute);
                }
            }

            var attribute = viewController.GetType().GetCustomAttributes(typeof(MvxBasePresentationAttribute), true).FirstOrDefault() as MvxBasePresentationAttribute;

            if (attribute != null)
            {
                return(attribute);
            }

            if (MasterNavigationController == null
                &&
                (TabBarViewController == null || !TabBarViewController.CanShowChildView(viewController))
                )
            {
                MvxTrace.Trace($"PresentationAttribute nor MasterNavigationController found for {viewController.GetType().Name}. Assuming Root presentation");
                return(new MvxRootPresentationAttribute()
                {
                    WrapInNavigationController = true
                });
            }

            MvxTrace.Trace($"PresentationAttribute not found for {viewController.GetType().Name}. Assuming animated Child presentation");
            return(new MvxChildPresentationAttribute());
        }
Beispiel #3
0
        public override MvxBasePresentationAttribute CreatePresentationAttribute(Type viewModelType, Type viewType)
        {
            if (MasterNavigationController == null &&
                (TabBarViewController == null || !TabBarViewController.CanShowChildView()))
            {
                _logger?.LogTrace(
                    "PresentationAttribute nor MasterNavigationController found for {viewTypeName}. Assuming Root presentation",
                    viewType.Name);
                return(new MvxRootPresentationAttribute()
                {
                    WrapInNavigationController = true,
                    ViewType = viewType,
                    ViewModelType = viewModelType
                });
            }

            _logger?.LogTrace(
                "PresentationAttribute not found for {viewTypeName}. Assuming Root presentation",
                viewType.Name);
            return(new MvxChildPresentationAttribute()
            {
                ViewType = viewType,
                ViewModelType = viewModelType
            });
        }
Beispiel #4
0
        public virtual MvxBasePresentationAttribute CreatePresentationAttribute(Type viewModelType, Type viewType)
        {
            if (MasterNavigationController == null &&
                (TabBarViewController == null ||
                 !TabBarViewController.CanShowChildView()))
            {
                MvxTrace.Trace($"PresentationAttribute nor MasterNavigationController found for {viewType.Name}. " +
                               $"Assuming Root presentation");
                return(new MvxRootPresentationAttribute()
                {
                    WrapInNavigationController = true, ViewType = viewType, ViewModelType = viewModelType
                });
            }

            MvxTrace.Trace($"PresentationAttribute not found for {viewType.Name}. " +
                           $"Assuming animated Child presentation");
            return(new MvxChildPresentationAttribute()
            {
                ViewType = viewType, ViewModelType = viewModelType
            });
        }
        public override MvxBasePresentationAttribute CreatePresentationAttribute(Type viewModelType, Type viewType)
        {
            ValidateArguments(viewModelType, viewType);

            if (MasterNavigationController == null &&
                TabBarViewController?.CanShowChildView() != true)
            {
                MvxLog.Instance?.Trace(
                    $"PresentationAttribute nor MasterNavigationController found for {viewType.Name}. Assuming Root presentation");
                return(new MvxRootPresentationAttribute
                {
                    WrapInNavigationController = true, ViewType = viewType, ViewModelType = viewModelType
                });
            }

            MvxLog.Instance?.Trace(
                $"PresentationAttribute not found for {viewType.Name}. Assuming animated Child presentation");

            return(new MvxChildPresentationAttribute {
                ViewType = viewType, ViewModelType = viewModelType
            });
        }