Example #1
0
        //***************************************************************************
        // Private Methods
        //
        private static void Initialize()
        {
            CalendarProviderConfiguration config =
                (CalendarProviderConfiguration)ConfigurationManager.GetSection("CalendarProvider");

            if (config == null)
            {
                throw new ConfigurationErrorsException("Calendar provider configuration section is not set correctly.");
            }

            _providers = new CalendarProviderCollection();

            System.Web.Configuration.ProvidersHelper.InstantiateProviders(config.Providers, _providers, typeof(CalendarProvider));

            _providers.SetReadOnly();

            _defaultProvider = _providers[config.Default];

            if (_defaultProvider == null)
            {
                throw new ProviderException("No default provider sepecified.");
            }
        }
        //***************************************************************************
        // Private Methods
        // 
        private static void Initialize()
        {
            CalendarProviderConfiguration config =
                (CalendarProviderConfiguration)ConfigurationManager.GetSection("CalendarProvider");

            if (config == null)
                throw new ConfigurationErrorsException("Calendar provider configuration section is not set correctly.");

            _providers = new CalendarProviderCollection();

            System.Web.Configuration.ProvidersHelper.InstantiateProviders(config.Providers, _providers, typeof(CalendarProvider));

            _providers.SetReadOnly();

            _defaultProvider = _providers[config.Default];

            if (_defaultProvider == null)
                throw new ProviderException("No default provider sepecified.");
        }
        //***************************************************************************
        // Protected Methods
        // 
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (!string.IsNullOrEmpty(this._providerName))
                this._provider = CalendarProviderManager.Providers[this._providerName];
            else
                this._provider = CalendarProviderManager.Provider;

            if (this._provider == null)
                throw new Exception("Specified calendar provider name not found or no default calendar provider set.");
        }