コード例 #1
0
 public void SetAttribute(string attributeName, string value)
 {
     // ENHANCE: Remove references to this
     if (_xmlElement == null)
     {
         _geckoElement.SetAttribute(attributeName, value);
     }
     else
     {
         _xmlElement.SetAttribute(attributeName, value);                 // This method will apply XML-encoding to {value}
     }
 }
コード例 #2
0
        private void GeckoWebBrowser_DomContextMenu(object sender, DomMouseEventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            if (e == null)
            {
                return;
            }
            if (e.Target == null)
            {
                return;
            }

            var element = e.Target.CastToGeckoElement();

            GeckoHtmlElement clicked = element as GeckoHtmlElement;

            if (clicked == null)
            {
                return;
            }
            //MessageBox.Show(clicked.TagName);
            e.Handled = true;
            e.PreventDefault();

            clicked.SetAttribute("style", "border: medium solid blue");
            Browser_ContextMenu_RightClk.Tag = clicked;
            Browser_ContextMenu_RightClk.Show(Cursor.Position);
            //MessageBox.Show("right clicked");
        }
コード例 #3
0
        public void ChangePicture(string bookFolderPath, GeckoHtmlElement img, PalasoImage imageInfo, IProgress progress)
        {
            var imageFileName = ProcessAndCopyImage(imageInfo, bookFolderPath);

            img.SetAttribute("src", imageFileName);
            UpdateMetdataAttributesOnImgElement(img, imageInfo);
        }
コード例 #4
0
 /// <summary>
 /// Sets the named attribute
 /// </summary>
 public void SetAttribute(string attributeName, string value)
 {
     if (_xmlElement == null)
     {
         _geckoElement.SetAttribute(attributeName, value);
     }
     else
     {
         _xmlElement.SetAttribute(attributeName, value);
     }
 }
コード例 #5
0
 /// <summary>
 /// Sets the named attribute to {value}
 /// </summary>
 public void SetAttribute(string attributeName, XmlString value)
 {
     if (_xmlElement == null)
     {
         _geckoElement.SetAttribute(attributeName, value.Unencoded);
     }
     else
     {
         _xmlElement.SetAttribute(attributeName, value.Unencoded);                       // This method will apply XML-encoding to its {value} parameter
     }
 }
コード例 #6
0
 private void geckoWebBrowser1_DomMouseOut(object sender, DomMouseEventArgs e)
 {
     try
     {
         if (this.elementStyles.ContainsKey(element))
         {
             string style = this.elementStyles[element];
             this.elementStyles.Remove(element);
             element.SetAttribute("style", style);
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #7
0
        private void btnDk_Click_1(object sender, EventArgs e)
        {
            web1.Navigate("http://seakbz.tk/giphy.gif");
            //  web1.Navigate("http://220.231.117.235/ListPoint/listpoint_Brc1.asp",GeckoLoadFlags.);

            GeckoHtmlElement CSS = web1.Document.GetElementsByTagName("TABLE")[0];

            CSS.SetAttribute("style", "background: red;");
            if (web1.Url.ToString() == "http://220.231.117.235/dkmh/error.asp")
            {
                txtUsename.Text = "15150136";
                txtPass.Text    = "25081995a7";
                web1.Navigate(URL_LOGIN);
                web1.DocumentCompleted += new EventHandler <Gecko.Events.GeckoDocumentCompletedEventArgs>(web_DienMatKhau);
            }
        }
コード例 #8
0
 private void geckoWebBrowser1_DomMouseOver(object sender, DomMouseEventArgs e)
 {
     try
     {
         element = (GeckoHtmlElement)geckoWebBrowser1.Document.ElementFromPoint(e.ClientX, e.ClientY);
         if (!this.elementStyles.ContainsKey(element))
         {
             string style = element.Style.CssText;
             elementStyles.Add(element, style);
             element.SetAttribute("style", style + ";border-style: solid;border-color: #FF0000;");
             richTextBox1.Text = element.TextContent.Trim();
             richTextBox2.Text = element.TagName.Trim();
             richTextBox3.Text = element.OuterHtml.Trim();
         }
     }
     catch (Exception ex)
     {
     }
 }
コード例 #9
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]);
            //    });
            //}
        }
コード例 #10
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.登录界面)
            {
            }
        }