Ejemplo n.º 1
0
        /// <summary>
        /// this is done just once, to globally initialize CefSharp/CEF
        /// </summary>
        private void InitBrowser()
        {
            CefSettings settings = new CefSettings();

            settings.RegisterScheme(new CefCustomScheme {
                SchemeName           = "CefSpider",
                SchemeHandlerFactory = new SchemeHandlerFactory()
            });

            settings.UserAgent = UserAgent;
            settings.IgnoreCertificateErrors = true;
            settings.CachePath = GetAppDir("Cache");

            settings.Locale = "zh-CN";
            //配置代理运行
            //settings.CefCommandLineArgs.Add("no-proxy-server", "1");
            settings.CefCommandLineArgs.Add("proxy-server", "192.168.1.60:9999");
            Cef.Initialize(settings, true, true);//Cef.Initialize(settings);

            dHandler = new DownloadHandler(this);
            lHandler = new LifeSpanHandler(this);
            mHandler = new ContextMenuHandler(this);
            kHandler = new KeyboardHandler(this);
            rHandler = new RequestHandler(this);

            InitDownloads();

            host = new HostHandler(this);

            AddNewBrowser(tabStrip1, HomepageURL);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// this is done just once, to globally initialize CefSharp/CEF
        /// </summary>
        private void InitBrowser()
        {
            CefSettings settings = new CefSettings();

            settings.RegisterScheme(new CefCustomScheme {
                SchemeName           = "CefSpider",
                SchemeHandlerFactory = new SchemeHandlerFactory()
            });

            settings.UserAgent = UserAgent;

            settings.IgnoreCertificateErrors = true;

            settings.CachePath = GetAppDir("Cache");

            Cef.Initialize(settings);

            dHandler = new DownloadHandler(this);
            lHandler = new LifeSpanHandler(this);
            mHandler = new ContextMenuHandler(this);
            kHandler = new KeyboardHandler(this);
            rHandler = new RequestHandler(this);

            InitDownloads();

            host = new HostHandler(this);

            AddNewBrowser(tabStrip1, HomepageURL);
        }