Ejemplo n.º 1
0
 void DictWizard_Previous(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     if (this.Previous != null)
     {
         this.Previous(sender, new EventArgs());
     }
 }
Ejemplo n.º 2
0
        private void OnLeftButtonUp(object sender,
                                    System.Windows.Forms.HtmlElementEventArgs arg)
        {
            System.Windows.Forms.HtmlDocument doc     = (System.Windows.Forms.HtmlDocument)sender;
            System.Windows.Forms.HtmlElement  element = doc.GetElementFromPoint(arg.MousePosition);

            HtmlScreenElementBase button = FindButtonInHtml(element);

            if (null == button)
            {
                System.Windows.Forms.HtmlElement parentElement = element.Parent;
                if (null == parentElement)
                {
                    return;
                }

                button = FindButtonInHtml(parentElement);
                if (null == button)
                {
                    return;
                }
            }

            button.OnLeftMouseUp(sender, arg);
            arg.ReturnValue = true;
        }
Ejemplo n.º 3
0
        private void document_MouseOver(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = e.ToElement;


            string dozmiany = element.OuterHtml;

            //textEditor1.Text = "ttttttttttttt" + dozmiany;


            if (!this.elementStyles.ContainsKey(element))
            {
                string style = element.Style;
                this.elementStyles.Add(element, style);
                //element.SetAttribute("data-tooltip", "tooooltip");

                //element.Style = style + "background-color: #ffc;border: 2px dotted #000000;background-clip:border-box";   // border - color: coral;  border-style: solid;
                // element.Style = style + ";data-tooltip=\"Custom tooltip text.\";";                                                            // element.Style = style + "; padding: 15px;";
                // data-tooltip="Custom tooltip text."


                if (element.GetAttribute("className") != "")
                {
                    element.Style = style + "background-color: rgba(30, 163, 97, 0.25);border: 2px dotted #000000;background-clip:border-box";
                }
                else
                {
                    element.Style = style + "background-color: rgba(255, 2, 2, 0.25);border: 2px dotted #000000;background-clip:border-box";
                }
            }


            //string ffff = wartosc.XPath;
        }
Ejemplo n.º 4
0
 void DictWizard_Next(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     if (this.Next != null)
     {
         this.Next(sender, new EventArgs());
     }
 }
Ejemplo n.º 5
0
        private void OnClicked(object sender,
                               System.Windows.Forms.HtmlElementEventArgs arg)
        {
            //
            //System.Windows.Forms.HtmlDocument doc = (System.Windows.Forms.HtmlDocument)sender;
            //System.Windows.Forms.HtmlElement element = doc.GetElementFromPoint(arg.MousePosition);
            //System.Windows.Forms.HtmlElement buttonElement = m_listButtons.Find( btn => btn == element );
            //if ( null == buttonElement )
            //{
            //    System.Windows.Forms.HtmlElement parentElement = element.Parent;
            //    if ( null == parentElement )
            //    {
            //        return;
            //    }

            //    buttonElement = m_listButtons.Find( btn => btn == parentElement );
            //    if ( null == buttonElement )
            //    {
            //        return;
            //    }
            //}

            //string tagValue = buttonElement.GetAttribute(s_tagAttri);
            //string tagID = buttonElement.Id;

            //m_app.OnButtonClickInHtml(tagID, tagValue);

            //arg.ReturnValue = true;
        }
Ejemplo n.º 6
0
        void OK_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            string licensePlant = GetElementById("carNO").GetAttribute("value");
            string carID        = GetElementById("carID").GetAttribute("value");
            string typeValue    = GetElementById("carType").GetAttribute("value");
            string licenseNo    = GetElementById("licenseNo").GetAttribute("value");
            string errmessage   = "";

            if (string.IsNullOrEmpty(licensePlant))
            {
                errmessage += "/车牌号不能为空";
            }
            if (string.IsNullOrEmpty(carID))
            {
                errmessage += "/车架号不能为空";
            }
            if (string.IsNullOrEmpty(licenseNo))
            {
                errmessage += "/驾驶证号不能为空";
            }
            if (!string.IsNullOrEmpty(errmessage))
            {
                GetElementById("ErrMsg").InnerText = errmessage.Substring(1) + "!";
                return;
            }

            _entity.LicensePlant = GetElementById("license").InnerText + licensePlant;
            _entity.CarId        = carID;
            _entity.CarType      = typeValue;
            _entity.LicenseNo    = licenseNo;
            StartActivity("雅安交警认罚正在查询");
        }
