예제 #1
0
        // wrapper used by async method to call sync version of method, matches WaitCallback so it
        // can be queued by the thread pool
        private void DoSomethingAsyncCore(object state)
        {
            int returnValue = DoSomething();
            var e           = new DoSomethingCompletedEventArgs(returnValue);

            _operation.PostOperationCompleted(RaiseDoSomethingCompleted, e);
        }
예제 #2
0
        private void OnDoSomethingCompleted(DoSomethingCompletedEventArgs e)
        {
            var handler = DoSomethingCompleted;

            if (handler != null)
            {
                handler(this, e);
            }
        }
예제 #3
0
 private void DoSomethingCompleted(object sender, DoSomethingCompletedEventArgs e)
 {
     MessageBox.Show(string.Format("DoSomethingAsync() returned {0}.", e.Value));
 }