Пример #1
0
 protected XamarinFormsBootstrapperBase(IPlatformService platformService, bool isDesignMode = false)
     : this(isDesignMode, platformService?.GetPlatformInfo())
 {
     Should.NotBeNull(platformService, nameof(platformService));
     _platformService     = platformService;
     WrapToNavigationPage = true;
 }
Пример #2
0
 protected XamarinFormsBootstrapperBase(IPlatformService platformService)
 {
     Should.NotBeNull(platformService, nameof(platformService));
     _platformService = platformService;
     _platform        = platformService.GetPlatformInfo();
     BindingServiceProvider.ValueConverter = platformService.ValueConverter;
 }
Пример #3
0
        private static PlatformInfo GetPlatformInfo()
        {
            Assembly assembly = TryLoadAssembly(BindingAssemblyName, null);

            if (assembly == null)
            {
                if (Device.OS == TargetPlatform.WinPhone)
                {
                    assembly = TryLoadAssembly(WinRTAssemblyName, null);
                }
                if (assembly == null)
                {
                    return(XamarinFormsExtensions.GetPlatformInfo());
                }
            }
            TypeInfo serviceType = typeof(IPlatformService).GetTypeInfo();

            serviceType = assembly.DefinedTypes.FirstOrDefault(serviceType.IsAssignableFrom);
            if (serviceType != null)
            {
                _platformService = (IPlatformService)Activator.CreateInstance(serviceType.AsType());

                BindingServiceProvider.ValueConverter = _platformService.ValueConverter;
            }
            return(_platformService == null
                ? XamarinFormsExtensions.GetPlatformInfo()
                : _platformService.GetPlatformInfo());
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="XamarinFormsBootstrapperBase" /> class.
        /// </summary>
        protected XamarinFormsBootstrapperBase()
        {
            var assembly = TryLoadAssembly(BindingAssemblyName, null);

            if (assembly != null)
            {
                var serviceType = typeof(IPlatformService).GetTypeInfo();
                serviceType = assembly.DefinedTypes.FirstOrDefault(serviceType.IsAssignableFrom);
                if (serviceType != null)
                {
                    _platformService = (IPlatformService)Activator.CreateInstance(serviceType.AsType());
                }
            }
            _platform = _platformService == null
                ? XamarinFormsExtensions.GetPlatformInfo()
                : _platformService.GetPlatformInfo();
        }
Пример #5
0
 protected XamarinFormsBootstrapperBase(IPlatformService platformService, bool isDesignMode = false)
     : this(isDesignMode, platformService?.GetPlatformInfo())
 {
     _platformService     = platformService;
     WrapToNavigationPage = true;
 }