コード例 #1
0
 public MvxFragmentPresentationAttribute(
     Type?activityHostViewModelType = null,
     int fragmentContentId          = global::Android.Resource.Id.Content,
     bool addToBackStack            = false,
     int enterAnimation             = int.MinValue,
     int exitAnimation         = int.MinValue,
     int popEnterAnimation     = int.MinValue,
     int popExitAnimation      = int.MinValue,
     int transitionStyle       = int.MinValue,
     Type?fragmentHostViewType = null,
     bool isCacheableFragment  = false,
     string?tag = null,
     string popBackStackImmediateName          = "",
     MvxPopBackStack popBackStackImmediateFlag = MvxPopBackStack.Inclusive
     )
 {
     ActivityHostViewModelType = activityHostViewModelType;
     FragmentContentId         = fragmentContentId;
     AddToBackStack            = addToBackStack;
     EnterAnimation            = enterAnimation;
     ExitAnimation             = exitAnimation;
     PopEnterAnimation         = popEnterAnimation;
     PopExitAnimation          = popExitAnimation;
     TransitionStyle           = transitionStyle;
     FragmentHostViewType      = fragmentHostViewType;
     IsCacheableFragment       = isCacheableFragment;
     Tag = tag;
     PopBackStackImmediateName = popBackStackImmediateName;
     PopBackStackImmediateFlag = popBackStackImmediateFlag;
 }
コード例 #2
0
        public MvxFragmentPresentationAttribute(
            Type?activityHostViewModelType     = null,
            string?fragmentContentResourceName = null,
            bool addToBackStack       = false,
            string?enterAnimation     = null,
            string?exitAnimation      = null,
            string?popEnterAnimation  = null,
            string?popExitAnimation   = null,
            string?transitionStyle    = null,
            Type?fragmentHostViewType = null,
            bool isCacheableFragment  = false,
            string?tag = null,
            string popBackStackImmediateName          = "",
            MvxPopBackStack popBackStackImmediateFlag = MvxPopBackStack.Inclusive
            )
        {
            var context = Mvx.IoCProvider.Resolve <IMvxAndroidGlobals>().ApplicationContext;

            ActivityHostViewModelType = activityHostViewModelType;
            FragmentContentId         = !string.IsNullOrEmpty(fragmentContentResourceName) ? context.Resources.GetIdentifier(fragmentContentResourceName, "id", context.PackageName) : global::Android.Resource.Id.Content;
            AddToBackStack            = addToBackStack;
            EnterAnimation            = !string.IsNullOrEmpty(enterAnimation) ? context.Resources.GetIdentifier(enterAnimation, "animation", context.PackageName) : int.MinValue;
            ExitAnimation             = !string.IsNullOrEmpty(exitAnimation) ? context.Resources.GetIdentifier(exitAnimation, "animation", context.PackageName) : int.MinValue;
            PopEnterAnimation         = !string.IsNullOrEmpty(popEnterAnimation) ? context.Resources.GetIdentifier(popEnterAnimation, "animation", context.PackageName) : int.MinValue;
            PopExitAnimation          = !string.IsNullOrEmpty(popExitAnimation) ? context.Resources.GetIdentifier(popExitAnimation, "animation", context.PackageName) : int.MinValue;
            TransitionStyle           = !string.IsNullOrEmpty(transitionStyle) ? context.Resources.GetIdentifier(transitionStyle, "style", context.PackageName) : int.MinValue;
            FragmentHostViewType      = fragmentHostViewType;
            IsCacheableFragment       = isCacheableFragment;
            Tag = tag;
            PopBackStackImmediateName = popBackStackImmediateName;
            PopBackStackImmediateFlag = popBackStackImmediateFlag;
        }
コード例 #3
0
        public static PopBackStackFlags ToNativePopBackStackFlags(this MvxPopBackStack mvxPopBackStack)
        {
            switch (mvxPopBackStack)
            {
            case MvxPopBackStack.None:
                return(PopBackStackFlags.None);

            case MvxPopBackStack.Inclusive:
                return(PopBackStackFlags.Inclusive);

            default:
                throw new ArgumentOutOfRangeException(nameof(mvxPopBackStack), mvxPopBackStack, $"No matching {nameof(PopBackStackFlags)} enum is defined");
            }
        }