Exemple #1
0
        private void InitializeFieldsAndCefIfRequired()
        {
            if (!initialized)
            {
                if (!Cef.IsInitialized && !Cef.Initialize())
                {
                    throw new InvalidOperationException("Cef::Initialize() failed");
                }

                Cef.AddDisposable(this);

                if (FocusHandler == null)
                {
                    FocusHandler = new DefaultFocusHandler(this);
                }

                if (ResourceHandlerFactory == null)
                {
                    ResourceHandlerFactory = new DefaultResourceHandlerFactory();
                }

                if (BrowserSettings == null)
                {
                    BrowserSettings = new BrowserSettings();
                }

                managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, false);

                initialized = true;
            }
        }
Exemple #2
0
        private void InitializeFieldsAndCefIfRequired()
        {
            if (!initialized)
            {
                if (!Cef.IsInitialized && !Cef.Initialize())
                {
                    throw new InvalidOperationException("Cef::Initialize() failed");
                }

                Cef.AddDisposable(this);

                if (ResourceHandlerFactory == null)
                {
                    ResourceHandlerFactory = new DefaultResourceHandlerFactory();
                }

                if (BrowserSettings == null)
                {
                    BrowserSettings = new BrowserSettings();
                }

                // To allow cross-origin request.
                // This prevents the error: no 'access-control-allow-origin' header is present on the requested resource for XHR requests.
                BrowserSettings.FileAccessFromFileUrls      = CefState.Enabled;
                BrowserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
                BrowserSettings.WebSecurity = CefState.Enabled;

                managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, false);

                initialized = true;
            }
        }
        public static string RegisterResources(DefaultResourceHandlerFactory factory, string title)
        {
            if (factory == null)
            {
                return(null);
            }

            var previewPath = "http://test/resource/load/questionnaire_preview.html";

            baseFilePath = Path.Combine(RetrieveAppLocation(), "Web");

            Initialize(factory);

            var templateCollection = Directory.GetFiles(Path.Combine(baseFilePath, "templates"), "*.*", SearchOption.AllDirectories);

            foreach (var item in templateCollection)
            {
                factory.RegisterHandler(string.Format(CultureInfo.InvariantCulture, "{0}", item.Replace(baseFilePath, basePath).Replace("\\", "/")), ResourceHandler.FromFilePath(item));
            }

            var htmlPage = GetQuestionnaireHtml(title);

            factory.RegisterHandler(previewPath, ResourceHandler.FromString(htmlPage));
            ClearAll();

            return(previewPath);
        }