Ejemplo n.º 7
0
 private void Document_ContextMenuShowing(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     e.ReturnValue = false;
     if (this.ContextMenu != null)
     {
         this.ContextMenu.IsOpen = true;
     }
 }
Ejemplo n.º 8
0
 private void Ok_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     _carEntity.TicketId = GetElementById("InputText").GetAttribute("value");
     if (string.IsNullOrEmpty(_carEntity.TicketId))
     {
         GetElementById("ErrMsg").InnerText = "车票ID不能为空!";
     }
 }
Ejemplo n.º 9
0
 private void WbThumbs_DblClick(object sender, HtmlElementEventArgs e) {
   var thumb = WbThumbs.Document?.GetElementFromPoint(e.ClientMousePosition)?.Parent;
   if (thumb == null) return;
   if (thumb.Id == "content" || thumb.Id == null) return;
   ACore.MediaItems.DeselectAll();
   ACore.MediaItems.Current = ACore.MediaItems.Items[int.Parse(thumb.Id)];
   ACore.MediaItems.Current.IsSelected = true;
   ShowFullPicture();
 }
Ejemplo n.º 10
0
 void btnSelectFolder_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     using (System.Windows.Forms.OpenFileDialog fd = new System.Windows.Forms.OpenFileDialog())
     {
         fd.Filter = "DLL自带XML文件.xml|*.xml";
         if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             web.Document.GetElementById("txt_path").SetAttribute("value", fd.FileName);
         }
     }
 }
Ejemplo n.º 11
0
        private void document_MouseLeave(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = e.FromElement;

            if (this.elementStyles.ContainsKey(element))
            {
                string style = this.elementStyles[element];
                this.elementStyles.Remove(element);
                element.Style = style;
            }
        }
Ejemplo n.º 12
0
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = this.web.Document.GetElementFromPoint(e.ClientMousePosition);
            //string right_button_capture = element.GetAttribute("id");
            //selenium_id= htmlDocument2.body.document.document.getElementById("username");
            selenium_id      = element.GetAttribute("id").Trim();
            selenium_name    = element.GetAttribute("name").Trim();
            selenium_tagName = element.TagName.ToString();

            //MessageBox.Show("tag name=" + selenium_tagName + " name=" + selenium_name + " id=" + selenium_id);

            if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
            {
                //MessageBox.Show(right_button_capture);
            }
        }
Ejemplo n.º 13
0
        void Callback_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            string action = this.web.Document.GetElementById("callback").GetAttribute("action");

            if (action == "validate")
            {
                int rowId = this.index;
                if (rowId > 0)
                {
                    o2Mate.Array  outputTab    = this.outputDict.GetArray(this.keyTab) as o2Mate.Array;
                    o2Mate.Fields outputFields = outputTab.Item(rowId) as o2Mate.Fields;
                    foreach (KeyValuePair <string, string> kv in this.keys)
                    {
                        string value = this.web.Document.GetElementById(kv.Key).GetAttribute("value");
                        outputFields.AddString(kv.Value, value);
                    }
                }
                else
                {
                    o2Mate.Array  outputTab    = this.outputDict.GetArray(this.keyTab) as o2Mate.Array;
                    o2Mate.Fields outputFields = new o2Mate.Fields();
                    foreach (KeyValuePair <string, string> kv in this.keys)
                    {
                        string value = this.web.Document.GetElementById(kv.Key).GetAttribute("value");
                        outputFields.AddString(kv.Value, value);
                    }
                    outputTab.Add(outputFields);
                }
                this.Return_Click(sender, e);
            }
            else if (action == "add")
            {
                string           arrayRef = this.web.Document.GetElementById("callback").GetAttribute("reference");
                DictSaisieChamps dsc      = new DictSaisieChamps(this, null, null, this.web, this.inputDict, this.outputDict, this.fileNameSrc, arrayRef, 0);
                dsc.Load();
                dsc.Navigate();
            }
            else if (action == "edit")
            {
                string arrayRef = this.web.Document.GetElementById("callback").GetAttribute("reference");
                int    indexRef = 0;
                Int32.TryParse(this.web.Document.GetElementById("callback").GetAttribute("index"), out indexRef);
                DictSaisieChamps dsc = new DictSaisieChamps(this, null, null, this.web, this.inputDict, this.outputDict, this.fileNameSrc, arrayRef, indexRef);
                dsc.Load();
                dsc.Navigate();
            }
        }
