private void button1_Click(object sender, EventArgs e) { AsyncResult asyncResult = m_Result as AsyncResult; MyFunctionDelegate d = asyncResult.AsyncDelegate as MyFunctionDelegate; d.EndInvoke(m_Result); this.CloseForm(); }
private void Completed(IAsyncResult result) { System.Runtime.Remoting.Messaging.AsyncResult asyncResult = result as System.Runtime.Remoting.Messaging.AsyncResult; MyFunctionDelegate myDelegate = (MyFunctionDelegate)asyncResult.AsyncDelegate; DialogResult dialogResult = myDelegate.EndInvoke(asyncResult); if (dialogResult == DialogResult.OK) { MessageBox.Show("OK!"); } else { MessageBox.Show("Cancelled!"); } }