private void Init() { if (_Runing) { return; } _Runing = true; _WpfThread.Dispatcher.Invoke(() => CefCoreSessionSingleton.GetAndInitIfNeeded()); _WpfThread.OnThreadEnded += (o, e) => CefCoreSessionSingleton.Clean(); }
private Task <TestCefGlueHTMLWindowProvider> InitTask(string ipath) { TaskCompletionSource <TestCefGlueHTMLWindowProvider> tcs = new TaskCompletionSource <TestCefGlueHTMLWindowProvider>(); Task.Run(() => { CefCoreSessionSingleton.GetAndInitIfNeeded(); CefWindowInfo cefWindowInfo = CefWindowInfo.Create(); cefWindowInfo.SetAsWindowless(IntPtr.Zero, true); // Settings for the browser window itself (e.g. enable JavaScript?). var cefBrowserSettings = new CefBrowserSettings(); // Initialize some the cust interactions with the browser process. var cefClient = new TestCefClient(); ipath = ipath ?? "javascript\\index.html"; string fullpath = string.Format("{0}\\{1}", Assembly.GetExecutingAssembly().GetPath(), ipath); // Start up the browser instance. CefBrowserHost.CreateBrowser(cefWindowInfo, cefClient, cefBrowserSettings, fullpath); cefClient.GetLoadedBroserAsync().ContinueWith(t => { var frame = t.Result.GetMainFrame(); var context = CefCoreSessionSingleton.Session.CefApp.GetContext(frame); _Father._ICefGlueWindow = new TestCefGlueHTMLWindowProvider(frame); tcs.SetResult(_Father._ICefGlueWindow); } ); } ); return(tcs.Task); }
public CefGlueWPFWebWindowFactory(CefSettings iCefSettings = null) { _ICefCoreSession = CefCoreSessionSingleton.GetAndInitIfNeeded(iCefSettings); }
public CefGlueWPFWebWindowFactory(IWebSessionLogger logger = null, CefSettings iCefSettings = null) { WebSessionLogger = logger; _ICefCoreSession = CefCoreSessionSingleton.GetAndInitIfNeeded(iCefSettings); }