public RegexLib.Services.RegexResult Submit(RegexLib.Services.PatternInfo info)
        {
            try
            {
                ShowStatus("Getting ready to submit...");
                RegexLib.Services.Webservices ws = new RegexLib.Services.Webservices();
                ws.Proxy= ProxyFactory.Create( AppContext.Instance.Settings.ProxySettings,ws.Url);

                //Apply user authorication settings if exist in settings
                //the ticket allows us to update patterns as well
                if(info.UserInfo.Ticket==null ||
                    info.UserInfo.Ticket=="")
                {
                    if(UserDetailsInfo!=null &&
                        UserDetailsInfo.Ticket!="")
                    {
                        info.UserInfo= UserDetailsInfo;
                    }
                }

                ShowStatus("Submitting...");

                RegexLib.Services.RegexResult result = ws.Save(info);

                ShowStatus(result.Message);
                if(result.Status==RegexLib.Services.RegexActionStatus.Inserted )
                {
                    //we have gotten a ticket!
                    UserDetailsInfo= result.PatternInformation.UserInfo;
                    ShowStatus("Your expression was posted successfully!");
                }
                if(result.Status==RegexLib.Services.RegexActionStatus.Updated)
                {
                    //we have gotten a ticket!
                    UserDetailsInfo= result.PatternInformation.UserInfo;
                    ShowStatus("Your expression was updated successfully!");
                }

                RaiseFinishedEvent(result);
                return result;
            }
            catch(Exception e)
            {
                RaiseFinishedEvent(null);
                throw new Exception("There was a problem submitting to Regexlib.com\n" + e.Message,e);
            }
        }
Ejemplo n.º 2
0
 private void LoadSettings()
 {
     txtEmail.Text="";
     txtFirstName.Text="";
     txtLastName.Text="";
     m_RegexlibInfo = new UserInfo();
     RegexLibSettings settings= RegexLibSettings.Load();
     if(settings!=null)
     {
         m_RegexlibInfo= settings.userInfo;
     }
 }
 public RegexLibSettings(UserInfo info)
 {
     this.userInfo=info;
 }