Beispiel #1
0
 private void Start_AutoConfig(object obj)
 {
     try
     {
         _abortRequest = false;
         string[] args = obj as string[];
         HandleResponse(IspDbHandler.GetAutoconfig(args[0], RequestType.Standard), args);
     }
     catch (System.Threading.ThreadAbortException ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
        private void AutoConfig_Search_Thread(object obj)
        {
            try
            {
                RequestType requestType = ConfigHelper.ParseEnumString <RequestType>(obj as string);

                MechanismResponse response = IspDbHandler.GetAutoconfig(_emailAddress, requestType);

                if (response.IsGuess)
                {
                    //Excludes servers that fail and determines socket type for Plain/TLS ports
                    EmailProvider provider = response.ClientConfig.EmailProvider;
                    AutoconfigurationHelper.TestAllEmailServers(provider, 5000);

                    if (provider.IncomingServers.Count == 0 ||
                        provider.OutgoingServers.Count == 0)
                    {
                        response = new MechanismResponse()
                        {
                            ResponseType = MechanismResponseType.NotFound
                        };
                    }
                }

                this.Invoke(
                    new CallBackEvent(CallBackMechanismResponse),
                    this,
                    response,
                    new Action <MechanismResponse>(resp =>
                {
                    if (resp != null && resp.IsSuccess)
                    {
                        _mechanismSuccess = resp;
                        contentPage2.Success();
                    }
                    else
                    {
                        contentPage2.Failed();
                    }
                    cmdNext.Enabled = true;
                    cmdNext.Focus();
                }));
            }
            catch
            { }
        }