void Instance_DownloadRemove(object sender, DownloadEventArgs e)
 {
     this.BeginInvoke((MethodInvoker)delegate()
     {
         Row row = taskToRow[e.Downloader] as Row;
         if (row!=null)
         {
             row.Cells.Clear();
         }
         taskToRow[e.Downloader] = null;
         rowToTask[row] = null;
         tableModel.Rows.Remove(row);
         ShowThreadInfo(string.Format("任务{0}被删除.URL:{1}", e.Downloader.FileName,e.Downloader.URL), Color.DarkGreen);
     });
 }
        void Instance_DownloadEnd(object sender, DownloadEventArgs e)
        {
            SetStateImage(e.Downloader, Resources.Completed);
            Row row = taskToRow[e.Downloader] as Row;
            row.Cells[2].Data = 100;
            row.Cells[3].Text = "0KB/s";
            row.Cells[4].Text = row.Cells[5].Text;

            if (Settings.Default.PlayAudio)
            {
                SoundPlayer.PlayCompleteSound();
            }

            if (Settings.Default.EndOpration=="打开文件夹")
            {
                Process.Start("explorer.exe",Path.GetDirectoryName(e.Downloader.LocalFilePath));
            }
            else if (Settings.Default.EndOpration=="打开文件")
            {
                Process.Start(e.Downloader.LocalFilePath);
            }
            MainForm.Instance.ShowBalloonTip(30, "提示", string.Format("任务{0}下载完成了.", e.Downloader.FileName), ToolTipIcon.Info);
            ShowThreadInfo(string.Format("任务{0}下载完成.URL:{1}", e.Downloader.FileName,e.Downloader.URL), Color.DarkGreen);
        }
 void Instance_DownloadPaused(object sender, DownloadEventArgs e)
 {
     SetStateImage(e.Downloader, Resources.Paused);
     Row row = taskToRow[e.Downloader] as Row;
     row.Cells[3].Text = "0KB/s";
     ShowThreadInfo(string.Format("任务{0}用户取消下载.URL:{1}", e.Downloader.FileName,e.Downloader.URL), Color.DarkGreen);
 }
 void Instance_DownloadAdd(object sender, DownloadEventArgs e)
 {
     if (IsHandleCreated)
     {
         this.BeginInvoke((MethodInvoker)delegate() { AddTask(e.Downloader); });
     }
     else
     {
         AddTask(e.Downloader);
     }
     ShowThreadInfo(string.Format("任务{0}创建了.URL:{1}", e.Downloader.FileName,e.Downloader.URL), Color.DarkGreen);
 }