Exemple #4
0
        public FormNotificationBase(Form owner, bool enableContextMenu)
        {
            InitializeComponent();

            this.owner             = owner;
            this.owner.FormClosed += owner_FormClosed;

            this.browser = new ChromiumWebBrowser("about:blank")
            {
                MenuHandler     = new ContextMenuNotification(this, enableContextMenu),
                LifeSpanHandler = new LifeSpanHandler()
            };

            this.browser.Dock       = DockStyle.None;
            this.browser.ClientSize = ClientSize;
            this.browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;

            #if DEBUG
            this.browser.ConsoleMessage += BrowserUtils.HandleConsoleMessage;
            #endif

            DefaultResourceHandlerFactory handlerFactory = (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory;
            handlerFactory.RegisterHandler("https://tweetdeck.twitter.com", this.resourceHandler);

            Controls.Add(browser);

            Disposed += (sender, args) => {
                this.browser.Dispose();
                this.owner.FormClosed -= owner_FormClosed;
            };

            // ReSharper disable once VirtualMemberCallInContructor
            UpdateTitle();
        }
        private static void InitializeTypeScriptCollection(DefaultResourceHandlerFactory factory)
        {
            typeScriptCollection.Add("jsout/base/app.js");
            typeScriptCollection.Add("jsout/base/app.config.js");
            typeScriptCollection.Add("jsout/base/app.run.js");
            typeScriptCollection.Add("jsout/base/app.controller.js");
            typeScriptCollection.Add("Js/ExpandCollapseBehaviour.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-helper.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-resources.js");
            typeScriptCollection.Add("jsout/typescripts/document-manager-resources.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-constants.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-entity.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-helper.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-item-type.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-item.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-kendo-wrapper.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-preview-base.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-preview-components.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-preview-controller.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-question.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-resources.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-rule-engine.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-rule.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-section.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-table.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-text-help.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-text-instruction.js");
            typeScriptCollection.Add("jsout/typescripts/questionnaire-text-warning.js");

            foreach (var item in typeScriptCollection)
            {
                var filePath = Path.Combine(baseFilePath, item);
                factory.RegisterHandler(basePath + "/" + item, ResourceHandler.FromFilePath(filePath));
            }
        }
        private static void InitializeImageCollection(DefaultResourceHandlerFactory factory)
        {
            imageCollection.Add("images/icon-close.svg");
            imageCollection.Add("images/icon-refresh.svg");
            imageCollection.Add("images/icon-arrow-right.svg");
            imageCollection.Add("images/icon-dots.svg");
            imageCollection.Add("images/icon-questionnaire-warning.svg");

            imageCollection.Add("css/Material/sprite_2x.png");
            imageCollection.Add("css/Material/sprite.png");
            imageCollection.Add("css/Material/loading.gif");

            imageCollection.Add("css/fonts/proximanova-regularit.ttf");
            imageCollection.Add("css/fonts/proximanova-regular.woff");
            imageCollection.Add("packages/kendo/styles/fonts/glyphs/WebComponentsIcons.woff");
            imageCollection.Add("packages/kendo/styles/fonts/glyphs/WebComponentsIcons.ttf");

            foreach (var item in imageCollection)
            {
                var filePath = Path.Combine(baseFilePath, item);
                if (Path.GetExtension(filePath).Equals(".svg", StringComparison.OrdinalIgnoreCase))
                {
                    factory.RegisterHandler(basePath + "/" + item, ResourceHandler.FromFilePath(filePath, "image/svg+xml"));
                }
                else
                {
                    factory.RegisterHandler(basePath + "/" + item, ResourceHandler.FromFilePath(filePath));
                }
            }
        }
        private static void InitializeScriptCollection(DefaultResourceHandlerFactory factory)
        {
            var currentCulture = CultureInfo.CurrentCulture;

            scriptCollection.Add("packages/jquery/jquery-1.9.1.js");
            scriptCollection.Add("packages/bootstrap/scripts/bootstrap.js");
            scriptCollection.Add("packages/angular-core/angular.js");
            scriptCollection.Add("packages/angular-route/angular-route.js");
            scriptCollection.Add("packages/angular-ui-router/angular-ui-router.js");
            scriptCollection.Add("packages/ng-storage/ngStorage.min.js");
            scriptCollection.Add("packages/angular-bootstrap/scripts/angular-ui/ui-bootstrap.js");
            scriptCollection.Add("packages/angular-bootstrap/scripts/angular-ui/ui-bootstrap-tpls.js");
            scriptCollection.Add("packages/misc/jquery.mCustomScrollbar.concat.min.js");
            scriptCollection.Add("packages/misc/scrollbars.js");
            scriptCollection.Add("packages/angular-loading-bar/scripts/loading-bar.js");
            scriptCollection.Add("packages/misc/ocLazyLoad.js");
            scriptCollection.Add("packages/kendo/js/kendo.all.min.js");
            scriptCollection.Add("packages/kendo/js/kendo.grid.min.js");
            if (currentCulture != null && currentCulture.ToString() != "en-US")
            {
                scriptCollection.Add("packages/kendo/cultures/kendo.culture." + currentCulture + ".min.js");
            }

            foreach (var item in scriptCollection)
            {
                var filePath = Path.Combine(baseFilePath, item);
                factory.RegisterHandler(basePath + "/" + item, ResourceHandler.FromFilePath(filePath));
            }
        }
        private static void InitializeStyleCollection(DefaultResourceHandlerFactory factory)
        {
            styleCollection.Add("packages/bootstrap/content/bootstrap.css");
            styleCollection.Add("packages/bootstrap/content/bootstrap-theme.css");
            styleCollection.Add("packages/angular-loading-bar/content/loading-bar.css");
            styleCollection.Add("packages/angular-loading-bar/content/loading-bar.min.css");
            styleCollection.Add("packages/angular-bootstrap/content/ui-bootstrap-csp.css");
            styleCollection.Add("packages/kendo/styles/kendo.common-material.css");
            styleCollection.Add("packages/kendo/styles/kendo.material.css");
            styleCollection.Add("css/_context-menu.css");
            styleCollection.Add("css/_utilities.css");
            styleCollection.Add("css/edit-questionnaire.css");
            styleCollection.Add("css/form.css");
            styleCollection.Add("css/kendo-editor-override.css");
            styleCollection.Add("css/main.css");
            styleCollection.Add("css/sub-header.css");
            styleCollection.Add("css/toggle-switch.css");
            styleCollection.Add("css/dm.css");
            styleCollection.Add("css/question-preview.css");

            foreach (var item in styleCollection)
            {
                var filePath = Path.Combine(baseFilePath, item);
                factory.RegisterHandler(basePath + "/" + item, ResourceHandler.FromFilePath(filePath));
            }
        }
        /// <summary>
        /// Create a new OffScreen Chromium Browser
        /// </summary>
        /// <param name="address">Initial address (url) to load</param>
        /// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
        /// <param name="requestContext">See <see cref="RequestContext" /> for more details. Defaults to null</param>
        /// <param name="automaticallyCreateBrowser">automatically create the underlying Browser</param>
        /// <exception cref="System.InvalidOperationException">Cef::Initialize() failed</exception>
        public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null,
                                  RequestContext requestContext = null, bool automaticallyCreateBrowser = true)
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings        = browserSettings ?? new BrowserSettings();
            RequestContext         = requestContext;

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);

            if (automaticallyCreateBrowser)
            {
                CreateBrowser(IntPtr.Zero);
            }

            BitmapBuffer  = new BitmapBuffer(BitmapLock);
            PopupBuffer   = new BitmapBuffer(BitmapLock);
            popupPosition = new Point();
            popupSize     = new Size();
        }
        /// <summary>
        /// Create a new OffScreen Chromium Browser. If you use <see cref="CefSharpSettings.LegacyJavascriptBindingEnabled"/> = true then you must
        /// set <paramref name="automaticallyCreateBrowser"/> to false and call <see cref="CreateBrowser"/> after the objects are registered.
        /// </summary>
        /// <param name="address">Initial address (url) to load</param>
        /// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
        /// <param name="requestContext">See <see cref="RequestContext" /> for more details. Defaults to null</param>
        /// <param name="automaticallyCreateBrowser">automatically create the underlying Browser</param>
        /// <exception cref="System.InvalidOperationException">Cef::Initialize() failed</exception>
        public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null,
                                  RequestContext requestContext = null, bool automaticallyCreateBrowser = true)
        {
            if (!Cef.IsInitialized)
            {
                var settings = new CefSettings();
                settings.WindowlessRenderingEnabled = true;

                if (!Cef.Initialize(settings))
                {
                    throw new InvalidOperationException("Cef::Initialize() failed");
                }
            }

            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings        = browserSettings ?? new BrowserSettings();
            RequestContext         = requestContext;

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);

            if (automaticallyCreateBrowser)
            {
                CreateBrowser(IntPtr.Zero);
            }

            RenderHandler = new DefaultRenderHandler(this);
        }
        private static void Initialize(DefaultResourceHandlerFactory factory)
        {
            InitializeStyleCollection(factory);
            InitializeScriptCollection(factory);
            InitializeTypeScriptCollection(factory);

            InitializeImageCollection(factory);
        }
        /// <summary>
        /// Create a new OffScreen Chromium Browser
        /// </summary>
        /// <param name="address">Initial address (url) to load</param>
        /// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
        public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null)
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings = browserSettings ?? new BrowserSettings();

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
            managedCefBrowserAdapter.CreateOffscreenBrowser(IntPtr.Zero, BrowserSettings, address);
        }
