コード例 #1
0
        protected override void OnDomClick(DomMouseEventArgs e)
        {
            var elem = Document.ActiveElement;
            var uri  = elem.HasAttribute("Href") ? elem.GetAttribute("Href") :
                       elem.Parent.HasAttribute("Href") ? elem.Parent.GetAttribute("Href") :
                       "";
            const string scheme = "hybrid:";

            if (!uri.StartsWith(scheme))
            {
                base.OnDomClick(e);
            }
            e.Handled = true;
            var resources  = uri.Substring(scheme.Length).Split('?');
            var method     = resources[0];
            var parameters = resources.Length > 1? System.Web.HttpUtility.ParseQueryString(resources[1]): null;

            switch (method)
            {
            case "VowelChart": break;

            case "ConstChart": break;
                //case "DataCorpus": DisplayPages.DisplayData(); break;
                //case "Search": break;
                //case "Project": DisplayPages.DisplayOpenProject(); break;
                //case "Settings": break;
                //case "DistChart": break;
                //case "Steps": break;
                //case "Close": Program.DisplayMenu(); break;
            }
        }
コード例 #2
0
        protected void HandleDomClick(object sender, DomMouseEventArgs e)
        {
            if (sender == null || e == null || e.Target == null)
            {
                return;
            }

            GeckoElement elem = e.Target.CastToGeckoElement();
            int          hvo;

            if (TryGetHvo(elem, out hvo))
            {
                JumpToToolBasedOnHvo(hvo);
            }

            if (elem.TagName.Equals("input", StringComparison.InvariantCultureIgnoreCase) &&
                elem.GetAttribute("type").Equals("button", StringComparison.InvariantCultureIgnoreCase))
            {
                switch (elem.GetAttribute("name"))
                {
                case "ShowWordGrammarDetail":
                    ShowWordGrammarDetail(elem.GetAttribute("id"));
                    break;

                case "TryWordGrammarAgain":
                    TryWordGrammarAgain(elem.GetAttribute("id"));
                    break;

                case "GoToPreviousWordGrammarPage":
                    GoToPreviousWordGrammarPage();
                    break;
                }
            }
        }
コード例 #3
0
        private void wbElementRecorder_DomDoubleClick(object sender, DomMouseEventArgs e)
        {
            //mouse down has occured
            if (e != null)
            {
                try
                {
                    if (_isRecording)
                    {
                        _lastSavedPoint = new Point(e.ClientX, e.ClientY);
                        LoadSearchParameters(_lastSavedPoint);
                        lblDescription.Text = _recordingMessage;
                    }

                    if (IsRecordingSequence && _isRecording)
                    {
                        //remove previous commands generated from two single clicks
                        for (int i = 0; i < 4; i++)
                        {
                            _sequenceCommandList.RemoveAt(_sequenceCommandList.Count - 1);
                        }

                        BuildElementClickActionCommand("Double Left Click");
                    }
                }
                catch (Exception)
                {
                    lblDescription.Text = _errorMessage;
                }
            }
        }
コード例 #4
0
ファイル: SplitBlockDlg.cs プロジェクト: irahopkinson/Glyssen
        private void HandleClick(object sender, DomMouseEventArgs e)
        {
            GeckoElement geckoElement;

            if (m_blocksDisplayBrowser.Visible && GeckoUtilities.ParseDomEventTargetAsGeckoElement(e.Target, out geckoElement))
            {
                int splitId;
                if (IsElementSelect(geckoElement))
                {
                    m_lblInvalidSplitLocation.Visible = false;
                }
                else if (IsElementSplitLine(geckoElement, out splitId))
                {
                    m_splitLocations.Remove(m_splitLocations.Single(s => s.Id == splitId));
                    SetHtml();
                    m_btnOk.Enabled = m_splitLocations.Any();
                    m_lblInvalidSplitLocation.Visible = false;
                }
                else if (DetermineSplitLocation(geckoElement))
                {
                    SetHtml();
                    m_btnOk.Enabled = true;
                    m_lblInvalidSplitLocation.Visible = false;
                }
                else
                {
                    m_lblInvalidSplitLocation.Visible = true;
                }
            }
            else
            {
                m_lblInvalidSplitLocation.Visible = true;
            }
        }
