/// <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;
        }
예제 #2
0
 public void Shutdown()
 {
     if (_client != null)
     {
         _client.Shutdown();
         _client = null;
     }
 }
예제 #3
0
        /// <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;
        }