示例#1
0
        void mybrower_DownloadComplete(object sender)
        {
            if (DesignMode)
            {
                return;
            }

            MyBrowser mybrower = (MyBrowser)webBrowser;

            if (mybrower == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(mybrower.LocationUrl) || mybrower.LocationUrl == "about:blank")
            {
                return;
            }
            if (mybrower.IsMySite())
            {
                return;
            }
            if (!this.fakeHttpContext.EnableTracing)
            {
                return;
            }
            logger.Info("exescript:downolad");
            Thread t = new Thread(() => {
                AutoRobo.Core.App.Wait(() => {
                    try
                    {
                        mybrower.execScript(true, Resources.domReady, "");
                    }
                    catch (Exception ex) {
                        logger.Fatal(ex);
                        return(false);
                    }
                    logger.Info("inject Resources.domReady sucess!" + mybrower.LocationUrl);
                    return(true);
                });
            });

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
        }