Ejemplo n.º 14
0
        private void OnLeftButtonDown(object sender,
                                      System.Windows.Forms.HtmlElementEventArgs arg)
        {
            System.Windows.Forms.HtmlDocument doc     = (System.Windows.Forms.HtmlDocument)sender;
            System.Windows.Forms.HtmlElement  element = doc.GetElementFromPoint(arg.MousePosition);

            HtmlScreenElementBase newFcsElement = FindFocusElement(element);

            if (null != newFcsElement)
            {
                if (m_focusElement != newFcsElement)
                {
                    m_focusElement = newFcsElement;
                    //  ShowHandleInput(true);
                }
                m_focusElement.SetFocus();
            }
            else
            {
                ShowScreenKeyboard(false);
                m_focusElement = null;
                // ShowHandleInput(false);
            }

            HtmlScreenElementBase button = FindButtonInHtml(element);

            if (null == button)
            {
                System.Windows.Forms.HtmlElement parentElement = element.Parent;
                if (null == parentElement)
                {
                    return;
                }

                button = FindButtonInHtml(parentElement);
                if (null == button)
                {
                    return;
                }
            }

            button.OnLeftMouseDown(sender, arg);
            arg.ReturnValue = true;
        }
Ejemplo n.º 15
0
    private void WbThumbs_KeyDown(object sender, HtmlElementEventArgs e) {
      if (e.KeyPressedCode == 46) {//Delete 
        var result = MessageBox.Show("Are you sure?", "Delete Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
        if (result == MessageBoxResult.Yes)
          if (ACore.FileOperation(FileOperations.Delete, !e.ShiftKeyPressed))
            ACore.MediaItems.RemoveSelectedFromWeb();
      }

      if (e.CtrlKeyPressed && e.KeyPressedCode == 65) {
        ACore.MediaItems.SelectAll();
        ACore.MarkUsedKeywordsAndPeople();
        ACore.UpdateStatusBarInfo();
        e.ReturnValue = false;
      }

      if (e.CtrlKeyPressed && e.KeyPressedCode == 75) {
        if (ACore.MediaItems.Items.Count(x => x.IsSelected) == 1)
          CmdKeywordsComment_Executed(null, null);
        e.ReturnValue = false;
      }
    }
Ejemplo n.º 16
0
        void Document_ContextMenuShowing(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            //Debugger.Launch();
            e.ReturnValue = false;
            //((mshtml.HTMLAnchorElementClass)(((System.Windows.Forms.HtmlDocument)(sender)).ActiveElement.DomElement)).href
            dynamic domElement = sender;

            if (domElement.ActiveElement != null)
            {
                if (domElement.ActiveElement.DomElement.TagName == "A") //just anchor
                {
                    // expandoObject.SomeMember exists.
                    dynamic href = domElement.ActiveElement.DomElement.href;

                    var model = this.DataContext as SecureBrowserViewModel;
                    if (model.SelectedTabItem.WebBrowser != null)
                    {
                        var browser = model.SelectedTabItem.WebBrowser;
                        model.SelectedTabItem.WebBrowser.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
                        //var menuItem = new System.Windows.Forms.MenuItem("Open in new tab",new EventHandler(delegate(object menuSender, EventArgs menuEventArgs)
                        //{
                        //    MessageBox.Show("Novi: " + href.ToString());
                        //}));
                        // Debugger.Launch();
                        if (model.SelectedTabItem.WebBrowser.ContextMenuStrip.Items.Count == 0)
                        {
                            model.SelectedTabItem.WebBrowser.ContextMenuStrip.Items.Add("Open in a new tab", null, menuItem1_Click);
                        }
                        //var menuItem = new System.Windows.Forms.MenuItem("Open in new tab", menuItem1_Click);

                        //model.SelectedTabItem.WebBrowser.ContextMenu.MenuItems.Add(menuItem);
                        System.Drawing.Point p = GetMousePositionWindowsForms();//new System.Drawing.Point(e.MousePosition.X, e.MousePosition.Y);
                        model.SelectedTabItem.WebBrowser.ContextMenuStrip.Show(p);
                    }
                }
                else
                {
                }
            }
        }
Ejemplo n.º 17
0
 private void Wb1_Document_Click(Object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     if (e.ClientMousePosition.IsEmpty)
     {
         _elem1 = null;
         //posx = -1;
         //posy = -1;
     }
     else
     {
         //posx = e.ClientMousePosition.X;
         //posy = e.ClientMousePosition.Y;
         _elem1 = wb1.Document.GetElementFromPoint(e.ClientMousePosition); // Ruft das an den angegebenen Clientkoordinaten befindliche HTML-Element ab.
         if (_elem1 != null)
         {
             AddTextStr("wb1_Document_Click: " + _elem1.InnerText); // wb1_Document_Click: 376,36 EUR -1,72 EUR -0,45%
         }
         else
         {
             AddTextStr("wb1_Document_Click: null");
         }
     }
 }
Ejemplo n.º 18
0
 void Brush_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     StartActivity("中石油支付出示用户卡");
 }
