I have the following delegate
delegate void UpdateFileDelegate(long maxFileID);
That I am calling from a WinForms app like so
UpdateFileDelegate FD = new UpdateFileDelegate(ClassInstance.UpdateFile);
FD.BeginInvoke(longIDNumber,null,null);
It runs asynchronously but the question I have is how can I tell when the Method is done executing so I can let the end user know?
Update: Thanks to the recommendations below the following code does the trick. Also this article was helpful in getting me to understand what my code is actually doing.
delegate void UpdateFileDelegate(long maxFileID);
UpdateFileDelegate FB = new UpdateFileDelegate(ClassInstance.UpdateFile);
AsyncCallback callback = new AsyncCallback(this.CallBackMethod);
IAsyncResult result = FB.BeginInvoke(longIDNumber);
private void CallBackMethod(IAsyncResult result)
{
AsyncResult delegateResult = (AsyncResult)result;
UpdateFileDelegate fd = (UpdateFileDelegate)delegateResult.AsyncDelegate;
fd.EndInvoke(result);
MessageBox.Show("All Done!");
}