Exemple #13
0
        /// <summary>
        /// Create a new OffScreen Chromium Browser
        /// </summary>
        /// <param name="address">Initial address (url) to load</param>
        /// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
        public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null)
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings        = browserSettings ?? new BrowserSettings();

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
            managedCefBrowserAdapter.CreateOffscreenBrowser(IntPtr.Zero, BrowserSettings, address);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ChromiumWebBrowser"/> class.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <exception cref="System.InvalidOperationException">Cef::Initialize() failed</exception>
        public ChromiumWebBrowser(string address)
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            Cef.AddDisposable(this);
            Address = address;

            Dock = DockStyle.Fill;

            FocusHandler = new DefaultFocusHandler(this);
            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings = new BrowserSettings();

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, false);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ChromiumWebBrowser"/> class.
        /// </summary>
        /// <param name="address">The address.</param>
        /// <exception cref="System.InvalidOperationException">Cef::Initialize() failed</exception>
        public ChromiumWebBrowser(string address)
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            Cef.AddDisposable(this);
            Address = address;

            Dock = DockStyle.Fill;

            FocusHandler           = new DefaultFocusHandler(this);
            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings        = new BrowserSettings();

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, false);
        }
        /// <summary>
        /// Create a new OffScreen Chromium Browser.
        /// </summary>
        /// <param name="height">Height of browser</param>
        /// <param name="address">Initial address (url) to load</param>
        /// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
        /// <param name="requestcontext">See <see cref="RequestContext"/> for more details. Defaults to null</param>
        /// <param name="width">Width of browser</param>
        public ChromiumWebBrowserController(int width = 1366, int height = 768, string address = "",
                                            RequestContext requestcontext = null, BrowserSettings browserSettings = null)
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            size = new Size(width, height);
            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings        = browserSettings ?? new BrowserSettings();
            RequestContext         = requestcontext;

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
            managedCefBrowserAdapter.CreateOffscreenBrowser(IntPtr.Zero, BrowserSettings, RequestContext, address);
        }
