public object EndProcess(MethodBase method, string operationName, object [] parameters, IAsyncResult result) { if (result == null) { throw new ArgumentNullException("result"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } object[] p = parameters; var retval = _processDelegate.EndInvoke(ref p, result); if (p == parameters) { return(retval); } if (p.Length != parameters.Length) { throw new InvalidOperationException(); } Array.Copy(p, parameters, p.Length); return(retval); }
public object EndProcess(MethodBase method, string operationName, object [] parameters, IAsyncResult result) { if (result == null) { throw new ArgumentNullException("result"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } var pi = method.GetParameters(); var countInParams = 0; for (int i = 0; i < pi.Length; i++) { if (pi [i].IsIn) { countInParams++; } } if (parameters.Length != countInParams) { throw new InvalidOperationException(); } object[] p = parameters; var retval = _processDelegate.EndInvoke(ref p, result); if (p == parameters) { return(retval); } int pos = 0; for (int i = 0; i < pi.Length; i++) { if (!pi [i].IsOut && !pi [i].ParameterType.IsByRef) { continue; } parameters [i] = p [pos++]; } if (pos != p.Length) { throw new InvalidOperationException(); } return(retval); }
public object EndProcess(MethodBase method, string operationName, object [] parameters, IAsyncResult result) { if (result == null) { throw new ArgumentNullException("result"); } if (parameters == null) { throw new ArgumentNullException("parameters"); } // FIXME: the method arguments should be verified to be // identical to the arguments in the corresponding begin method. return(_processDelegate.EndInvoke(result)); }
private void ProcessCallback(IAsyncResult ar) { ProcessDelegate del = (ProcessDelegate)ar.AsyncState; ProcessWorkerResult result = del.EndInvoke(ar); if (ProcessFinished != null) { ProcessFinished(this, new AsyncProcessFinishedEventArgs() { Canceled = result.Canceled, Error = result.Error, Result = result.Result }); } }