void webClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { Delegate_EndSearch d = new Delegate_EndSearch(EndSimpleSearch); object[] args = new object[] { e }; this.Invoke(d, args); if (this.eventComplete != null) this.eventComplete.Set(); }
void webClient_ReloadDownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { Delegate_EndSearch d = new Delegate_EndSearch(EndSimpleSearch); object[] args = new object[] { e }; this.Invoke(d, args); // 如果没有完成,还要继续做 if (this.m_reloadInfo.Cancel == false && this.m_reloadInfo.StartIndex + this.m_reloadInfo.CurrentItems.Count < this.m_reloadInfo.TotalItems.Count) { string strError = ""; int nRedoCount = 0; Thread.Sleep(1000); REDO: int nRet = ReloadItems(this.m_reloadInfo.TotalItems, this.m_reloadInfo.StartIndex + this.m_reloadInfo.CurrentItems.Count, this.m_reloadInfo.ElementSet, out strError); if (nRet == -1) { if (this.m_exception != null && this.m_exception is WebException) { WebException ex = this.m_exception as WebException; if (ex.Status == WebExceptionStatus.ProtocolError) { // 重做 if (nRedoCount < 2) { nRedoCount++; Thread.Sleep(1000); goto REDO; } // 询问是否重做 DialogResult result = MessageBox.Show(this, "重新装载时发生错误:\r\n\r\n" + strError + "\r\n\r\n是否重试?\r\n\r\n(Yes: 重试; No: 中断操作", "AmazonSearchForm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == System.Windows.Forms.DialogResult.Yes) { Thread.Sleep(1000); goto REDO; } } } this.amazonSimpleQueryControl_simple.Comment = strError; } return; } // 清除进度条 if (this.m_reloadInfo.StartIndex + this.m_reloadInfo.CurrentItems.Count >= this.m_reloadInfo.TotalItems.Count) { this.stop.HideProgress(); this.stop.SetMessage(""); } if (this.eventComplete != null) this.eventComplete.Set(); }
void webClient_MultiLineDownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { #if NO Delegate_EndSearch d = new Delegate_EndSearch(EndMultiLineSearch); object[] args = new object[] { e }; this.MainForm.Invoke(d, args); #endif _end_e = e; if (this.eventComplete != null) this.eventComplete.Set(); }