예제 #1
0
        private void SearchWebAsync()
        {
            //Start the invokation and pass in a callback delegate
            //to be called in finish
            ShowSearchStatus("Querying service...");


            RegexLib.Services.Webservices searcher = new RegexLib.Services.Webservices();
            IAsyncResult result = searcher.BeginlistRegExp(txtSearch.Text, "", -1, 50, new AsyncCallback(OnSearchFinish), searcher);
        }
예제 #2
0
        private void OnSearchFinish(IAsyncResult result)
        {
            //recieve the searcher that we passed in as state
            //in SearchWebAsync
            RegexLib.Services.Webservices searcher = (RegexLib.Services.Webservices)result.AsyncState;
            //retrieve the result of the invocation
            DataSet ds = searcher.EndlistRegExp(result);

            BindGrid(ds);
            ShowSearchStatus("");
        }
예제 #3
0
        private Webservices CreateWebService()
        {
            Webservices searcher = new RegexLib.Services.Webservices();

            System.Net.WebProxy myProxy = ProxyFactory.Create(AppContext.Instance.Settings.ProxySettings, searcher.Url);
            if (myProxy != null)
            {
                searcher.Proxy = myProxy;
            }

            return(searcher);
        }
예제 #4
0
        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);
            }
        }
        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);
            }
        }
예제 #6
0
        private void SearchWeb()
        {
            try
            {
                ShowSearchStatus("Querying service...");

                RegexLib.Services.Webservices searcher = CreateWebService();


                DataSet ds = searcher.listRegExp(txtSearch.Text, "", -1, 50);

                ShowSearchStatus("Filling results...");
                BindGrid(ds);
                ShowSearchStatus("");
            }
            catch (Exception e)
            {
                ShowSearchStatus(e.Message);
            }
        }