private void button3_Click(object sender, EventArgs e) { IsDon = false; if (string.IsNullOrWhiteSpace(this.textBox1.Text) || string.IsNullOrWhiteSpace(this.textBox3.Text)) { MessageBox.Show("请填写两个路径信息"); return; } if (MessageBox.Show("你确定要剪切数据到指定初始化目录么", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string path = this.textBox3.Text; DataWrite dataWrite = new DataWrite(); //实例化一个写入数据的类 dataWrite.UpdateUIDelegate += UpdataUIStatus; //绑定更新任务状态的委托 dataWrite.TaskCallBack += Accomplish; //绑定完成任务要调用的委托 dataWrite.BackPath = this.textBox1.Text.TrimEnd('/'); dataWrite.StartTime = dateTimePicker2.Value; dataWrite.EndTime = this.dateTimePicker1.Value; Thread thread = new Thread(new ParameterizedThreadStart(dataWrite.RollBack)); thread.IsBackground = true; thread.Start(path); } }
private void button2_Click(object sender, EventArgs e) { IsDon = false; if (string.IsNullOrWhiteSpace(this.textBox1.Text) || string.IsNullOrWhiteSpace(this.textBox3.Text)) { MessageBox.Show("请填写两个路径信息"); return; } string path = this.textBox1.Text; DataWrite dataWrite = new DataWrite(); //实例化一个写入数据的类 dataWrite.UpdateUIDelegate += UpdataUIStatus; //绑定更新任务状态的委托 dataWrite.TaskCallBack += Accomplish; //绑定完成任务要调用的委托 dataWrite.BackPath = this.textBox3.Text.TrimEnd('/'); dataWrite.StartTime = dateTimePicker2.Value; dataWrite.EndTime = this.dateTimePicker1.Value; dataWrite.IsOnlyImage = true; //不是处理单张图片 Thread thread = new Thread(new ParameterizedThreadStart(dataWrite.Write)); thread.IsBackground = true; thread.Start(path); }