Ejemplo n.º 1
0
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "Address":
                AddressEditable = Address;
                break;

            case "WebBrowser":
                if (WebBrowser != null)
                {
                    WebBrowser.ConsoleMessage += OnWebBrowserConsoleMessage;
                    WebBrowser.LoadError      += OnWebBrowserLoadError;

                    // TODO: This is a bit of a hack. It would be nicer/cleaner to give the webBrowser focus in the Go()
                    // TODO: method, but it seems like "something" gets messed up (= doesn't work correctly) if we give it
                    // TODO: focus "too early" in the loading process...
                    WebBrowser.FrameLoadEnd += delegate { Application.Current.Dispatcher.BeginInvoke((Action)(() => webBrowser.Focus())); };
                }

                break;
            }
        }
Ejemplo n.º 2
0
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "Address":
                AddressEditable = Address;
                break;

            case "WebBrowser":
                if (WebBrowser != null)
                {
                    WebBrowser.ConsoleMessage += OnWebBrowserConsoleMessage;
                    WebBrowser.LoadError      += OnWebBrowserLoadError;

                    // TODO: This is a bit of a hack. It would be nicer/cleaner to give the webBrowser focus in the Go()
                    // TODO: method, but it seems like "something" gets messed up (= doesn't work correctly) if we give it
                    // TODO: focus "too early" in the loading process...
                    WebBrowser.FrameLoadEnd += delegate { Application.Current.Dispatcher.BeginInvoke((Action)(() => webBrowser.Focus())); };

                    // TODO: enable to quickly try out IRequestHandlers like OnBeforePluginLoad.
                    // Currently disabled until it's checked for sideeffects from old code in other handlers
                    //ExamplePresenter presenter = new ExamplePresenter(WebBrowser, (action) => Application.Current.Dispatcher.BeginInvoke(action));
                }

                break;
            }
        }