Ejemplo n.º 19
0
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);

            string className = element.GetAttribute("className");
            string tagName   = element.TagName;


            if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
            {
                //string innerhtml = element.InnerHtml;
                if (!Element.Contains(element))
                {
                    List <string> AttributeName = new List <string>()
                    {
                        "name", "id", "value", "href", "src", "title", "type", "text", "class"
                    };


                    System.Windows.Forms.HtmlElementCollection links = automation_browser.Document.GetElementsByTagName(tagName);



                    //MessageBox.Show( tagName+" "+ className);



                    string           msgtext = "Select this Element?";
                    string           txt     = Application.Current.MainWindow.Title;
                    MessageBoxButton button  = MessageBoxButton.YesNoCancel;
                    MessageBoxResult result  = MessageBox.Show(msgtext, txt, button);

                    switch (result)
                    {
                    case MessageBoxResult.Yes:
                        Element.Add(element);
                        if (className != "")
                        {
                            foreach (System.Windows.Forms.HtmlElement link in links)
                            {
                                if (link.GetAttribute("className") == className)
                                {
                                    DataList.Add(link.InnerText);
                                    HtmlList.Add(link.OuterHtml);
                                }
                            }
                        }
                        else
                        {
                            foreach (System.Windows.Forms.HtmlElement link in links)
                            {
                                if (link.TagName == tagName)
                                {
                                    DataList.Add(link.InnerText);
                                    HtmlList.Add(link.OuterHtml);
                                }
                            }
                        }



                        break;

                    case MessageBoxResult.No:



                        break;

                    case MessageBoxResult.Cancel:

                        break;
                    }
                }
            }
        }
