/// <summary> /// Initialization /// </summary> /// <param name="width">Browser rect width</param> /// <param name="height">Browser rect height</param> /// <param name="starturl"></param> public void Init(int width, int height, string starturl) { RegisterMessageRouter(); CefWindowInfo cefWindowInfo = CefWindowInfo.Create(); cefWindowInfo.SetAsWindowless(IntPtr.Zero, false); var cefBrowserSettings = new CefBrowserSettings { JavaScript = CefState.Enabled, TabToLinks = CefState.Enabled, WebSecurity = CefState.Disabled, WebGL = CefState.Enabled, WindowlessFrameRate = 30 }; _client = new WorkerCefClient(width, height, this); string url = "http://www.yandex.ru/"; if (starturl != "") { url = starturl; } CefBrowserHost.CreateBrowser(cefWindowInfo, _client, cefBrowserSettings, url); _initialized = true; }
public void Shutdown() { if (_client != null) { _client.Shutdown(); _client = null; } }
/// <summary> /// Initialization /// </summary> /// <param name="width">Browser rect width</param> /// <param name="height">Browser rect height</param> /// <param name="starturl"></param> public void Init(CommandLineParametres parametres) { RegisterMessageRouter(); var cefWindowInfo = CefWindowInfo.Create(); cefWindowInfo.SetAsWindowless(IntPtr.Zero, false); var cefBrowserSettings = new CefBrowserSettings { JavaScript = CefState.Enabled, TabToLinks = CefState.Enabled, WebSecurity = CefState.Disabled, WebGL = CefState.Enabled, WindowlessFrameRate = 30 }; _client = new WorkerCefClient(parametres.kWidth, parametres.kHeight, this); var url = string.IsNullOrEmpty(parametres.InitialUrl) ? "about:blank" : parametres.InitialUrl; PrepareBundle(parametres.ResourceBundle); CefBrowserHost.CreateBrowser(cefWindowInfo, _client, cefBrowserSettings, url); _initialized = true; }