Ejemplo n.º 1
0
        /// <summary>
        /// The load providers.
        /// </summary>
        /// <exception cref="ProviderException">
        /// </exception>
        private static void LoadProviders()
        {
            if (_provider == null)
            {
                lock (Lock)
                {
                    var section = AppConfig.Instance.Photos;

                    _providers = new PhotoProviderCollection();
                    ProvidersHelper.InstantiateProviders(section.Providers, _providers, typeof(PhotoProvider));
                    _provider = _providers[section.DefaultProvider];

                    _photoResize = new Dictionary <string, PhotoResize>();

                    foreach (PhotoResizeElement photoResize in section.PhotoResizes)
                    {
                        _photoResize.Add(photoResize.Name, new PhotoResize(photoResize));
                    }

                    if (_provider == null)
                    {
                        throw new ProviderException("Unable to load default FileSystemProvider");
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The load providers.
        /// </summary>
        /// <exception cref="ProviderException">
        /// </exception>
        private static void LoadProviders()
        {
            if (_provider == null)
            {
                lock (Lock)
                {
                    var section = AppConfig.Instance.Photos;

                    _providers = new PhotoProviderCollection();
                    ProvidersHelper.InstantiateProviders(section.Providers, _providers, typeof(PhotoProvider));
                    _provider = _providers[section.DefaultProvider];

                    _photoResize = new Dictionary<string, PhotoResize>();

                    foreach (PhotoResizeElement photoResize in section.PhotoResizes)
                    {
                        _photoResize.Add(photoResize.Name, new PhotoResize(photoResize));
                    }

                    if (_provider == null)
                    {
                        throw new ProviderException("Unable to load default FileSystemProvider");
                    }
                }
            }
        }