protected override void Dispose(bool disposing)
        {
            Cef.RemoveDisposable(this);

            if (disposing)
            {
                if (managedCefBrowserAdapter != null)
                {
                    managedCefBrowserAdapter.Dispose();
                    managedCefBrowserAdapter = null;
                }
            }
            base.Dispose(disposing);
        }
Example #2
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");
            }

            ResourceHandler = new DefaultResourceHandler();

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
            managedCefBrowserAdapter.CreateOffscreenBrowser(IntPtr.Zero, browserSettings ?? new 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);
        }
Example #4
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>
        /// <param name="requestcontext">See <see cref="RequestContext"/> for more details. Defaults to null</param>
        public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null, RequestContext requestcontext = null)
        {
            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);
            managedCefBrowserAdapter.CreateOffscreenBrowser(IntPtr.Zero, BrowserSettings, RequestContext, address);
        }
Example #5
0
		protected void Initialize()
		{
			Application.ApplicationExit += OnApplicationExit;
			Cef.AddDisposable(this);
			// Dock = DockStyle.Fill;

			FocusHandler = new DefaultFocusHandler(this);
			ResourceHandler = new DefaultResourceHandler();

			managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
		}
Example #6
0
        protected override void Dispose(bool disposing)
        {
            // Don't utilize any of the handlers anymore:
            this.SetHandlersToNull();

            Cef.RemoveDisposable(this);

            if (disposing)
            {
                IsBrowserInitialized = false;

                if (BrowserSettings != null)
                {
                    BrowserSettings.Dispose();
                    BrowserSettings = null;
                }

                if (parentFormMessageInterceptor != null)
                {
                    parentFormMessageInterceptor.Dispose();
                    parentFormMessageInterceptor = null;
                }

                if (managedCefBrowserAdapter != null)
                {
                    managedCefBrowserAdapter.Dispose();
                    managedCefBrowserAdapter = null;
                }

                // Don't maintain a reference to event listeners anylonger:
                LoadError = null;
                FrameLoadStart = null;
                FrameLoadEnd = null;
                LoadingStateChanged = null;
                ConsoleMessage = null;
                StatusMessage = null;
                AddressChanged = null;
                TitleChanged = null;
                IsBrowserInitializedChanged = null;
            }
            base.Dispose(disposing);
        }
Example #7
0
        protected override void Dispose(bool disposing)
        {
            // Don't utilize any of the handlers anymore:
            DialogHandler = null;
            JsDialogHandler = null;
            KeyboardHandler = null;
            RequestHandler = null;
            DownloadHandler = null;
            LifeSpanHandler = null;
            MenuHandler = null;
            DragHandler = null;
            GeolocationHandler = null;
            FocusHandler = null;
            ResourceHandlerFactory = null;

            Cef.RemoveDisposable(this);

            if (disposing)
            {
                IsBrowserInitialized = false;

                if (BrowserSettings != null)
                {
                    BrowserSettings.Dispose();
                    BrowserSettings = null;
                }

                if (parentFormMessageInterceptor != null)
                {
                    parentFormMessageInterceptor.Dispose();
                    parentFormMessageInterceptor = null;
                }

                if (managedCefBrowserAdapter != null)
                {
                    managedCefBrowserAdapter.Dispose();
                    managedCefBrowserAdapter = null;
                }

                // Don't maintain a reference to event listeners anylonger:
                LoadError = null;
                FrameLoadStart = null;
                FrameLoadEnd = null;
                NavStateChanged = null;
                ConsoleMessage = null;
                StatusMessage = null;
                AddressChanged = null;
                TitleChanged = null;
                IsBrowserInitializedChanged = null;
                IsLoadingChanged = null;
            }
            base.Dispose(disposing);
        }
