示例#1
0
        private void EnableAdvancedSearch()
        {
            Stopwatch timer   = new Stopwatch();
            int       timeout = 30;

            timer.Start();

            GeckoHtmlElement advancedSearch = null;

            while (timer.Elapsed.TotalSeconds < timeout && advancedSearch == null)
            {
                advancedSearch = Browser.Document.GetHtmlElementById("advancedSearch");

                if (advancedSearch != null)
                {
                    advancedSearch.Click();
                    for (int i = 0; i < 100; i++)
                    {
                        Application.DoEvents();
                    }
                    SearchNext();
                    break;
                }

                Application.DoEvents();
            }
        }
示例#2
0
        private void NavigateToSearch()
        {
            Stopwatch timer   = new Stopwatch();
            int       timeout = 30;

            timer.Start();

            GeckoHtmlElement search = null;

            while (timer.Elapsed.TotalSeconds < timeout && search == null)
            {
                var elements = Browser.Document.GetElementsByClassName("searchpeople");
                if (elements.Count() > 0)
                {
                    search = (GeckoHtmlElement)elements[0];
                }

                if (search != null)
                {
                    search.Click();
                    this.CurrentAction = EnableAdvancedSearch;
                    break;
                }

                Application.DoEvents();
            }
        }
示例#3
0
        public void bet()
        {
            int bet = 0;

            if (betStreak == 0)
            {
                bet = (int)startAmountNumeric.Value;
            }
            else
            {
                bet = previousBet * 2;
            }

            betStreak++;
            previousBet          = bet;
            textboxElement.Value = bet.ToString();

            if (colourCombo.Text == "red")
            {
                redButton.Click();
            }
            else
            {
                blackButton.Click();
            }
        }
