Deactivate() 공개 메소드

Deactivates the activation context, activating the next one down on the 'stack'.
public Deactivate ( ) : void
리턴 void
예제 #1
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();
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the WebKitBrowser control.
        /// </summary>
        public WebKitBrowser()
        {
            InitializeComponent();

            PageSettings = new PageSettings();

            if (LicenseManager.UsageMode != LicenseUsageMode.Designtime)
            {
                // Control Events
                this.Load   += new EventHandler(WebKitBrowser_Load);
                this.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(System.Reflection.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.GotFocus += (s, e) =>
                {
                    NativeMethods.SetFocus(webViewHWND);
                };

                activationContext.Activate();
                webView = new WebViewClass();
                activationContext.Deactivate();
            }
        }