Ejemplo n.º 20
0
        private async void WebBrowser_LinkClick(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            bCancel = true;
            try
            {
                if (e.EventType.Equals("click", StringComparison.CurrentCultureIgnoreCase))
                {
                    e.BubbleEvent = false;
                    e.ReturnValue = false;

                    var from = e.FromElement;
                    var link = sender as System.Windows.Forms.HtmlElement;

                    var tag = link.GetAttribute("data-tag");
                    if (string.IsNullOrEmpty(tag))
                    {
                        var href       = link.GetAttribute("href");
                        var href_lower = href.ToLower();
                        if (!string.IsNullOrEmpty(href))
                        {
                            if (href_lower.StartsWith("pixiv://illusts/", StringComparison.CurrentCultureIgnoreCase))
                            {
                                var illust_id = Regex.Replace(href, @"pixiv://illusts/(\d+)", "$1", RegexOptions.IgnoreCase);
                                if (!string.IsNullOrEmpty(illust_id))
                                {
                                    var illust = illust_id.FindIllust();
                                    if (illust is Pixeez.Objects.Work)
                                    {
                                        await new Action(() =>
                                        {
                                            Commands.Open.Execute(illust);
                                        }).InvokeAsync();
                                    }
                                    else
                                    {
                                        illust = await illust_id.RefreshIllust();

                                        if (illust is Pixeez.Objects.Work)
                                        {
                                            await new Action(() =>
                                            {
                                                Commands.Open.Execute(illust);
                                            }).InvokeAsync();
                                        }
                                    }
                                }
                            }
                            else if (href_lower.StartsWith("pixiv://users/", StringComparison.CurrentCultureIgnoreCase))
                            {
                                var user_id = Regex.Replace(href, @"pixiv://users/(\d+)", "$1", RegexOptions.IgnoreCase);
                                var user    = user_id.FindUser();
                                if (user is Pixeez.Objects.User)
                                {
                                    await new Action(() =>
                                    {
                                        Commands.OpenUser.Execute(user);
                                    }).InvokeAsync();
                                }
                                else
                                {
                                    user = await user_id.RefreshUser();

                                    if (user is Pixeez.Objects.User)
                                    {
                                        Commands.OpenUser.Execute(user);
                                    }
                                }
                            }
                            else if (href_lower.StartsWith("http", StringComparison.CurrentCultureIgnoreCase) && href_lower.Contains("dic.pixiv.net/"))
                            {
                                await new Action(() =>
                                {
                                    Commands.OpenPedia.Execute(href);
                                }).InvokeAsync();
                                //GetHtmlContents(href);
                            }
                            else if (href_lower.StartsWith("about:/a", StringComparison.CurrentCultureIgnoreCase))
                            {
                                href = href.Replace("about:/a", "https://dic.pixiv.net/a");
                                await new Action(() =>
                                {
                                    Commands.OpenPedia.Execute(href);
                                }).InvokeAsync();
                                //GetHtmlContents(href);
                            }
                            else if (href_lower.Contains("pixiv.net/") || href_lower.Contains("pximg.net/"))
                            {
                                await new Action(() =>
                                {
                                    Commands.OpenSearch.Execute(href);
                                }).InvokeAsync();
                            }
                            else
                            {
                                e.BubbleEvent = true;
                                e.ReturnValue = true;
                            }
                            e.ReturnValue = false;
                        }
                    }
                    else
                    {
                        if (!e.AltKeyPressed && !e.CtrlKeyPressed && !e.ShiftKeyPressed)
                        {
                            Commands.OpenSearch.Execute($"Fuzzy Tag:{tag}");
                        }
                        else if (e.AltKeyPressed && !e.CtrlKeyPressed && !e.ShiftKeyPressed)
                        {
                            Commands.OpenSearch.Execute($"Tag:{tag}");
                        }
                    }
                }
            }
#if DEBUG
            catch (Exception ex)
            {
                ex.Message.DEBUG();
            }
#else
            catch (Exception ex) { ex.ERROR(); }
#endif
        }
Ejemplo n.º 21
0
 void Document_ContextMenuShowing(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     e.ReturnValue = false;
 }
Ejemplo n.º 22
0
 private void Return_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     StartActivity("车票预订主画面");
 }
