S
standogan
I have a long running process, and I use Delegates to start it, and
during the process I want to show a wait form to the user.
///////////////////CODE/////////////////////////////////
public void StartProcess()
{
MyDelegate del = new MyDelegate(LongRunningProcess);
del.Invoke(new AsyncCallback(CloseWaitForm), null);
waitForm.ShowDialog(this);
}
public void CloseWaitForm(IAsyncResult result)
{
waitForm.HideYourself();
Application.DoEvents();
AsyncResult ar = (AsyncResult) result;
MyDelegate del = (MyDelegate)ar.AsyncDelegate;
del.EndInvoke(ar);
}
////////////////////////////////////////////////////////
If in the LongRunningProcess() an exception occurs, and invoke ends
(CloseWaitForm calls), can it be before the line in which I show the
form? I mean, invoke ends and waitForm hides, before it is shown, then
it shows up and stays there forever. Is this a possibility? If it is
how I can avoid it?
Best Regards...
during the process I want to show a wait form to the user.
///////////////////CODE/////////////////////////////////
public void StartProcess()
{
MyDelegate del = new MyDelegate(LongRunningProcess);
del.Invoke(new AsyncCallback(CloseWaitForm), null);
waitForm.ShowDialog(this);
}
public void CloseWaitForm(IAsyncResult result)
{
waitForm.HideYourself();
Application.DoEvents();
AsyncResult ar = (AsyncResult) result;
MyDelegate del = (MyDelegate)ar.AsyncDelegate;
del.EndInvoke(ar);
}
////////////////////////////////////////////////////////
If in the LongRunningProcess() an exception occurs, and invoke ends
(CloseWaitForm calls), can it be before the line in which I show the
form? I mean, invoke ends and waitForm hides, before it is shown, then
it shows up and stays there forever. Is this a possibility? If it is
how I can avoid it?
Best Regards...