Exemplo n.º 1
0
        public Browser()
            : base()
        {
            // Initialize
            this.ScriptErrorsSuppressed = true;
            this.ScrollBarsEnabled      = false;
            // Make sure we track which frames IE is focused on as a result
            // of javascript or mouse/keyboard events.
            this.Navigated += delegate(object sender, WebBrowserNavigatedEventArgs e)
            {
                if (this.Document != null && this.Document.Window != null)
                {
                    FocusedFrame = this.Document.Window;
                    foreach (HtmlWindow window in FocusedFrame.GetAllFrames())
                    {
                        window.GotFocus += delegate(object sender2, HtmlElementEventArgs e2)
                        {
                            FocusedFrame = sender2 as HtmlWindow;
                        };
                    }
                }
            };

            // Ignore popups if requested
            if (Browser.IgnorePopups)
            {
                this.NewWindow += delegate(object sender, System.ComponentModel.CancelEventArgs e)
                {
                    e.Cancel = true;
                };
            }
        }
Exemplo n.º 2
0
        public Browser()
            : base()
        {
#if !DEBUG
            // Suppress Javascript error popups (release only)
            this.ScriptErrorsSuppressed = true;
#endif
            // Make sure we track which frames IE is focused on as a result
            // of javascript or mouse/keyboard events.
            this.Navigated += delegate(object sender, WebBrowserNavigatedEventArgs e)
            {
                if (this.Document != null && this.Document.Window != null)
                {
                    FocusedFrame = this.Document.Window;
                    foreach (HtmlWindow window in FocusedFrame.GetAllFrames())
                    {
                        window.GotFocus += delegate(object sender2, HtmlElementEventArgs e2)
                        {
                            FocusedFrame = sender2 as HtmlWindow;
                        };
                    }
                }
            };
        }