Example #8
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>
        /// <param name="requestContext">See <see cref="RequestContext" /> for more details. Defaults to null</param>
        /// <param name="automaticallyCreateBrowser">automatically create the underlying Browser</param>
        /// <param name="blendPopup">Should the popup be blended in the background in the rendering</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");
            }

            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);
            }

            popupPosition = new Point();
            popupSize = new Size();
        }
        public ChromiumWebBrowser()
        {
            Cef.AddDisposable(this);
            Focusable = true;
            FocusVisualStyle = null;
            IsTabStop = true;

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

            Loaded += OnLoaded;
            Unloaded += OnUnloaded;

            GotKeyboardFocus += OnGotKeyboardFocus;
            LostKeyboardFocus += OnLostKeyboardFocus;

            IsVisibleChanged += OnIsVisibleChanged;

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

            BackCommand = new DelegateCommand(Back, () => CanGoBack);
            ForwardCommand = new DelegateCommand(Forward, () => CanGoForward);
            ReloadCommand = new DelegateCommand(Reload, () => CanReload);
            PrintCommand = new DelegateCommand(Print);
            ZoomInCommand = new DelegateCommand(ZoomIn);
            ZoomOutCommand = new DelegateCommand(ZoomOut);
            ZoomResetCommand = new DelegateCommand(ZoomReset);
            ViewSourceCommand = new DelegateCommand(ViewSource);
            CleanupCommand = new DelegateCommand(Dispose);
            StopCommand = new DelegateCommand(Stop);

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
            managedCefBrowserAdapter.CreateOffscreenBrowser(BrowserSettings ?? new BrowserSettings());

            disposables.Add(managedCefBrowserAdapter);

            disposables.Add(new DisposableEventWrapper(this, ActualHeightProperty, OnActualSizeChanged));
            disposables.Add(new DisposableEventWrapper(this, ActualWidthProperty, OnActualSizeChanged));
        }
Example #10
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            // Don't reference event listeners any longer:
            LoadError = null;
            FrameLoadStart = null;
            FrameLoadEnd = null;
            ConsoleMessage = null;
            BrowserInitialized = null;
            StatusMessage = null;
            LoadingStateChanged = null;
            AddressChanged = null;

            Cef.RemoveDisposable(this);

            if (disposing)
            {
                browser = null;
                IsBrowserInitialized = false;

                if (Bitmap != null)
                {
                    Bitmap.Dispose();
                    Bitmap = null;
                }

                if (BrowserSettings != null)
                {
                    BrowserSettings.Dispose();
                    BrowserSettings = null;
                }

                if (managedCefBrowserAdapter != null)
                {
                    if (!managedCefBrowserAdapter.IsDisposed)
                    {
                        managedCefBrowserAdapter.Dispose();
                    }
                    managedCefBrowserAdapter = null;
                }
            }

            // Release reference to handlers, make sure this is done after we dispose managedCefBrowserAdapter
            // otherwise the ILifeSpanHandler.DoClose will not be invoked. (More important in the WinForms version,
            // we do it here for consistency)
            this.SetHandlersToNull();
        }
        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);
        }
        protected virtual void Dispose(bool isdisposing)
        {
            Loaded -= OnLoaded;
            Unloaded -= OnUnloaded;

            GotKeyboardFocus -= OnGotKeyboardFocus;
            LostKeyboardFocus -= OnLostKeyboardFocus;

            IsVisibleChanged -= OnIsVisibleChanged;

            Cef.RemoveDisposable(this);

            RemoveSourceHook();

            foreach (var disposable in disposables)
            {
                disposable.Dispose();
            }
            disposables.Clear();

            UiThreadRunAsync(() => WebBrowser = null);
            managedCefBrowserAdapter = null;
            ConsoleMessage = null;
            FrameLoadStart = null;
            FrameLoadEnd = null;
            LoadError = null;
        }
Example #13
0
 protected override void OnHandleCreated(EventArgs e)
 {
     base.OnHandleCreated(e);
     managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
     managedCefBrowserAdapter.CreateBrowser(BrowserSettings ?? new BrowserSettings(), Handle, Address);
 }
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.Control" /> and its child controls and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            Cef.RemoveDisposable(this);

            if (disposing)
            {
                browser = null;
                IsBrowserInitialized = false;

                if (BrowserSettings != null)
                {
                    BrowserSettings.Dispose();
                    BrowserSettings = null;
                }

                if (parentFormMessageInterceptor != null)
                {
                    parentFormMessageInterceptor.Dispose();
                    parentFormMessageInterceptor = null;
                }

                if (managedCefBrowserAdapter != null)
                {
                    managedCefBrowserAdapter.Dispose();
                    managedCefBrowserAdapter = null;
                }

                // Don't maintain a reference to event listeners anylonger:
                LoadError = null;
                FrameLoadStart = null;
                FrameLoadEnd = null;
                LoadingStateChanged = null;
                ConsoleMessage = null;
                StatusMessage = null;
                AddressChanged = null;
                TitleChanged = null;
                IsBrowserInitializedChanged = null;
            }

            // Release reference to handlers, make sure this is done after we dispose managedCefBrowserAdapter
            // otherwise the ILifeSpanHandler.DoClose will not be invoked.
            this.SetHandlersToNull();

            base.Dispose(disposing);
        }
Example #15
0
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (managedCefBrowserAdapter != null)
         {
             managedCefBrowserAdapter.Close();
             managedCefBrowserAdapter.Dispose();
             managedCefBrowserAdapter = null;
         }
     }
     base.Dispose(disposing);
 }
