public static void onCompletion(object sender, MatMulCompletedEventArgs e) { Console.WriteLine("Mat1:"); MatMulCalculator.Print(e.Array1); Console.WriteLine("Mat2:"); MatMulCalculator.Print(e.Array2); Console.WriteLine("Mat3:"); MatMulCalculator.Print(e.Array3); }
public void CalculateCompleted(object state) { MatMulCompletedEventArgs e = state as MatMulCompletedEventArgs; if (MatMulCompleted != null) { MatMulCompleted(this, e); } }
void CalculateWorker(double[][] mat1, double[][] mat2, AsyncOperation asyncOp) { double[][] mat3 = MatMul(mat1, mat2); lock (userState.SyncRoot) { userState.Remove(asyncOp.UserSuppliedState); } object[] mats = { mat1, mat2, mat3 }; MatMulCompletedEventArgs e = new MatMulCompletedEventArgs(mats, null, false, asyncOp.UserSuppliedState); asyncOp.PostOperationCompleted(onCompletedCallback, e); }