コード例 #5
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");
        }
コード例 #6
0
 private void geckoWebBrowser1_DomMouseDown(object sender, DomMouseEventArgs e)
 {
     if (e.Button == GeckoMouseButton.Right)
     {
         dataGridView1.Rows.Add(richTextBox1.Text, richTextBox2.Text, richTextBox3.Text);
     }
 }
コード例 #7
0
    private void geckoWebBrowser1_DomMouseDown(object sender, DomMouseEventArgs e)
    {
        GeckoHtmlElement elm = (GeckoHtmlElement)e.Target.CastToGeckoElement();

        switch (elm.ClassName)
        {
        case "ytp-fullscreen-button ytp-button":
            this.SetWindowState(FormWindowState.Maximized, false);
            if (this.geckoWebBrowser1.Document.GetElementsByClassName("ytp-size-button ytp-button").FirstOrDefault() is GeckoHtmlElement theater)
            {
                if (this.TheaterClicked == false)
                {
                    theater.Click();
                    this.TheaterClicked = true;
                }
            }
            break;

        case "ytp-size-button ytp-button":
            this.TheaterClicked = !this.TheaterClicked;
            break;

        default:
            break;
        }
    }
コード例 #8
0
        private void OnMouseClick(object sender, DomMouseEventArgs e)
        {
            if (!m_blocksDisplayBrowser.Window.Selection.IsCollapsed)
            {
                return;
            }

            GeckoElement geckoElement;

            if (GeckoUtilities.ParseDomEventTargetAsGeckoElement(e.Target, out geckoElement))
            {
                var geckoDivElement = geckoElement as GeckoDivElement;

                while (geckoDivElement != null && !geckoDivElement.ClassName.Contains("block scripture"))
                {
                    geckoDivElement = geckoDivElement.Parent as GeckoDivElement;
                }
                if (geckoDivElement == null)
                {
                    return;
                }

                int       blockIndexInBook;
                GeckoNode blockIndexInBookAttr = geckoDivElement.Attributes["data-block-index-in-book"];
                if (blockIndexInBookAttr == null || !Int32.TryParse(blockIndexInBookAttr.NodeValue, out blockIndexInBook))
                {
                    return;
                }
                m_viewModel.CurrentBlockIndexInBook = blockIndexInBook;
            }
        }
コード例 #9
0
ファイル: DomUIEventArgs.cs プロジェクト: loundar/geckofx-29
 public static DomUIEventArgs Create(nsIDOMUIEvent ev)
 {
     if (ev is nsIDOMMouseEvent)
     {
         return(DomMouseEventArgs.Create((nsIDOMMouseEvent)ev));
     }
     return(new DomUIEventArgs(ev));
 }
コード例 #10
0
    private void geckoWebBrowser1_DomMouseDown(object sender, DomMouseEventArgs e)
    {
        GeckoHtmlElement elm = (GeckoHtmlElement)e.Target.CastToGeckoElement();

        if (elm.ClassName.Contains("fullscreen"))
        {
            this.SetWindowState(FormWindowState.Maximized, false);
        }
    }
