Exemplo n.º 1
0
        private void InitBrowser()
        {
            _browser                  = new WebBrowser();
            _browser.Margin           = new Thickness(0);
            _browser.ClipToBounds     = true;
            _browser.Focusable        = true;
            _browser.Cursor           = Cursors.None;
            _browser.IsHitTestVisible = false;

            _wbHandler = new WebBrowserHostUIHandler(_browser);
            _wbHandler.IsWebBrowserContextMenuEnabled = false;
            _wbHandler.ScriptErrorsSuppressed         = true;
            _wbHandler.OpenNewWindowSuppressed        = true;

            _browser.LoadCompleted += _browser_LoadCompleted;
            _browser.StylusDown    += _browser_UserAction;
            _browser.StylusMove    += _browser_UserAction;
            _browser.StylusUp      += _browser_UserAction;

            _browser.TouchDown += _browser_UserAction;
            _browser.TouchMove += _browser_UserAction;
            _browser.TouchUp   += _browser_UserAction;

            _browser.KeyDown += _browser_UserAction;
            _browser.KeyUp   += _browser_UserAction;

            _browser.AddHandler(UIElement.MouseWheelEvent, _mouseWeelHandler, true);
            _browser.AddHandler(UIElement.MouseDownEvent, _mouseDownHandler, true);
            _browser.AddHandler(UIElement.MouseMoveEvent, _mouseMoveHandler, true);
            _browser.AddHandler(UIElement.MouseUpEvent, _mouseUpHandler, true);

            _browser.AddHandler(UIElement.TouchMoveEvent, _touchMoveHandler, true);
            _browser.AddHandler(UIElement.TouchUpEvent, _touchUpHandler, true);
            _browser.AddHandler(UIElement.TouchDownEvent, _touchDownHandler, true);

            mainContent.Children.Add(_browser);

            GoHome();
        }