Example #16
0
        protected virtual void Dispose(bool disposing)
        {
            // Don't reference handlers any longer:
            ResourceHandler = null;
            JsDialogHandler = null;
            DialogHandler = null;
            DownloadHandler = null;
            KeyboardHandler = null;
            LifeSpanHandler = null;
            MenuHandler = null;
            FocusHandler = null;
            RequestHandler = null;
            DragHandler = null;
            GeolocationHandler = null;

            // Don't reference event listeners any longer:
            LoadError = null;
            FrameLoadStart = null;
            FrameLoadEnd = null;
            ConsoleMessage = null;
            BrowserInitialized = null;
            StatusMessage = null;
            NavStateChanged = null;

            Cef.RemoveDisposable(this);

            if (disposing)
            {
                if (bitmap != null)
                {
                    bitmap.Dispose();
                    bitmap = null;
                }

                if (managedCefBrowserAdapter != null)
                {
                    if (!managedCefBrowserAdapter.IsDisposed)
                    {
                        managedCefBrowserAdapter.Dispose();
                    }
                    managedCefBrowserAdapter = null;
                }
            }
        }
Example #17
0
        private void OnApplicationExit(object sender, EventArgs e)
        {
            if (managedCefBrowserAdapter == null)
            {
                return;
            }

            managedCefBrowserAdapter.Close();
            managedCefBrowserAdapter.Dispose();
            managedCefBrowserAdapter = null;

            Cef.Shutdown();
        }
Example #18
0
        protected virtual void Dispose(bool isdisposing)
        {
            // No longer reference event listeners:
            ConsoleMessage = null;
            FrameLoadStart = null;
            FrameLoadEnd = null;
            LoadError = null;
            NavStateChanged = null;

            // No longer reference handlers:
            ResourceHandler = null;
            DialogHandler = null;
            JsDialogHandler = null;
            KeyboardHandler = null;
            RequestHandler = null;
            DownloadHandler = null;
            LifeSpanHandler = null;
            MenuHandler = null;
            FocusHandler = null;
            DragHandler = null;
            GeolocationHandler = null;
            Rendering = null;

            if (isdisposing)
            {
                if (BrowserSettings != null)
                {
                    BrowserSettings.Dispose();
                    BrowserSettings = null;
                }

                PresentationSource.RemoveSourceChangedHandler(this, PresentationSourceChangedHandler);

                // Release internal event listeners:
                Loaded -= OnLoaded;
                GotKeyboardFocus -= OnGotKeyboardFocus;
                LostKeyboardFocus -= OnLostKeyboardFocus;

                // Release internal event listeners for Drag Drop events:
                DragEnter -= OnDragEnter;
                DragOver -= OnDragOver;
                DragLeave -= OnDragLeave;
                Drop -= OnDrop;

                IsVisibleChanged -= OnIsVisibleChanged;

                foreach (var disposable in disposables)
                {
                    disposable.Dispose();
                }
                disposables.Clear();
                UiThreadRunAsync(() => WebBrowser = null);
            }

            Cef.RemoveDisposable(this);

            managedCefBrowserAdapter = null;
        }
Example #19
0
        public WebView()
        {
            Focusable = true;
            FocusVisualStyle = null;
            IsTabStop = true;

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

            Loaded += OnLoaded;
            Unloaded += OnUnloaded;

            this.IsVisibleChanged += OnIsVisibleChanged;

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

            BackCommand = new DelegateCommand(Back, CanGoBack);
            ForwardCommand = new DelegateCommand(Forward, CanGoForward);
            ReloadCommand = new DelegateCommand(Reload, CanReload);

            browserCore = new BrowserCore("about:blank");
            browserCore.PropertyChanged += OnBrowserCorePropertyChanged;
            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
            managedCefBrowserAdapter.CreateOffscreenBrowser(BrowserSettings ?? new BrowserSettings());

            disposables.Add(managedCefBrowserAdapter);

            disposables.Add(new DisposableEventWrapper(this, ActualHeightProperty, OnActualSizeChanged));
            disposables.Add(new DisposableEventWrapper(this, ActualWidthProperty, OnActualSizeChanged));
        }
        protected virtual void Dispose(bool isdisposing)
        {
            // No longer reference event listeners:
            ConsoleMessage = null;
            FrameLoadStart = null;
            FrameLoadEnd = null;
            LoadError = null;
            LoadingStateChanged = null;
            Rendering = null;

            // No longer reference handlers:
            this.SetHandlersToNull();

            if (isdisposing)
            {
                if (BrowserSettings != null)
                {
                    BrowserSettings.Dispose();
                    BrowserSettings = null;
                }

                PresentationSource.RemoveSourceChangedHandler(this, PresentationSourceChangedHandler);

                // Release internal event listeners:
                Loaded -= OnLoaded;
                GotKeyboardFocus -= OnGotKeyboardFocus;
                LostKeyboardFocus -= OnLostKeyboardFocus;

                // Release internal event listeners for Drag Drop events:
                DragEnter -= OnDragEnter;
                DragOver -= OnDragOver;
                DragLeave -= OnDragLeave;
                Drop -= OnDrop;

                IsVisibleChanged -= OnIsVisibleChanged;

                if (tooltipTimer != null)
                {
                    tooltipTimer.Tick -= OnTooltipTimerTick;
                }

                if (CleanupElement != null)
                {
                    CleanupElement.Unloaded -= OnCleanupElementUnloaded;
                }

                foreach (var disposable in disposables)
                {
                    disposable.Dispose();
                }
                disposables.Clear();
                UiThreadRunAsync(() => WebBrowser = null);
            }

            Cef.RemoveDisposable(this);

            RemoveSourceHook();

            managedCefBrowserAdapter = null;
        }