Ejemplo n.º 23
0
    private void WbThumbs_MouseDown(object sender, HtmlElementEventArgs e) {
      if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Left) {
        var thumb = WbThumbs.Document?.GetElementFromPoint(e.ClientMousePosition)?.Parent;
        if (thumb == null) return;

        if (thumb.Id == "content") {
          ACore.MediaItems.DeselectAll();
          ACore.UpdateStatusBarInfo();
          ACore.MarkUsedKeywordsAndPeople();
          return;
        }

        if (!thumb.GetAttribute("className").Contains("thumbBox")) return;
        var mi = ACore.MediaItems.Items[int.Parse(thumb.Id)];

        if (e.CtrlKeyPressed) {
          mi.IsSelected = !mi.IsSelected;
          ACore.MediaItems.SetCurrent();
          ACore.UpdateStatusBarInfo();
          ACore.MarkUsedKeywordsAndPeople();
          return;
        }

        var current = ACore.MediaItems.Current;
        if (e.ShiftKeyPressed && current != null) {
          ACore.MediaItems.DeselectAll();
          var start = mi.Index > current.Index ? current.Index : mi.Index;
          var stop = mi.Index > current.Index ? mi.Index : current.Index;
          for (var i = start; i < stop + 1; i++) {
            ACore.MediaItems.Items[i].IsSelected = true;
          }
        }

        if (!e.CtrlKeyPressed && !e.ShiftKeyPressed && !mi.IsSelected) {
          ACore.MediaItems.DeselectAll();
          mi.IsSelected = true;
        }

        ACore.MediaItems.SetCurrent();
        ACore.UpdateStatusBarInfo();
        ACore.MarkUsedKeywordsAndPeople();
      }
    }
Ejemplo n.º 24
0
 void DictBienvenue_Load(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
 }
Ejemplo n.º 25
0
 private void Document_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     OnHtmlChanged?.Invoke(sender, null);
 }
Ejemplo n.º 26
0
 void Strip_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     ReleaseCapture();
     SendMessage(this.Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
 }
Ejemplo n.º 27
0
 private void Document_Focusing(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     SendFocusToPeek();
 }
Ejemplo n.º 28
0
        private void document_MouseOver(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            System.Windows.Forms.HtmlElement element = e.ToElement;


            string dozmiany = element.OuterHtml;

            //textEditor1.Text = "ttttttttttttt" + dozmiany;


            if (!this.elementStyles.ContainsKey(element))
            {
                string style = element.Style;
                this.elementStyles.Add(element, style);
                element.Style = style + "; background-color: #ffc;";

                HtmlDocument aaa = new HtmlDocument();
                try
                {
                    string pol    = htmlDocument2.body.parentElement.outerHTML;
                    string result = pol.Replace(dozmiany, element.OuterHtml); //Regex.Replace(htmlDocument2.body.parentElement.outerHTML, dozmiany, element.OuterHtml, RegexOptions.IgnoreCase);4
                                                                              //richTextBox2.AppendText(result);
                    aaa.LoadHtml(result);
                }
                catch (Exception wyjatek)
                {
                    MessageBox.Show(wyjatek.ToString());
                }

                label2.Content = dozmiany;
                // MessageBox.Show(dozmiany);
                //textEditor1.Text ="ttttttttttttt"+ dozmiany;

                //MessageBox.Show(element.GetAttribute("id"));

                HtmlNode ddd = aaa.DocumentNode;

                //richTextBox1.AppendText(ddd.OuterHtml);
                try
                {
                    HtmlNode ggg = ddd.SelectSingleNode("//*[contains(@style,'BACKGROUND-COLOR: #ffc')]");
                    if (ggg != null)
                    {
                        string lll = ggg.XPath;
                        txtSearchTag.Text = lll;
                        label3.Content    = lll;
                    }
                    else
                    {
                        ggg = ddd.SelectSingleNode("//*[contains(@style,'background-color: rgb(255, 255, 204)')]");
                        if (ggg != null)
                        {
                            string lll = ggg.XPath;
                            txtSearchTag.Text = lll;
                            label3.Content    = lll;
                        }
                        else
                        {
                            //richTextBox2.AppendText(result);
                            label3.Content = "Nie znaleziono";
                        }
                    }
                }
                catch (Exception sel)
                {
                    MessageBox.Show(sel.ToString());
                }
                //this.Text = element.Id ?? "(no id)";


                label1.Content = element.OuterHtml;
            }


            //string ffff = wartosc.XPath;
        }
