Esempio n. 1
0
        ///<summary>
        ///Initializes the provider.
        ///</summary>
        ///
        ///<param name="config">A collection of the name/value pairs representing the provider-specific attributes specified in the configuration for this provider.</param>
        ///<param name="name">The friendly name of the provider.</param>
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            lock (_syncLock)
            {
                // obtain a source provider
                try
                {
                    ISettingsStore store = SettingsStore.Create();
                    _sourceProvider = new SettingsStoreSettingsProvider(store);
                }
                catch (NotSupportedException)
                {
                    Platform.Log(LogLevel.Warn, SR.LogConfigurationStoreNotFound);

                    // default to LocalFileSettingsProvider as a last resort
                    _sourceProvider = new ExtendedLocalFileSettingsProvider(new LocalFileSettingsProvider());
                }

                // init source provider
                // according to sample implementations, use the application name here
                _sourceProvider.Initialize(this.ApplicationName, config);
                base.Initialize(this.ApplicationName, config);
            }
        }