Esempio n. 1
0
        /// <summary>
        /// Registers services that need not be recreated
        /// when preferences change.
        /// </summary>
        private void RegisterIndependentServices()
        {
            Bind <ApiUrl>(_ => new ApiUrl(Preferences.ServerUrl));

            Singleton <SessionIdRepository>(_ => new SessionIdRepository());
            Singleton <DeviceIdRepository>(_ => new DeviceIdRepository());

            Bind <ArangoRepository>(_ => ArangoRepository.GetInstance());

            Bind <FacetCaller>(_ => {
                if (Preferences.AlwaysEmulate)
                {
                    return(Resolve <EmulatedFacetCaller>());
                }

                return(Resolve <UnisaveFacetCaller>());
            });

            Singleton <EmulatedFacetCaller>(_ => new EmulatedFacetCaller(this));

            Singleton <UnisaveFacetCaller>(_ => new UnisaveFacetCaller(this));
        }