Пример #1
0
        public void InitCefBrowser(AsyncJsObject asyncJsObject, string uri)
        {
            var cefConfig = CefConfig.Default;

            Browser         = cefConfig.CreateChromiumWebBrowser(true, asyncJsObject);
            Browser.Address = uri;
        }
Пример #2
0
        public static CefViewHelper Create(AsyncJsObject asyncJsObject, string uri)
        {
            var cefViewHelper = new CefViewHelper();

            cefViewHelper.InitCefBrowser(asyncJsObject, uri);
            return(cefViewHelper);
        }
Пример #3
0
        public ChromiumWebBrowser CreateChromiumWebBrowser(bool autoInit, AsyncJsObject asyncJsObject)
        {
            if (!Initialized)
            {
                if (!autoInit)
                {
                    throw new InvalidOperationException("Cef is not be initialized!");
                }

                var defaultCefSettings = CreateDefaultCefSettings();
                Init(defaultCefSettings);
            }
            var chromiumWebBrowser = new ChromiumWebBrowser();

            //add F12 dev tool
            chromiumWebBrowser.KeyboardHandler = new CefKeyBoardHandler();

            if (asyncJsObject != null)
            {
                chromiumWebBrowser.RegisterAsyncJsObject(asyncJsObject.Name, asyncJsObject.BindObject, (BindingOptions)asyncJsObject.BindingOptions);
            }
            return(chromiumWebBrowser);
        }