/// <summary>
        /// Create the configuration loader
        /// </summary>
        /// <param name="machineNameFinder">abstracts out the accessing of what the machine name is</param>
        /// <param name="appSettings">abstacts out the process of accessing app settings</param>
        /// <param name="globalSettingsName">the name of the section within the configSectionName that will act as the base global settings.  This is defaulted to global</param>
        /// <param name="overrideType">The type of override wanted.  By default it will use chaining, which will try to find first valid type. Env - Appsetting - Machine name.</param>
        public ConfigurationLoader(IMachineNameFinder machineNameFinder, IAppSettingsLoader appSettings, string globalSettingsName = "global", OverrideType overrideType = OverrideType.Chain)
        {
            _config       = new Config();
            _overrideType = overrideType;

            if (!_config.SectionNames.Contains(globalSettingsName))
            {
                throw new ArgumentOutOfRangeException("globalSettingsName", "No global section found");
            }

            _globalSection     = _config.GetSection(globalSettingsName);
            _machineNameFinder = machineNameFinder;
            _appSettings       = appSettings;
        }
Esempio n. 2
0
 public WalmartApiHandler(IAppSettingsLoader appSettingsLoader)
 {
     appSettings = appSettingsLoader.GetSettings();
 }
 public CachedAppSettingsLoader(
     CachedAppSettingsLoaderSettings settings, IAppSettingsLoader decoratee)
 {
        public void InitWithProfiles(
			IEnumerable<Profile> profiles,
			IServiceLocator services,
			AppSettings settings,
			IProfileLoader profileLoader,
			IAppSettingsLoader appSettingsLoader,
			Action complete)
        {
            _services = services;
            _appSettings = settings;
            _profileLoader = profileLoader;
            _appSettingsLoader = appSettingsLoader;
            _complete = complete;

            Profiles.Content.As<NSMutableArray>().RemoveAllObjects();

            int idx = -1;
            profiles.Apply((p, i) => {
                if(string.Equals(settings.Profile, p.Name)){
                    idx = i;
                }
                Profiles.AddObject(ProfileInfo.For(p));
            });

            Profiles.SelectionIndex = idx;
        }