Example #21
0
        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="isDisposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool isDisposing)
        {
            //Check if already disposed
            if (Interlocked.Increment(ref disposeCount) == 1)
            {
                // No longer reference event listeners:
                ConsoleMessage = null;
                FrameLoadStart = null;
                FrameLoadEnd = null;
                LoadError = null;
                LoadingStateChanged = null;
                Rendering = null;

                if (isDisposing)
                {
                    browser = null;
                    if (BrowserSettings != null)
                    {
                        BrowserSettings.Dispose();
                        BrowserSettings = null;
                    }

                    PresentationSource.RemoveSourceChangedHandler(this, PresentationSourceChangedHandler);

                    // Release internal event listeners:
                    Loaded -= OnLoaded;
                    SizeChanged -= OnActualSizeChanged;
                    GotKeyboardFocus -= OnGotKeyboardFocus;
                    LostKeyboardFocus -= OnLostKeyboardFocus;

                    // Release internal event listeners for Drag Drop events:
                    DragEnter -= OnDragEnter;
                    DragOver -= OnDragOver;
                    DragLeave -= OnDragLeave;
                    Drop -= OnDrop;

                    IsVisibleChanged -= OnIsVisibleChanged;

                    if (tooltipTimer != null)
                    {
                        tooltipTimer.Tick -= OnTooltipTimerTick;
                    }

                    if (CleanupElement != null)
                    {
                        CleanupElement.Unloaded -= OnCleanupElementUnloaded;
                    }

                    if(managedCefBrowserAdapter != null)
                    {
                        managedCefBrowserAdapter.Dispose();
                        managedCefBrowserAdapter = null;
                    }

                    browserInitialized = false;
                    UiThreadRunAsync(() =>
                    {
                        SetCurrentValue(IsBrowserInitializedProperty, false);
                        WebBrowser = null;
                    });
                }

                // Release reference to handlers, make sure this is done after we dispose managedCefBrowserAdapter
                // otherwise the ILifeSpanHandler.DoClose will not be invoked. (More important in the WinForms version,
                // we do it here for consistency)
                this.SetHandlersToNull();

                Cef.RemoveDisposable(this);

                RemoveSourceHook();
            }
        }
        protected virtual void Dispose(bool disposing)
        {
            // Don't reference handlers any longer:
            this.SetHandlersToNull();

            // Don't reference event listeners any longer:
            LoadError = null;
            FrameLoadStart = null;
            FrameLoadEnd = null;
            ConsoleMessage = null;
            BrowserInitialized = null;
            StatusMessage = null;
            LoadingStateChanged = null;
            AddressChanged = null;

            Cef.RemoveDisposable(this);

            if (disposing)
            {
                IsBrowserInitialized = false;

                if (bitmap != null)
                {
                    bitmap.Dispose();
                    bitmap = null;
                }

                if (BrowserSettings != null)
                {
                    BrowserSettings.Dispose();
                    BrowserSettings = null;
                }

                if (managedCefBrowserAdapter != null)
                {
                    if (!managedCefBrowserAdapter.IsDisposed)
                    {
                        managedCefBrowserAdapter.Dispose();
                    }
                    managedCefBrowserAdapter = null;
                }
            }
        }
        protected virtual void Dispose(bool isdisposing)
        {
            Cef.RemoveDisposable(this);

            foreach (var disposable in disposables)
            {
                disposable.Dispose();
            }
            disposables.Clear();

            RemoveSourceHook();

            WebBrowser = null;
            managedCefBrowserAdapter = null;
            ConsoleMessage = null;
            FrameLoadStart = null;
            FrameLoadEnd = null;
            LoadError = null;
        }