Ejemplo n.º 29
0
        void DictBienvenue_Create(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            int countStrings = 0;
            int countTabs    = 0;

            foreach (string key in this.inputDict.StringKeys)
            {
                ++countStrings;
            }
            foreach (string key in this.inputDict.ArrayKeys)
            {
                ++countTabs;
            }
            if (countTabs > 0)
            {
                if (countStrings > 0)
                {
                    DictSaisieLibre dsl = new DictSaisieLibre(null, null, this.web, this.inputDict, this.outputDict, this.fileNameSrc);
                    dsl.PreviousPage = this;
                    IDictProcess nextPage = dsl;
                    foreach (string key in this.inputDict.ArrayKeys)
                    {
                        bool            makeTab = true;
                        o2Mate.ILegende legende = this.inputDict.Legendes.GetLegendeByName(key);
                        // si le tableau n'est pas libre alors on ne l'affiche pas
                        if (legende != null && !legende.Free)
                        {
                            makeTab = false;
                        }
                        if (makeTab)
                        {
                            DictSaisieTableau tab = new DictSaisieTableau(null, null, this.web, this.inputDict, this.outputDict, this.fileNameSrc, key);
                            tab.Load();
                            nextPage.NextPage = tab;
                            tab.PreviousPage  = nextPage;
                            nextPage          = tab;
                        }
                    }
                    nextPage.NextPage = new DictExecute(this.web, this.inputDict, this.outputDict, this.fileNameSrc);
                    nextPage.NextPage.Load();
                    dsl.Load();
                    dsl.Navigate();
                }
                else
                {
                    IDictProcess nextPage = this;
                    foreach (string key in this.inputDict.ArrayKeys)
                    {
                        bool            makeTab = true;
                        o2Mate.ILegende legende = this.inputDict.Legendes.GetLegendeByName(key);
                        // si le tableau n'est pas libre alors on ne l'affiche pas
                        if (legende != null && !legende.Free)
                        {
                            makeTab = false;
                        }
                        if (makeTab)
                        {
                            DictSaisieTableau tab = new DictSaisieTableau(null, null, this.web, this.inputDict, this.outputDict, this.fileNameSrc, key);
                            tab.Load();
                            nextPage.NextPage = tab;
                            tab.PreviousPage  = nextPage;
                            nextPage          = tab;
                        }
                    }
                    nextPage.NextPage = new DictExecute(this.web, this.inputDict, this.outputDict, this.fileNameSrc);
                    nextPage.NextPage.Load();
                    this.NextPage.Navigate();
                }
            }
            else if (countStrings > 0)
            {
                DictSaisieLibre dsl = new DictSaisieLibre(null, null, this.web, this.inputDict, this.outputDict, this.fileNameSrc);
                dsl.PreviousPage = this;
                dsl.NextPage     = new DictExecute(this.web, this.inputDict, this.outputDict, this.fileNameSrc);
                dsl.NextPage.Load();
                dsl.Load();
                dsl.Navigate();
            }
        }
Ejemplo n.º 30
0
 private void OnDocumentContextMenuShowing(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     EditingContextMenu.IsOpen = true;
     e.ReturnValue             = false;
 }
