private void InitBrowser() { // 初始化内置浏览器 #warning 记得修改 #if DEBUG string htmlPath = "nacollector://html_res/index.html"; #else string htmlPath = "http://127.0.0.1:8080"; #endif crBrowser = new CrBrowser(this, htmlPath); // Need Update: https://github.com/cefsharp/CefSharp/issues/2246 //For legacy biding we'll still have support for CefSharpSettings.LegacyJavascriptBindingEnabled = true; crBrowser.GetBrowser().RegisterAsyncJsObject("AppAction", new AppAction(this, crBrowser)); crBrowser.GetBrowser().RegisterAsyncJsObject("TaskController", new TaskControllerAction(this, crBrowser)); crBrowser.GetBrowser().FrameLoadEnd += new EventHandler <FrameLoadEndEventArgs>(SplashScreen_Browser_FrameLoadEnd); // 浏览器初始化完毕时执行 crDownloads = new CrDownloads(crBrowser); ContentPanel.Controls.Add(crBrowser.GetBrowser()); crCookieGetter = new CrBrowserCookieGetter(); }
private void InitBrowser() { // 初始化内置浏览器 #if !DEBUG string htmlPath = Utils.GetHtmlResPath("index.html"); if (string.IsNullOrEmpty(htmlPath)) { Application.Exit(); // 退出程序 } #else string htmlPath = "http://127.0.0.1:8080"; #endif crBrowser = new CrBrowser(this, htmlPath); // Need Update: https://github.com/cefsharp/CefSharp/issues/2246 //For legacy biding we'll still have support for CefSharpSettings.LegacyJavascriptBindingEnabled = true; crBrowser.GetBrowser().RegisterAsyncJsObject("AppAction", new AppAction(this, crBrowser)); crBrowser.GetBrowser().RegisterAsyncJsObject("TaskController", new TaskControllerAction(this, crBrowser)); crBrowser.GetBrowser().FrameLoadEnd += new EventHandler <FrameLoadEndEventArgs>(SplashScreen_Browser_FrameLoadEnd); // 浏览器初始化完毕时执行 crDownloads = new CrDownloads(crBrowser); ContentPanel.Controls.Add(crBrowser.GetBrowser()); }
private void InitBrowser() { // 初始化内置浏览器 string htmlPath = Utils.GetHtmlResPath("app.html"); if (string.IsNullOrEmpty(htmlPath)) { Application.Exit(); // 退出程序 } crBrowser = new CrBrowser(htmlPath); crBrowser.GetBrowser().RegisterAsyncJsObject("AppAction", new AppActionForJs()); crBrowser.GetBrowser().RegisterAsyncJsObject("TaskController", new TaskControllerForJs()); crBrowser.GetBrowser().FrameLoadEnd += new EventHandler <FrameLoadEndEventArgs>(Browser_FrameLoadEnd); // 浏览器初始化完毕时执行 crDownloads = new CrDownloads(crBrowser); ContentPanel.Controls.Add(crBrowser.GetBrowser()); }