コード例 #1
0
    WaitHandle DoInvoke(MathFunctionToCall mathFunc, double value)
    {
        AsyncCallback cb = new AsyncCallback(MathCallback);

        IAsyncResult asyncResult =
            mathFunc.BeginInvoke(value, cb, mathFunc);

        return(asyncResult.AsyncWaitHandle);
    }
コード例 #2
0
    WaitHandle DoInvoke(MathFunctionToCall mathFunc, double value)
    {
        AsyncCallTracker callTracker = new AsyncCallTracker(mathFunc);

        AsyncCallback cb          = new AsyncCallback(MathCallback);
        IAsyncResult  asyncResult = mathFunc.BeginInvoke(value, cb, callTracker);

        return(callTracker.DoneEvent);
    }
コード例 #3
0
    public void CallMathCallback(MathFunctionToCall mathFunc,
                                 double start,
                                 double end,
                                 double increment)
    {
        AsyncCallback cb = new AsyncCallback(MathCallback);

        while (start < end)
        {
            Console.WriteLine("BeginInvoke: {0}", start);
            mathFunc.BeginInvoke(start, cb, mathFunc);
            start += increment;
        }
    }