private void button1_Click(object sender, EventArgs e) { begin = new deltest(method); callback = new AsyncCallback(back); obj = new objstate(); //实例化类,该对象可以传入回调函数中 begin.BeginInvoke(back, obj); //异步执行method,界面不会假死,5秒后执行回调函数,弹出提示框 }
private void FirstMethod() { begin = new deltest(method); callback = new AsyncCallback(back); obj = new objstate(); //实例化类,该对象可以传入回调函数中 begin.BeginInvoke(back, obj); //异步执行method,界面不会假死,5秒后执行回调函数,弹出提示框 }