コード例 #11
0
ファイル: Browser.cs プロジェクト: phillip-hopper/Glyssen
        private void HandleDomMouseOver(object sender, DomMouseEventArgs e)
        {
            EventHandler <DomMouseEventArgs> handler = OnMouseOver;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #12
0
ファイル: Browser.cs プロジェクト: witheej/Glyssen
        private void HandleDomMouseClick(object sender, DomMouseEventArgs e)
        {
            EventHandler <DomMouseEventArgs> handler = OnMouseClick;

            if (handler != null)
            {
                handler(this, e);
            }

            e.Handled = true;              // don't let the browser navigate itself
        }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: KoenCoolen1/test1
 void OpenGeckoLinksInNewWindow(object sender, DomMouseEventArgs e)
 {
     if (sender != null && e != null && e.Target != null)
     {
         GeckoElement clicked = e.Target.CastToGeckoElement();
         if (clicked.TagName == "A")
         {
             e.Handled = true;
             System.Diagnostics.Process.Start(clicked.GetAttribute("href"));
         }
     }
 }
コード例 #14
0
 private void InsertSplitLocation(object sender, DomMouseEventArgs e)
 {
     if (DetermineSplitLocation(e.Target))
     {
         SetHtml();
         m_btnOk.Enabled = true;
         m_lblInvalidSplitLocation.Visible = false;
     }
     else
     {
         m_lblInvalidSplitLocation.Visible = true;
     }
 }
コード例 #15
0
        /// <summary>
        /// 鼠标移动到元素上执行的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void On_MouseMove(object sender, DomMouseEventArgs e)
        {
            var ele = e.CurrentTarget.CastToGeckoElement();

            ele = e.Target.CastToGeckoElement();

            var cls = ele.GetAttribute("class");

            if (!cls.Contains("focusHover"))
            {
                cls += " " + "focusHover";
                ele.SetAttribute("class", cls);
            }
        }
コード例 #16
0
        /// <summary>
        /// Dom单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void On_DomClick(object sender, DomMouseEventArgs e)
        {
            //屏蔽页面点击事件
            e.PreventDefault();
            e.StopPropagation();

            var ele = e.CurrentTarget.CastToGeckoElement();

            ele = e.Target.CastToGeckoElement();
            GeckoHtmlElement geckoHtmlElement = (GeckoHtmlElement)ele;
            string           searchElement    = geckoHtmlElement.OuterHtml;

            if (!searchElement.Contains("firefinder-match-red"))
            {
                //在datagridview中显示选中行的内容
                GeckoHtmlElement[] geckoHtmlEle = new GeckoHtmlElement[1];
                geckoHtmlEle[0] = geckoHtmlElement;

                if (geckofxType.Equals(GeckofxWebbrowerType.General))
                {
                    InsertDataGridRow(dgv, geckoWebBrowser, geckoHtmlEle);
                }
                else if (geckofxType.Equals(GeckofxWebbrowerType.ListDetails))
                {
                    InsertDataGridRow(dgv, geckoWebBrowser, geckoHtmlEle);
                }
                else if (geckofxType.Equals(GeckofxWebbrowerType.UrlModel))
                {
                    try
                    {
                        GeckoAnchorElement d   = (GeckoAnchorElement)geckoHtmlElement;
                        string             URL = d.Href;

                        InsertDataGridRow(GeckofxWebbrowerType.UrlModel, dgv, geckoWebBrowser, geckoHtmlEle);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("请获取链接!");
                        return;
                    }
                }

                ruleStyle.AddClass("firefinder-match-red", ele);
            }
            else
            {
                //在浏览器中标记红圈
                ruleStyle.RemoveClass("firefinder-match-red", ele);
            }
        }
コード例 #17
0
        private void wbElementRecorder_DomClick(object sender, DomMouseEventArgs e)
        {
            //mouse down has occured
            if (e != null)
            {
                try
                {
                    if (_isRecording)
                    {
                        _lastSavedPoint = new Point(e.ClientX, e.ClientY);
                        LoadSearchParameters(_lastSavedPoint);
                        lblDescription.Text = _recordingMessage;
                    }

                    string clickType;
                    switch (e.Button)
                    {
                    case GeckoMouseButton.Left:
                        clickType = "Invoke Click";
                        break;

                    case GeckoMouseButton.Middle:
                        clickType = "Middle Click";
                        break;

                    case GeckoMouseButton.Right:
                        clickType = "Right Click";
                        break;

                    default:
                        clickType = "Invoke Click";
                        break;
                    }

                    if (IsRecordingSequence && _isRecording)
                    {
                        BuildElementClickActionCommand(clickType);
                    }
                }
                catch (Exception)
                {
                    lblDescription.Text = _errorMessage;
                }
            }

            if (chkStopOnClick.Checked)
            {
                Close();
            }
        }
コード例 #18
0
        /// <summary>
        /// 鼠标移走的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void On_MouseOut(object sender, DomMouseEventArgs e)
        {
            var ele = e.CurrentTarget.CastToGeckoElement();

            ele = e.Target.CastToGeckoElement();


            var cls = ele.GetAttribute("class");

            if (!string.IsNullOrWhiteSpace(cls))
            {
                cls = cls.Replace("focusHover", "").Trim();
                ele.SetAttribute("class", cls);
            }
        }
コード例 #19
0
        public static DomUIEventArgs Create(nsIDOMUIEvent ev)
        {
            if (ev is nsIDOMMouseEvent)
            {
                return(DomMouseEventArgs.Create((nsIDOMMouseEvent)ev));
            }
#if PORTFF60
            else if (ev is nsIDOMKeyEvent)
            {
                return(DomKeyEventArgs.Create((nsIDOMKeyEvent)ev));
            }
#endif

            return(new DomUIEventArgs(ev));
        }
コード例 #20
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)
     {
     }
 }
