Esempio n. 1
0
File: Program.cs Progetto: Klapik/PP
        /// <summary>
        /// This function will be called by SendOrPostCallback to raise Method1Completed Event
        /// </summary>
        /// <param name="operationState">Method1CompletedEventArgs object</param>

        private void CalculateCompleted(object operationState)
        {
            CompletedEventArgs e = operationState as CompletedEventArgs;

            if (MathMulCompleted != null)
            {
                MathMulCompleted(this, e);
            }
        }
Esempio n. 2
0
File: Program.cs Progetto: Klapik/PP
 private static void onMathMulCompleted(object sender, CompletedEventArgs e)
 {
     lock (locked)
     {
         Methods.PrintMatrix("First", e.firstMatrix);
         Console.WriteLine();
         Methods.PrintMatrix("Second", e.secondMatrix);
         Console.WriteLine();
         Methods.PrintMatrix("Result", e.finalMatrix);
         Console.WriteLine();
     }
 }
Esempio n. 3
0
File: Program.cs Progetto: Klapik/PP
        /// <summary>
        /// This method does the actual work
        /// </summary>
        /// <param name="message"></param>
        /// <param name="asyncOp"></param>
        private void MathMulWorker(double[][] firstMatrix, double[][] secondMatrix, AsyncOperation asyncOp)
        {
            double[][] matrixFinal = Methods.MultiplyMatrix(firstMatrix, secondMatrix);

            lock (tasks.SyncRoot)
            {
                tasks.Remove(asyncOp.UserSuppliedState);
            }

            object[] matrixes = new object[3];
            matrixes[0] = firstMatrix;
            matrixes[1] = secondMatrix;
            matrixes[2] = matrixFinal;

            CompletedEventArgs e = new CompletedEventArgs(null, false, asyncOp.UserSuppliedState, matrixes);

            asyncOp.PostOperationCompleted(onCompletedDelegate, e);
        }