ProgressForm is a Form. I want to do something when the ProccessingReport met开发者_Go百科hod execution finished.
IAsyncResult AsyncResult = ProgressForm.BeginInvoke(new Action(ProcessingReport));
Now I do something like this :
    while (!AsyncResult.IsCompleted)
    {
        Application.DoEvents();
    }
    doSomething();
I can't move the doSomething() operation to ProcessingReport method. Is it possible?Thanks.
Create a DoAsyncProcessingReportResult method that takes a parameter like:
private void DoAsyncProcessingReportResult(IAsyncResult iar)
{
    AsyncResult ar = (AsyncResult)iar;
    // map this to your delegate (take mine as an example)
    Func<RemoteDirectoryInfo> LoadProcessingReport =
          (Func<RemoteDirectoryInfo>)ar.AsyncDelegate;
    // Then get your answer from calling the EndInvoke
    _Directory = LoadProcessingReport.EndInvoke(ar);
}
You call ProcessingReport (taking mine as an example)
Func<RemoteDirectoryInfo> LoadProcessingReport = ProcessingReport;
LoadProcessingReport.BeginInvoke(DoAsyncProcessingReportResult, null);
I modified my code to reflect yours the best I could determine. You'll have to fix the delegate declaration to fit your code.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论