Ejemplo n.º 31
0
 void Hand_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     StartActivity("中石油支付用户登录");
 }
        void document_MouseDown(object sender, System.Windows.Forms.HtmlElementEventArgs e)
        {
            try
            {
                if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right)
                {
                    System.Windows.Forms.HtmlElement element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);

                    //System.Windows.Forms.HtmlElement xPath_element = this.automation_browser.Document.GetElementFromPoint(e.ClientMousePosition);



                    //******************* for testing XPATH *****************



                    var savedId  = element.Id;
                    var uniqueId = Guid.NewGuid().ToString();
                    element.Id = uniqueId;

                    var doc = new HtmlAgilityPack.HtmlDocument();
                    doc.LoadHtml(element.Document.GetElementsByTagName("html")[0].OuterHtml);
                    element.Id = savedId;

                    var    node  = doc.GetElementbyId(uniqueId);
                    string xpath = node.XPath;



                    string[] parentNodes = xpath.Split('/');

                    parentCounting = 0;

                    try
                    {
                        System.Windows.Forms.HtmlElement starting_element = Finding_Parent_With_Identifier(element);

                        string starting_element_idName = starting_element.GetAttribute("id");

                        string startingPattern = @"//*[@";
                        string middlePattern   = "=" + '"'; //"="";
                        string endingPattern   = '"' + "]"; //""]";

                        string XPATH = startingPattern + "id" + middlePattern + starting_element_idName + endingPattern;

                        for (int i = parentNodes.Length - parentCounting + 1; i < parentNodes.Length; i++)
                        {
                            string tmp = '/' + parentNodes[i];
                            XPATH += tmp;
                        }
                    }
                    catch (Exception ex)
                    {
                    }



                    //******************* for testing XPATH *****************



                    string element_tagName = element.TagName.ToString();
                    //string innerHtml=element.TagName.
                    //string element_outerHTML = element2.OuterHtml;


                    //MessageBox.Show("inner html= " + element.InnerHtml);
                    //MessageBox.Show("inner text= "+ element.InnerText);
                    //MessageBox.Show("class name= "+element.GetAttribute("class").Trim());

                    //MessageBox.Show(element_tagName);


                    //MessageBox.Show("id= "+element.GetAttribute("id"));
                    //MessageBox.Show("name= "+element.GetAttribute("name"));
                    //MessageBox.Show("inner text= " + element.InnerText);
                    //MessageBox.Show("inner html= " + element.InnerHtml);

                    selenium_id = element.GetAttribute("id").Trim();

                    System.Windows.Forms.HtmlElement aelement = automation_browser.Document.GetElementById(selenium_id);


                    // MessageBox.Show(selectedIndex.ToString());

                    //MessageBox.Show(element_tagName);
                    //if (element_tagName.ToLower() == "select")
                    //{
                    selenium_id = element.GetAttribute("id").Trim();
                    if (!input_id_check_str.Contains(selenium_id.ToLower()))
                    {
                        string           msgtext = "Select this Drop-Down?";
                        string           txt     = Application.Current.MainWindow.Title;
                        MessageBoxButton button  = MessageBoxButton.YesNoCancel;
                        MessageBoxResult result  = MessageBox.Show(msgtext, txt, button);

                        switch (result)
                        {
                        case MessageBoxResult.Yes:


                            input_id_check_str.Add(selenium_id.ToLower());
                            selenium_name = element.GetAttribute("name").Trim();

                            object objElement       = element.DomElement;
                            object objSelectedIndex = objElement.GetType().InvokeMember("selectedIndex",
                                                                                        BindingFlags.GetProperty, null, objElement, null);
                            int selectedIndex = (int)objSelectedIndex;

                            // MessageBox.Show("in yes indes= "+selectedIndex);

                            AutomationBrowser_HtmlElementInfo.Add(new HtmlElementInfo()
                            {
                                Html_element_id      = selenium_id,
                                Html_element_name    = selenium_name,
                                Html_drop_down_index = selectedIndex,
                                //Html_element_XPATH = XPATH
                            });



                            //(this.Parent as MetroWindow).DialogResult = true;
                            //(this.Parent as MetroWindow).Close();
                            break;

                        case MessageBoxResult.No:

                            break;

                        case MessageBoxResult.Cancel:

                            break;
                        }
                    }
                    else
                    {
                        //MessageBox.Show("You have already entered value in thid field.");
                    }

                    // }
                    //else
                    //{
                    //    MessageBox.Show("Please, Focus only Drop-Down");
                    //}
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 33
0
 void Return_Click(object sender, System.Windows.Forms.HtmlElementEventArgs e)
 {
     GotoMain();
 }