示例#1
0
        private void ReportRequestStringCompleted(object operationState)
        {
            RequestStringCompletedEventArgs e =
                operationState as RequestStringCompletedEventArgs;

            OnRequestStringCompleted(e);
        }
示例#2
0
 void _httper_RequestStringCompleted(object sender, RequestStringCompletedEventArgs e)
 {
     this._CompletedCount++;
     if (e.Error == null)
     {
         System.Text.RegularExpressions.MatchCollection mc = RegexUtility.GetMatchFull(e.ResponseString, ((ProxySourcePageInfo)e.UserState).RegexString);
         if (mc != null)
         {
             foreach (System.Text.RegularExpressions.Match m in mc)
             {
                 ProxyInfo info = new ProxyInfo();
                 info.Name = "";
                 info.Address = m.Groups[1].Value.Split(':')[0];
                 info.Port = Convert.ToInt32(m.Groups[1].Value.Split(':')[1]);
                 SendStatusChanged(string.Format("取得:{0}:{1}", info.Address, info.Port), "");
                 this._ProxyList.Add(info);
             }
         }
     }
     else
     {
     #warning todo error
     }
     if (this._CompletedCount == this._SourcePageInfo.Count)
     {
         if (this.Completed != null)
         {
             this.Completed(this, new Natsuhime.Events.ReturnCompletedEventArgs(this._ProxyList, null, false, "77777"));
         }
     }
 }
示例#3
0
        // This is the method that the underlying, free-threaded
        // asynchronous behavior will invoke.  This will happen on
        // an arbitrary thread.
        private void CompletionMethod(
            string responseString,
            Exception exception,
            bool canceled,
            AsyncOperation asyncOp)
        {
            // If the task was not previously canceled,
            // remove the task from the lifetime collection.
            if (!canceled)
            {
                lock (userStateToLifetime.SyncRoot)
                {
                    userStateToLifetime.Remove(asyncOp.UserSuppliedState);
                }
            }

            RequestStringCompletedEventArgs e =
                new RequestStringCompletedEventArgs(
                    responseString,
                    exception,
                    canceled,
                    asyncOp.UserSuppliedState);

            // End the task. The asyncOp object is responsible
            // for marshaling the call.
            asyncOp.PostOperationCompleted(onRequestStringCompletedDelegate, e);

            // Note that after the call to OperationCompleted,
            // asyncOp is no longer usable, and any attempt to use it
            // will cause an exception to be thrown.
        }
示例#4
0
 private void OnRequestStringCompleted(RequestStringCompletedEventArgs e)
 {
     if (RequestStringCompleted != null)
     {
         System.Diagnostics.Debug.WriteLine("¥¥¥¥¥OnRequestStringCompleted¥¥¥¥¥");
         RequestStringCompleted(this, e);
     }
 }
示例#5
0
 void httper_RequestStringCompleted(object sender, RequestStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         this.GetFileUrlsComplete(e.ResponseString, e.UserState, e.Cancelled);
     }
     else
     {
         OnCompleted(new ReturnCompletedEventArgs(null, e.Error, e.Cancelled, e.UserState));
     }
 }
示例#6
0
        void nhttper_RequestStringCompleted(object sender, RequestStringCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                string baseUrl = tbxUrl.Text.Trim().Substring(0, tbxUrl.Text.Trim().LastIndexOf('/') + 1);

                if (e.UserState.ToString() == "GetTitleUrls")
                {
                    GetTitleUrlsComplete(e.ResponseString, baseUrl);
                }
                else if (e.UserState.ToString() == "GetImageUrls")
                {
                    GetImageUrlsComplete(e.ResponseString, baseUrl);
                }
            }
            else
            {
                MessageBox.Show(e.Error.Message);
            }
        }
示例#7
0
 void httper_RequestStringCompleted(object sender, RequestStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         string[] urls = Utils.GetImageUrls(e.ResponseString);
         if (urls.Length > 0)
         {
             MessageBox.Show(string.Format("{0} Images Getted~", urls.Length));
             foreach (string url in urls)
             {
                 tbxResult.Text += url + Environment.NewLine;
             }
         }
         else
         {
             MessageBox.Show("No Image Getted!");
         }
     }
     else
     {
         MessageBox.Show(e.Error.Message);
     }
 }
示例#8
0
 private void OnRequestStringCompleted(RequestStringCompletedEventArgs e)
 {
     if (RequestStringCompleted != null)
     {
         System.Diagnostics.Debug.WriteLine("¥¥¥¥¥OnRequestStringCompleted¥¥¥¥¥");
         RequestStringCompleted(this, e);
     }
 }
示例#9
0
        // This is the method that the underlying, free-threaded 
        // asynchronous behavior will invoke.  This will happen on
        // an arbitrary thread.
        private void CompletionMethod(
            string responseString,
            Exception exception,
            bool canceled,
            AsyncOperation asyncOp)
        {

            // If the task was not previously canceled,
            // remove the task from the lifetime collection.
            if (!canceled)
            {
                lock (userStateToLifetime.SyncRoot)
                {
                    userStateToLifetime.Remove(asyncOp.UserSuppliedState);
                }
            }

            RequestStringCompletedEventArgs e =
                new RequestStringCompletedEventArgs(
                responseString,
                exception,
                canceled,
                asyncOp.UserSuppliedState);

            // End the task. The asyncOp object is responsible 
            // for marshaling the call.
            asyncOp.PostOperationCompleted(onRequestStringCompletedDelegate, e);

            // Note that after the call to OperationCompleted, 
            // asyncOp is no longer usable, and any attempt to use it
            // will cause an exception to be thrown.
        }
示例#10
0
 void httper_RequestStringCompleted(object sender, RequestStringCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         if (ckbxUserWebBrowser.Checked)
         {
             this.wbMain.DocumentText = e.ResponseString;
         }
         ShowMessage(e.ResponseString);
         ShowCookie();
         ShowMessage("END REQUEST:");
     }
     else
     {
         GetException(e.Error);
     }
 }
示例#11
0
 void httper_RequestStringCompleted(object sender, RequestStringCompletedEventArgs e)
 {
 }