/// <summary>
        /// Create a new offscreen Chromium with the initial URL of "about:blank".
        /// </summary>
        /// <param name="browserSettings">The browser settings to use.  If null, the default settings are used.</param>
        public ChromiumWebBrowser(BrowserSettings browserSettings = null)
        {
            ResourceHandler = new DefaultResourceHandler();

            Cef.AddDisposable(this);

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
            managedCefBrowserAdapter.CreateOffscreenBrowser(browserSettings ?? new BrowserSettings());
        }
示例#2
0
        private void SetDefaultSettings()
        {
            RequestFormatter  = new ModelAsJsonFormatter();
            ResponseFormatter = new ModelAsJsonFormatter();
            HeadersHandler    = new DefaultHeadersHandler();
            ResourceHandler   = new DefaultResourceHandler();

            DecompressionMethods = DecompressionMethods.Deflate | DecompressionMethods.GZip;
        }
示例#3
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)
        {
            ResourceHandler = new DefaultResourceHandler();

            Cef.AddDisposable(this);
            Address = address;

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
            managedCefBrowserAdapter.CreateOffscreenBrowser(IntPtr.Zero, browserSettings ?? new BrowserSettings(), address);
        }
示例#4
0
        public ChromiumWebBrowser()
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

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

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

            Loaded += OnLoaded;

            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);
            CutCommand        = new DelegateCommand(Cut);
            CopyCommand       = new DelegateCommand(Copy);
            PasteCommand      = new DelegateCommand(Paste);
            SelectAllCommand  = new DelegateCommand(SelectAll);
            UndoCommand       = new DelegateCommand(Undo);
            RedoCommand       = new DelegateCommand(Redo);

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);

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

            ResourceHandler = new DefaultResourceHandler();
            BrowserSettings = new BrowserSettings();

            PresentationSource.AddSourceChangedHandler(this, PresentationSourceChangedHandler);
        }
示例#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);
        }
        public ChromiumWebBrowser(string address)
        {
            Cef.AddDisposable(this);
            Address = address;

            Dock = DockStyle.Fill;

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

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, false);
        }
示例#7
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);
        }
示例#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>
        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);
        }
示例#9
0
        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);
            ResourceHandler = new DefaultResourceHandler();
            BrowserSettings = new BrowserSettings();

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, false);
        }
示例#10
0
        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);
            ResourceHandler = new DefaultResourceHandler();
            BrowserSettings = new BrowserSettings();

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, false);
        }
示例#11
0
		protected void Initialize()
		{
			Application.ApplicationExit += OnApplicationExit;
			Cef.AddDisposable(this);
			// Dock = DockStyle.Fill;

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

			managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
		}
示例#12
0
        public ChromiumWebBrowser()
        {
            if (!Cef.IsInitialized && !Cef.Initialize())
            {
                throw new InvalidOperationException("Cef::Initialize() failed");
            }

            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(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);
            CutCommand = new DelegateCommand(Cut);
            CopyCommand = new DelegateCommand(Copy);
            PasteCommand = new DelegateCommand(Paste);
            SelectAllCommand = new DelegateCommand(SelectAll);
            UndoCommand = new DelegateCommand(Undo);
            RedoCommand = new DelegateCommand(Redo);

            managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);

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

            ResourceHandler = new DefaultResourceHandler();
            BrowserSettings = new BrowserSettings();

            PresentationSource.AddSourceChangedHandler(this, PresentationSourceChangedHandler);
        }