public void LoadingComplete(IAsyncResult ar) { AsyncLoadingDelegate dlg = (AsyncLoadingDelegate)((AsyncResult)ar).AsyncDelegate; try { // try to end the call dlg.EndInvoke(ar); } catch (Exception e) { // exception will be raised if there was an exception on the worker thread ThrowAsyncException(e); return; } // call the user's callback function if (_finish != null) { _control.BeginInvoke(_finish); } }
//======================================================== //Constructors //======================================================== public SvcAsync(Control control, AsyncLoadingDelegate begin, AsyncLoadingDelegate finish) { _control = control; _begin = begin; _finish = finish; }