示例#1
0
        private void Init()
        {
            if (_Runing)
            {
                return;
            }

            _Runing = true;
            _WpfThread.Dispatcher.Invoke(() => CefCoreSessionSingleton.GetAndInitIfNeeded());
            _WpfThread.OnThreadEnded += (o, e) => CefCoreSessionSingleton.Clean();
        }
示例#2
0
        public bool OnDebugToolsRequest()
        {
            var port = CefCoreSessionSingleton.Get().CefSettings.RemoteDebuggingPort;

            if (port == 0)
            {
                return(false);
            }

            ProcessHelper.OpenLocalUrlInBrowser(port);
            return(true);
        }
            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);
            }
示例#4
0
 public CefGlueWPFWebWindowFactory(CefSettings iCefSettings = null)
 {
     _ICefCoreSession = CefCoreSessionSingleton.GetAndInitIfNeeded(iCefSettings);
 }
 void IDisposable.Dispose()
 {
     CefCoreSessionSingleton.Clean();
 }
示例#6
0
 public CefGlueWPFWebWindowFactory(IWebSessionLogger logger = null, CefSettings iCefSettings = null)
 {
     WebSessionLogger = logger;
     _ICefCoreSession = CefCoreSessionSingleton.GetAndInitIfNeeded(iCefSettings);
 }