Exemplo n.º 1
0
        private static void Initialize()
        {
            //try
            //{
                CaptchaConfiguration config = CaptchaConfiguration.GetConfig();

                if (
                    (config.DefaultProvider == null)
                    || (config.Providers == null)
                    || (config.Providers.Count < 1)
                    )
                {
                    throw new ProviderException("You must specify a valid default provider.");
                }

                providerCollection = new CaptchaProviderCollection();

                ProvidersHelper.InstantiateProviders(
                    config.Providers,
                    providerCollection,
                    typeof(CaptchaProvider));

                providerCollection.SetReadOnly();
                defaultProvider = providerCollection[config.DefaultProvider];

            //}
            //catch (Exception ex)
            //{
            //    initializationException = ex;
            //    isInitialized = true;
            //    throw ex;
            //}

            //isInitialized = true;
        }
 public void CopyTo(CaptchaProvider[] array, int index)
 {
     base.CopyTo(array, index);
 }
Exemplo n.º 3
0
        protected override void OnInit(EventArgs e)
        {
            if (this.Site != null && this.Site.DesignMode)
            {

            }
            else
            {
                base.OnInit(e);
                // an exception always happens here in design mode
                // this try is just to fix the display in design view in VS

                    try
                    {
                        captchProvider = CaptchaManager.Providers[providerName];
                        captcha = captchProvider.GetCaptcha();
                        this.Controls.Add(captcha.GetControl());
                    }
                    catch { }

            }
        }