private void button1_Click(object sender, EventArgs e) { Class1.ContorlMinAndMaxValue contorlMinAndMaxValue = new Class1.ContorlMinAndMaxValue(SetValue); Class1.RefreshValue refreshValue = new Class1.RefreshValue(ReFreshValueForm); Class1.BeginCount(contorlMinAndMaxValue, refreshValue); }
public void BeginCount(object args) { Collection <object> argCollection = (Collection <object>)args; int count = (int)argCollection[0]; Class1.ContorlMinAndMaxValue contorlMinAndMaxValue = (Class1.ContorlMinAndMaxValue)argCollection[1]; Class1.RefreshValue refreshValue = (Class1.RefreshValue)argCollection[2]; Class1.BeginCount(count, contorlMinAndMaxValue, refreshValue); ts2 = new TimeSpan(DateTime.Now.Ticks); TimeSpan ts = ts2.Subtract(ts1).Duration(); //时间差的绝对值 String spanTime = ts.Hours.ToString() + "小时" + ts.Minutes.ToString() + "分" + ts.Seconds.ToString() + "秒" + ts.Milliseconds.ToString() + "毫秒"; //以X小时X分X秒的格式现实执行时间 MessageBox.Show("合并结束,耗时" + spanTime); }