Ejemplo n.º 1
0
        /// <summary>
        /// 初始化浏览器
        /// </summary>
        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);

            crBrowser.GetBrowser().FrameLoadEnd += new EventHandler <FrameLoadEndEventArgs>((obj, e) => {
                string url = e.Frame.Url;
                if (crBrowser.CheckIsAppUrl(url))
                {
                    crBrowser.RunJS(NacollectorUtils.GenFormList.GetCode());
                }
                _splashScreen.Hide();
                this.Invoke((MethodInvoker) delegate
                {
                    this.Opacity = 1;
                });
            }); // 浏览器初始化完毕时执行

            ContentPanel.Controls.Add(crBrowser.GetBrowser());
            cookieGetterBrowser = new CookieGetterBrowser(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 初始化浏览器
        /// </summary>
        private void InitBrowser()
        {
#if !DEBUG
            string htmlPath = "nacollector://html_res/index.html";
#else
            string htmlPath = "http://localhost:8080";
#endif
            crBrowser = new CrBrowser(this, htmlPath);

            crBrowser.GetBrowser().FrameLoadEnd += new EventHandler <FrameLoadEndEventArgs>((obj, e) => {
                string url = e.Frame.Url;
                if (CrBrowser.CheckIsAppUrl(url))
                {
                    // 获取并前端执行表单生成代码
                    taskRunner.RefreshFrontendSpiderList();
                }
                _splashScreen.Hide();
                this.Invoke((MethodInvoker) delegate
                {
                    this.Opacity = 1;
                });
            }); // 浏览器初始化完毕时执行

            ContentPanel.Controls.Add(crBrowser.GetBrowser());
            cookieGetterBrowser = new CookieGetterBrowser(this);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 初始化浏览器
        /// </summary>
        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);

            crBrowser.GetBrowser().FrameLoadEnd += new EventHandler <FrameLoadEndEventArgs>((obj, e) => {
                string url = e.Frame.Url;
                if (crBrowser.CheckIsAppUrl(url))
                {
                    // 获取并前端执行表单生成代码
                    _mainForm.BeginInvoke((MethodInvoker) delegate
                    {
                        var spiderDomain = taskRunner.GetLoadSpiderDomain();
                        crBrowser.RunJS(spiderDomain.GetFormGenJsCode());
                        taskRunner.UnloadSpiderDomain();
                    });
                }
                _splashScreen.Hide();
                this.Invoke((MethodInvoker) delegate
                {
                    this.Opacity = 1;
                });
            }); // 浏览器初始化完毕时执行

            ContentPanel.Controls.Add(crBrowser.GetBrowser());
            cookieGetterBrowser = new CookieGetterBrowser(this);
        }
Ejemplo n.º 4
0
        public override bool OnBeforeBrowse(IWebBrowser browserControl, IBrowser browser, IFrame frame, IRequest request, bool userGesture, bool isRedirect)
        {
            if (frame.Url == "" || CrBrowser.CheckIsAppUrl(frame.Url))
            {
                return(false);
            }

            return(true);
        }