public Form1()
        {
            InitializeComponent();


            //Change address bar by event OnClick
            DOMEventHandler domEvent = delegate(object sender1, DOMEventArgs e1)
            {
                DOMEventType eventType = e1.Type;
            };

            browserView.Browser.FinishLoadingFrameEvent += delegate(object sender2, FinishLoadingEventArgs e2)
            {
                if (e2.IsMainFrame)
                {
                    DOMDocument document        = e2.Browser.GetDocument();
                    DOMElement  documentElement = document.DocumentElement;
                    documentElement.AddEventListener(DOMEventType.OnClick, domEvent, false);
                }

                try
                {
                    //toolStripDebug.Text = browserView.Browser.GetDocument().GetElementByClassName("cdr_frm").GetElementByTagName("input").GetAttribute("value").ToString();
                    toolStripAddress.Text = browserView.Browser.URL.ToString();
                    this.Text             = browserView.Browser.Title;
                }
                catch { }
            };
        }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();

            browser = BrowserFactory.Create();
            BrowserView browserView = new WinFormsBrowserView(browser);

            browserView.Browser.DialogHandler = new WinFormsDefaultDialogHandler((Control)browserView.GetComponent());

            this.Controls.Add((Control)browserView.GetComponent());

            DOMEventHandler domEvent = delegate(object sender, DOMEventArgs e)
            {
                DOMEventType eventType = e.Type;
                Console.Out.WriteLine("handleEvent = " + eventType);
            };


            browserView.Browser.FinishLoadingFrameEvent += delegate(object sender, FinishLoadingEventArgs e)
            {
                if (e.IsMainFrame)
                {
                    DOMDocument document        = e.Browser.GetDocument();
                    DOMElement  documentElement = document.DocumentElement;
                    documentElement.AddEventListener(DOMEventType.OnClick | DOMEventType.OnMouseDown | DOMEventType.OnMouseUp | DOMEventType.OnKeyDown, domEvent, false);
                }
            };

            browserView.Browser.LoadURL("http://www.teamdev.com");
        }