예제 #1
0
        public void ShowDevTools(IWin32Window parent = null)
        {
            CfxWindowInfo windowInfo = new CfxWindowInfo();

            if (parent == null)
            {
                windowInfo.Style        = WindowStyle.WS_OVERLAPPEDWINDOW | WindowStyle.WS_CLIPCHILDREN | WindowStyle.WS_CLIPSIBLINGS | WindowStyle.WS_VISIBLE;
                windowInfo.ParentWindow = IntPtr.Zero;
                windowInfo.X            = 200;
                windowInfo.Y            = 200;
                windowInfo.Width        = 800;
                windowInfo.Height       = 600;
            }
            else
            {
                var handle = parent.Handle;
                var rect   = new RECT();
                User32.GetClientRect(handle, ref rect);
                windowInfo.SetAsChild(parent.Handle, 0, 0, rect.Width, rect.Height);
                windowInfo.ParentWindow = handle;
            }


            windowInfo.WindowName = "NanUI Developer Tools";



            BrowserHost.ShowDevTools(windowInfo, new DevToolBrowserClient(), new CfxBrowserSettings(), null);
        }
예제 #2
0
        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);
            WebBrowserCore = new BrowserCore(this, BrowserHostWindow.StartUrl);
            WebBrowserCore.BrowserCreated += BrowserCreated;
            var windowInfo = new CfxWindowInfo();

            windowInfo.SetAsChild(Handle, 0, 0, Width, Height);
            WebBrowserCore.Create(windowInfo);
        }
예제 #3
0
        /// <summary>
        /// Creates the underlying CfxBrowser with the given CfxRequestContext.
        /// This method should only be called if this ChromiumWebBrowser
        /// was instanciated with createImmediately == false.
        /// </summary>
        public void CreateBrowser(CfxRequestContext requestContext)
        {
            // avoid illegal cross-thread calls
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)(() => CreateBrowser(requestContext)));
                return;
            }

            var windowInfo = new CfxWindowInfo();

            windowInfo.SetAsChild(Handle, 0, 0, Height > 0 ? Height : 500, Width > 0 ? Width : 500);
            if (!CfxBrowserHost.CreateBrowser(windowInfo, client, initialUrl, DefaultBrowserSettings, requestContext))
            {
                throw new ChromiumWebBrowserException("Failed to create browser instance.");
            }
        }
예제 #4
0
        /// <summary>
        /// Creates the underlying CfxBrowser with the given CfxRequestContext.
        /// This method should only be called if this ChromiumWebBrowser
        /// was instanciated with createImmediately == false.
        /// </summary>
        public void CreateBrowser(CfxRequestContext requestContext)
        {
            // avoid illegal cross-thread calls
            if (InvokeRequired)
            {
                Invoke((MethodInvoker)(() => CreateBrowser(requestContext)));
                return;
            }

            var windowInfo = new CfxWindowInfo();
            windowInfo.SetAsChild(Handle, 0, 0, Height > 0 ? Height : 500, Width > 0 ? Width : 500);

            if (!CfxBrowserHost.CreateBrowser(windowInfo, client, initialUrl, HtmlUILauncher.DefaultBrowserSettings, requestContext))
                throw new HtmlUIException("Failed to create browser instance.");
        }