コード例 #21
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)
     {
     }
 }
コード例 #22
0
        private void OnMouseOver(object sender, DomMouseEventArgs e)
        {
            if (e.Target == null || m_getCharacterIdForUi == null || !m_blocksDisplayBrowser.Visible)
            {
                HideToolTip();
                return;
            }

            var geckoElement = e.Target.CastToGeckoElement();
            var checkElement = geckoElement as GeckoHtmlElement;

            for (int i = 0; i < 10; i++)
            {
                if (checkElement == null)
                {
                    HideToolTip();
                    return;
                }
                else if (checkElement.ClassName != BlockNavigatorViewModel.kCssClassContext)
                {
                    checkElement = checkElement.Parent;
                }
                else
                {
                    break;
                }
            }

            if (m_toolTip == null)
            {
                m_toolTip = new ToolTip {
                    IsBalloon = true
                };
                string toolTipText = m_getCharacterIdForUi(checkElement.GetAttribute(BlockNavigatorViewModel.kDataCharacter));

                // 42 and 43 are the magic numbers which happens to make these display in the correct place
                // REVIEW: it would be nice to figure out a better way to place these which is more robust. These numbers have changed several times already
                int x = m_blocksDisplayBrowser.Location.X + m_blocksDisplayBrowser.Size.Width - 42;
                int y = m_blocksDisplayBrowser.Location.Y + e.ClientY - m_blocksDisplayBrowser.Margin.Top - 43;

                m_toolTip.Show(toolTipText, this, x, y);
            }
        }
コード例 #23
0
        private void _gecko_DomClick(object sender, DomMouseEventArgs e)
        {
            var ele = e.Target.CastToGeckoElement();

            if (ele.GetAttribute("id") == "btnMethod")
            {
                string methodName = ele.GetAttribute("value");
                string param      = _gecko.Document.GetElementById("hidMethodParam").GetAttribute("value");

                try
                {
                    var method = this.GetType().GetMethod(methodName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
                    method.Invoke(this, new object[] { param });
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this.GetParentByName <Window>(null), ex.Message);
                }
            }
        }
コード例 #24
0
        private void m_browser_OnMouseClick(object sender, DomMouseEventArgs e)
        {
            if (this.DesignModeAtAll())
            {
                return;
            }

            if (e.Target == null)
            {
                return;
            }

            var element = e.Target.CastToGeckoElement();

            // handle if the user clicked on a hyperlink
            if (element.TagName == "A")
            {
                var url = element.GetAttribute("href");
                if (url.StartsWith("file://"))
                {
                    var path = url.Replace("file://", "");

                    var classAttr = element.GetAttribute("class");
                    if (classAttr != null && classAttr.Contains("showFileLocation"))
                    {
                        PathUtilities.SelectFileInExplorer(path);
                    }
                    else
                    {
                        Process.Start(path);
                    }
                }
                else
                {
                    // TODO: what if the hyperlink points to a web page?
                    //Process.Start(url);
                }
            }
        }