示例#4
0
        private void SearchNext()
        {
            if (queuedSearches.Count == 0)
            {
                ExportToExcel();
                MessageBox.Show("Search Completed! Data Exported to Selected Location.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                currentSearch++;
                UpdateSearchStatus();

                string strKeyword = queuedSearches[0].Split(':')[0];
                string strCountry = queuedSearches[0].Split(':')[1];

                if (!string.IsNullOrEmpty(strKeyword) && !string.IsNullOrEmpty(strCountry))
                {
                    Log.Information("Searching for Keyword '{0}' in Country '{1}'", strKeyword, strCountry);

                    lbl_Search_Keyword.Text = strKeyword;
                    lbl_Search_Country.Text = strCountry;
                    currentCountry          = strCountry;

                    GeckoInputElement keyword = (GeckoInputElement)Browser.Document.GetElementById("memberKeywords");
                    GeckoHtmlElement  country = (GeckoHtmlElement)Browser.Document.GetElementById("memberIdCountry");
                    GeckoHtmlElement  submit  = (GeckoHtmlElement)Browser.Document.GetElementById("searchConnections");

                    keyword.Click();
                    keyword.Focus();
                    keyword.Value = strKeyword;

                    this.Focus();
                    Browser.Focus();
                    country.Focus();
                    SendKeys.SendWait(strCountry);

                    submit.Focus();
                    submit.Click();
                }

                queuedSearches.RemoveAt(0);
            }
        }
示例#5
0
        //bool czyKolejneZaladowanieJestAdfly = true;
        private void GeckoWebBrowser1_DocumentCompleted(object sender, Gecko.Events.GeckoDocumentCompletedEventArgs e)
        {
            //if (czyKolejneZaladowanieJestAdfly)
            //{

            new Thread(() =>
            {
                GeckoHtmlElement button = null;
                bool czyOk       = true;
                Stopwatch stoper = new Stopwatch();
                stoper.Start();
                do
                {
                    invoukuj(() => { button = geckoWebBrowser1.Document.GetHtmlElementById("skip_button"); });
                    if (button == null || stoper.ElapsedMilliseconds > czasOczekiwania)
                    {
                        czyOk = false;
                        break;
                    }
                    Thread.Sleep(300);
                } while (invoukuj <bool>(() => { return(!button.HasAttribute("href")); }));
                stoper.Stop();

                if (czyOk)
                {
                    invoukuj(() =>
                    {
                        button.SetAttribute("href", LinksList[idLink]);
                        button.Click();

                        Clicked++;
                        Log("Button clicked");
                        if (loop == 0 && idLink == 0)
                        {
                            GoodProxyTextBox.Text += ProxyList[idProxy].Address.Host + ":" + ProxyList[idProxy].Address.Port + Environment.NewLine;
                        }
                    });
                    Thread.Sleep(2000);  // na wszelki wypadek niech sie wszyskto poprzesyla przed zmiana proxy
                    invoukuj(() =>
                    {
                        idProxy++;
                    });
                }
                else
                {
                    invoukuj(() =>
                    {
                        Log(string.Format("Proxy {0}:{1} bad load page", ProxyList[idProxy].Address.Host, ProxyList[idProxy].Address.Port));
                        if (loop == 0 && idLink == 0)
                        {
                            errorsProxy++;
                            ProxyDeletedTextBox.Text += ProxyList[idProxy].Address.Host + ":" + ProxyList[idProxy].Address.Port + Environment.NewLine;
                        }
                        ProxyList.RemoveAt(idProxy);
                        idProxy = idProxy;  // usunieto proxy wiec nie dodaje ale ma zmienic ustawienia
                        geckoWebBrowser1.Navigate(LinksList[idLink]);
                    });
                }
            }).Start();
            //}
            //else
            //{
            //    this.invoukuj(() =>
            //    {
            //        czyKolejneZaladowanieJestAdfly = true;
            //        idProxy++;
            //        geckoWebBrowser1.Navigate(LinksList[idLink]);
            //    });
            //}
        }
示例#6
0
        void Browser_DocumentCompleted_Init(object sender, EventArgs e)
        {
            GeckoWebBrowser br = sender as GeckoWebBrowser;

            if (br.Url.ToString() == "about:blank")
            {
                return;
            }


            GmyDoc = sender as GeckoWebBrowser;

            if (GmyDoc.Url.ToString().IndexOf("http://webapp.hj8828.com/login.html") >= 0 && isrun == ProcessStatus.初始化)
            {
                GeckoElement           userName  = null;
                GeckoHtmlElement       submit    = null;
                GeckoElementCollection userNames = GmyDoc.Document.GetElementsByTagName("input");
                foreach (GeckoHtmlElement item in userNames)
                {
                    if (item.GetAttribute("value") == "default")
                    {
                        submit = item;
                    }
                }
                //myBrowser.Document.GetHtmlElementById("vcodeA").Click();
                submit.Click();

                isrun = ProcessStatus.结束页面;
            }
            if (isrun == ProcessStatus.结束页面)
            {
                GeckoHtmlElement       namevalue  = null;
                GeckoHtmlElement       password   = null;
                GeckoHtmlElement       submit     = null;
                GeckoElementCollection userNames  = GmyDoc.Document.GetElementsByTagName("input");
                GeckoElementCollection userNames1 = GmyDoc.Document.GetElementsByTagName("a");

                foreach (GeckoHtmlElement item in userNames)
                {
                    if (item.GetAttribute("id") == "username")
                    {
                        namevalue = item;
                    }
                    if (item.GetAttribute("id") == "password")
                    {
                        password = item;
                    }
                }
                foreach (GeckoHtmlElement item in userNames1)
                {
                    if (item.GetAttribute("id") == "ensure")
                    {
                        submit = item;
                    }
                }
                namevalue.SetAttribute("Value", "w7830");
                password.SetAttribute("Value", "123456");

                submit.Click();


                isrun = ProcessStatus.登录界面;
            }
            else if (isrun == ProcessStatus.登录界面)
            {
            }
        }
        public void UpdateMetdataAttributesOnImgElement(GeckoHtmlElement img, PalasoImage imageInfo)
        {
            UpdateMetadataAttributesOnImage(img, imageInfo);

            img.Click();             //wake up javascript to update overlays
        }