示例#1
0
 public override void Evaluate(WebflowBase webflow)
 {
     if (this.UrlPattern.IsMatch(webflow.CurrentUrl))
     {
         webflow.Logger.Log(string.Format("Url触发器'{0}'", this.UrlPattern.ToString()));
         foreach (var op in this.Operations)
         {
             op.Execute(webflow);
         }
     }
 }
 public override void Execute(WebflowBase webflow)
 {
     var wf = webflow as DocumentWebflow;
     if (wf != null)
     {
         this.Status = OperationStatus.Executing;
         wf.Logger.Log(string.Format("引用脚本'{0}':地址({1})", this.Name, this.ScriptUrl));
         wf.IncludeScript(this.ScriptUrl, this.Persist);
         this.Status = OperationStatus.Completed;
         this.InvokeCallback(null);
     }
 }
 public override void Execute(WebflowBase webflow)
 {
     var wf = webflow as DocumentWebflow;
     if (wf != null)
     {
         this.Status = OperationStatus.Executing;
         wf.Logger.Log(string.Format("执行脚本'{0}':...", this.Name));
         wf.InjectScript(this.ScriptText, this.Delay);
         this.Status = OperationStatus.Completed;
         wf.Logger.Log(string.Format("脚本'{0}'执行完毕.", this.Name));
         this.InvokeCallback(null);
     }
 }
 public abstract void Evaluate(WebflowBase webflow);
        public override void Execute(WebflowBase webflow)
        {
            var wf = webflow as DocumentWebflow;
            if (wf != null)
            {
                WebClient client = new WebClient();
                client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
                client.Headers.Add("user-agent", DefaultUserAgent);
                client.Headers.Add("Cookie", Internet.GetCookieString(this.Uri));

                this.Status = OperationStatus.Executing;
                wf.Logger.Log(string.Format("执行Http请求'{0}':地址({1}),方法({2}),参数({3}),异步({4}),", this.Name, this.Uri.ToString(), this.Method, this.Parameter, this.IsAsync));

                if (this.IsAsync)
                {
                    client.UploadStringCompleted += (sender, e) =>
                    {
                        wf.Logger.Log(string.Format("Http请求'{0}'执行完毕", this.Name));
                        this.Status = OperationStatus.Completed;
                        this.InvokeCallback(e.Result);
                    };
                    client.UploadStringAsync(this.Uri, this.Parameter);
                }
                else
                {
                    string result = client.UploadString(this.Uri, this.Parameter);
                    this.Status = OperationStatus.Completed;
                    wf.Logger.Log(string.Format("Http请求'{0}'执行完毕", this.Name));
                    this.InvokeCallback(result);
                }
            }
        }
 public override void Execute(WebflowBase webflow)
 {
     throw new NotImplementedException();
 }
 public abstract void Execute(WebflowBase webflow);