Ejemplo n.º 1
0
 public PrintManager(PrintDocument Document, IWebKitBrowserHost Owner, IWebKitBrowser Browser, bool Preview)
 {
     this._document        = Document;
     this._owner           = Owner;
     this._browser         = Browser;
     this._webFramePrivate =
         (IWebFramePrivate)((IWebView)_browser.GetWebView()).mainFrame();
     this._preview = Preview;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the specified host.
        /// </summary>
        /// <param name="host">The host.</param>
        public void Initialize(IWebKitBrowserHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }

            this.host = host;

            if (!host.InDesignMode)
            {
                // Control Events
                this.host.Load   += WebKitBrowser_Load;
                this.host.Resize += WebKitBrowser_Resize;

                // If this is the first time the library has been loaded,
                // initialize the activation context required to load the
                // WebKit COM component registration free.
                if (Interlocked.Increment(ref actCtxRefCount) == 1)
                {
                    FileInfo fi           = new FileInfo(Assembly.GetExecutingAssembly().Location);
                    string   manifestPath = Path.Combine(fi.DirectoryName, "WebKitBrowser.dll.manifest");
                    if (string.IsNullOrEmpty(manifestPath))
                    {
                        throw new ApplicationException("Failed to locate 'WebKitBrowser.dll.manifest' file.");
                    }

                    activationContext = new ActivationContext(manifestPath);
                    activationContext.Initialize();

                    // TODO: more error handling here

                    // Enable OLE for drag and drop functionality - WebKit
                    // will throw an OutOfMemory exception if we don't...
                    Application.OleRequired();
                }

                // If this control is brought to focus, focus our webkit child window.
                this.host.GotFocus += (s, e) => NativeMethods.SetFocus(webViewHWND);

                activationContext.Activate();
                webView = new WebViewClass();
                activationContext.Deactivate();
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebKitBrowserCore"/> class.
 /// </summary>
 /// <param name="webKitBrowserHost">The web kit browser host.</param>
 private WebKitBrowserCore(IWebKitBrowserHost webKitBrowserHost)
 {
     PageSettings = new PageSettings();
     Initialize(webKitBrowserHost);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes the specified host.
        /// </summary>
        /// <param name="host">The host.</param>
        public void Initialize(IWebKitBrowserHost host)
        {
            if(host == null)
                throw new ArgumentNullException("host");

            this.host = host;

            if(!host.InDesignMode)
            {
                // Control Events            
                this.host.Load += new EventHandler(WebKitBrowser_Load);
                this.host.Resize += new EventHandler(WebKitBrowser_Resize);

                // If this is the first time the library has been loaded,
                // initialize the activation context required to load the
                // WebKit COM component registration free
                if((actCtxRefCount++) == 0)
                {
                    FileInfo fi = new FileInfo(Assembly.GetExecutingAssembly().Location);
                    activationContext = new ActivationContext(Path.Combine(fi.DirectoryName, "WebKitBrowser.dll.manifest"));
                    activationContext.Initialize();

                    // TODO: more error handling here

                    // Enable OLE for drag and drop functionality - WebKit
                    // will throw an OutOfMemory exception if we don't...
                    Application.OleRequired();
                }

                // If this control is brought to focus, focus our webkit child window
                this.host.GotFocus += (s, e) =>
                {
                    NativeMethods.SetFocus(webViewHWND);
                };

                activationContext.Activate();
                webView = new WebViewClass();
                activationContext.Deactivate();
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WebKitBrowserCore"/> class.
 /// </summary>
 /// <param name="webKitBrowserHost">The web kit browser host.</param>
 private WebKitBrowserCore(IWebKitBrowserHost webKitBrowserHost)
 {
     PageSettings = new PageSettings();
     Initialize(webKitBrowserHost);
 }