Exemple #17
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (GetTemplateChild("PART_Browser") is ChromiumWebBrowser browser)
            {
                _browser = browser;

                _browser.FrameLoadEnd += Browser_FrameLoadEnd;
                _browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
                _browser.ConsoleMessage        += Browser_ConsoleMessage;
                _browser.DownloadHandler        = new UnoDownloadHandler();
                _browser.ResourceHandlerFactory = _handlerFactory = new UnoResourceHandlerFactory();

                RegisterResourceHandlers();

                _browser.JavascriptObjectRepository.ResolveObject += (sender, e) =>
                {
                    var repo = e.ObjectRepository;

                    if (e.ObjectName == "UnoDispatch")
                    {
                        repo.Register("UnoDispatch", new UnoDispatch(), options: BindingOptions.DefaultBinder);
                    }
                };

                var loop = new System.Reactive.Concurrency.EventLoopScheduler();
                Windows.UI.Core.CoreDispatcher.DispatchOverride = d => loop.Schedule(d);

                Uno.Foundation.WebAssemblyRuntime.InvokeJSOverride = InvokeJS;
            }
            else
            {
                throw new InvalidOperationException("Unable to find PART_Browser");
            }
        }
        /// <summary>
        /// Create a new OffScreen Chromium Browser
        /// </summary>
        /// <param name="address">Initial address (url) to load</param>
        /// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
        /// <param name="requestcontext">See <see cref="RequestContext"/> for more details. Defaults to null</param>
        /// <param name="automaticallyCreateBrowser">automatically create the underlying Browser</param>
        public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null,
            RequestContext requestcontext = null, bool automaticallyCreateBrowser = true)
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            BitmapFactory = new BitmapFactory(BitmapLock);

            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings = browserSettings ?? new BrowserSettings();
            RequestContext = requestcontext;

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);

            if(automaticallyCreateBrowser)
            {
                CreateBrowser(IntPtr.Zero);
            }
        }
        public ChromiumWebBrowser()
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            BitmapFactory = new BitmapFactory();

            Cef.AddDisposable(this);
            Focusable = true;
            FocusVisualStyle = null;
            IsTabStop = true;

            Dispatcher.BeginInvoke((Action)(() => WebBrowser = this));

            Loaded += OnLoaded;

            GotKeyboardFocus += OnGotKeyboardFocus;
            LostKeyboardFocus += OnLostKeyboardFocus;

            // Drag Drop events
            DragEnter += OnDragEnter;
            DragOver += OnDragOver;
            DragLeave += OnDragLeave;
            Drop += OnDrop;

            IsVisibleChanged += OnIsVisibleChanged;

            ToolTip = toolTip = new ToolTip();
            toolTip.StaysOpen = true;
            toolTip.Visibility = Visibility.Collapsed;
            toolTip.Closed += OnTooltipClosed;

            BackCommand = new DelegateCommand(this.Back, () => CanGoBack);
            ForwardCommand = new DelegateCommand(this.Forward, () => CanGoForward);
            ReloadCommand = new DelegateCommand(this.Reload, () => !IsLoading);
            PrintCommand = new DelegateCommand(this.Print);
            ZoomInCommand = new DelegateCommand(ZoomIn);
            ZoomOutCommand = new DelegateCommand(ZoomOut);
            ZoomResetCommand = new DelegateCommand(ZoomReset);
            ViewSourceCommand = new DelegateCommand(this.ViewSource);
            CleanupCommand = new DelegateCommand(Dispose);
            StopCommand = new DelegateCommand(this.Stop);
            CutCommand = new DelegateCommand(this.Cut);
            CopyCommand = new DelegateCommand(this.Copy);
            PasteCommand = new DelegateCommand(this.Paste);
            SelectAllCommand = new DelegateCommand(this.SelectAll);
            UndoCommand = new DelegateCommand(this.Undo);
            RedoCommand = new DelegateCommand(this.Redo);

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);

            disposables.Add(managedCefBrowserAdapter);
            disposables.Add(new DisposableEventWrapper(this, ActualHeightProperty, OnActualSizeChanged));
            disposables.Add(new DisposableEventWrapper(this, ActualWidthProperty, OnActualSizeChanged));

            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings = new BrowserSettings();

            PresentationSource.AddSourceChangedHandler(this, PresentationSourceChangedHandler);
        }