コード例 #25
0
        /// <summary>
        /// Handle a mouse click in the web browser displaying the xhtml.
        /// </summary>
        private void OnDomClick(object sender, DomMouseEventArgs e)
        {
            XhtmlDocView.CloseContextMenuIfOpen();
            var browser = m_mainView.NativeBrowser as GeckoWebBrowser;

            if (browser == null)
            {
                return;
            }
            var element = browser.DomDocument.ElementFromPoint(e.ClientX, e.ClientY);

            if (element == null || element.TagName == "html")
            {
                return;
            }
            if (e.Button == GeckoMouseButton.Left)
            {
                XhtmlDocView.HandleDomLeftClick(Clerk, m_propertyTable, e, element);
            }
            else if (e.Button == GeckoMouseButton.Right)
            {
                XhtmlDocView.HandleDomRightClick(browser, e, element, m_propertyTable, m_mediator);
            }
        }
コード例 #26
0
        /// <summary>
        /// Dom双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void On_DomDoubleClick(object sender, DomMouseEventArgs e)
        {
            //屏蔽页面点击事件
            e.PreventDefault();
            e.StopPropagation();

            var ele = e.CurrentTarget.CastToGeckoElement();

            ele = e.Target.CastToGeckoElement();
            GeckoHtmlElement geckoHtmlElement = (GeckoHtmlElement)ele;

            //短xpath
            var xpath1 = xpathHelper.GetSmallXpath(ele);

            //var xpath2 = xpathHelper.GetXpath(ele);
            if (xpath1.Contains("tr"))
            {
                string demo = xpath1.Substring(xpath1.IndexOf("tr"));
                try
                {
                    demo = demo.Substring(0, demo.IndexOf("/"));
                }
                catch (Exception)
                {
                }
                xpath1 = xpath1.Replace(demo, "tr");
            }
            else if (xpath1.Contains("li"))
            {
                string demo = xpath1.Substring(xpath1.IndexOf("li"));
                try
                {
                    demo = demo.Substring(0, demo.IndexOf("/"));
                }
                catch (Exception)
                {
                }
                xpath1 = xpath1.Replace(demo, "li");
            }

            if (string.IsNullOrWhiteSpace(xpath1))
            {
                return;
            }
            var xresult  = geckoWebBrowser.DomDocument.EvaluateXPath(xpath1);
            var nodes    = xresult.GetNodes();
            var elements = nodes.Select(x => x as GeckoElement).ToArray();


            if (geckofxType.Equals(GeckofxWebbrowerType.General))
            {
            }
            else if (geckofxType.Equals(GeckofxWebbrowerType.ListDetails))
            {
            }
            else if (geckofxType.Equals(GeckofxWebbrowerType.UrlModel))
            {
                foreach (var item in elements)
                {
                    try
                    {
                        GeckoAnchorElement d   = (GeckoAnchorElement)geckoHtmlElement;
                        string             URL = d.Href;
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("链接列表有问题,请检查!");
                        return;
                    }
                }
            }

            ruleStyle.AddClass("firefinder-match-red", elements);
            InsertDataGridRow(GeckofxWebbrowerType.UrlModel, dgv, geckoWebBrowser, elements);
        }
コード例 #27
0
ファイル: GeckoComboBox.cs プロジェクト: sillsdev/wesay
 protected override void OnDomClick(object sender, DomMouseEventArgs e)
 {
     _browser.Focus();
 }
コード例 #28
0
 protected virtual void OnDomClick(object sender, DomMouseEventArgs e)
 {
 }
コード例 #29
0
ファイル: LauncherForm.cs プロジェクト: BlackCoyote/Voxalia
 private void GeckoWebBrowser1_DomClick(object sender, DomMouseEventArgs e)
 {
     e.Handled = true;
 }