public void TabControlBind(string tp) { switch (tp) { case "0": GetMemServerDetials(); break; case "1": InitLableCss(); MemServerMoniter(); break; case "2": Asyncdelegate isgt = new Asyncdelegate(BindSlabSource); IAsyncResult ar = isgt.BeginInvoke(new AsyncCallback(CallbackMethod), isgt); break; case "3": break; case "4": ShootingMemServer(); break; case "5": BindAllMemServerDetials(); break; case "6": break; } }
//异步调用方法 public virtual OutputModel RunrequestActionAsync(HttpWebRequest request, Boolean bSafe, ResponseCallBack callBack) { Asyncdelegate isgt = new Asyncdelegate(requestActionAsync); IAsyncResult ar = isgt.BeginInvoke(request, bSafe, callBack, new AsyncCallback(CallbackMethod), isgt); return(null); }
//异步调用Commit方法 public void Run() { Asyncdelegate isgt = new Asyncdelegate(Commit); //需要时才使用回调方法 isgt.BeginInvoke(null, new AsyncCallback(CallbackMethod), null); //IAsyncResult ar = isgt.BeginInvoke(null, null, isgt); }
//异步调用 提交的方法 public virtual void HttpRequest_AsyncCall(string ReqURL, string ReqSendData) { if (sReqURL == "")//没有访问地址无法请求http服务 { throw new ArgumentNullException("http request url is empty "); } sReqURL = ReqURL; sReqSendData = ReqSendData; Asyncdelegate isgt = new Asyncdelegate(Commit); IAsyncResult ar = isgt.BeginInvoke(null, new AsyncCallback(CallbackMethod), isgt); }