Exemple #20
0
        public ChromiumWebBrowser()
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            BitmapFactory = new BitmapFactory();

            Cef.AddDisposable(this);
            Focusable        = true;
            FocusVisualStyle = null;
            IsTabStop        = true;

            Dispatcher.BeginInvoke((Action)(() => WebBrowser = this));

            Loaded += OnLoaded;

            GotKeyboardFocus  += OnGotKeyboardFocus;
            LostKeyboardFocus += OnLostKeyboardFocus;

            // Drag Drop events
            DragEnter += OnDragEnter;
            DragOver  += OnDragOver;
            DragLeave += OnDragLeave;
            Drop      += OnDrop;

            IsVisibleChanged += OnIsVisibleChanged;

            ToolTip            = toolTip = new ToolTip();
            toolTip.StaysOpen  = true;
            toolTip.Visibility = Visibility.Collapsed;
            toolTip.Closed    += OnTooltipClosed;

            BackCommand       = new DelegateCommand(this.Back, () => CanGoBack);
            ForwardCommand    = new DelegateCommand(this.Forward, () => CanGoForward);
            ReloadCommand     = new DelegateCommand(this.Reload, () => !IsLoading);
            PrintCommand      = new DelegateCommand(this.Print);
            ZoomInCommand     = new DelegateCommand(ZoomIn);
            ZoomOutCommand    = new DelegateCommand(ZoomOut);
            ZoomResetCommand  = new DelegateCommand(ZoomReset);
            ViewSourceCommand = new DelegateCommand(this.ViewSource);
            CleanupCommand    = new DelegateCommand(Dispose);
            StopCommand       = new DelegateCommand(this.Stop);
            CutCommand        = new DelegateCommand(this.Cut);
            CopyCommand       = new DelegateCommand(this.Copy);
            PasteCommand      = new DelegateCommand(this.Paste);
            SelectAllCommand  = new DelegateCommand(this.SelectAll);
            UndoCommand       = new DelegateCommand(this.Undo);
            RedoCommand       = new DelegateCommand(this.Redo);

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);

            disposables.Add(managedCefBrowserAdapter);
            disposables.Add(new DisposableEventWrapper(this, ActualHeightProperty, OnActualSizeChanged));
            disposables.Add(new DisposableEventWrapper(this, ActualWidthProperty, OnActualSizeChanged));

            ResourceHandlerFactory = new DefaultResourceHandlerFactory();
            BrowserSettings        = new BrowserSettings();

            PresentationSource.AddSourceChangedHandler(this, PresentationSourceChangedHandler);
        }