public void BackUpBizFileUpdateCircleBar(int lenth, string p, int i, string localPath) { double num = (((double)i / lenth) * 100); //string[] files = XMLHelper.GetBizFile(path); Thread thread = new Thread(new ThreadStart(new Action(delegate { XMLHelper.BackupBizFile(p, localPath); this.circleProgramBar1.MaxValue = 100; this.circleProgramBar1.Progress = (int)num + 1; Action <int> action = (data) => { if (lenth - i > 0) { this.richTextBox1.AppendText("备份报文: " + Path.GetFileName(p) + " 完成!\n"); } if (lenth - i <= 1) { this.richTextBox1.AppendText("完成备份任务:" + DateTime.Now.ToString() + "\n"); this.circleProgramBar1.Progress = 100; } }; Invoke(action, (int)i); }))); thread.IsBackground = true; thread.Start(); }