System.ComponentModel.AsyncOperation.Post C# (CSharp) Method

Post() public method

public Post ( SendOrPostCallback d, object arg ) : void
d SendOrPostCallback
arg object
return void
        public void Post(SendOrPostCallback d, object arg)
        {
            VerifyNotCompleted();
            VerifyDelegateNotNull(d);
            syncContext.Post(d, arg);
        }

Usage Example

Ejemplo n.º 1
0
        public void ReportProgress(int percentProgress, object userState)
        {
            if (!WorkerReportsProgress)
            {
                throw new InvalidOperationException("This background worker does not report progress.");
            }

            if (complete)
            {
                throw new InvalidOperationException("The background worker has ended.");
            }

            ProgressChangedEventArgs pcea = new ProgressChangedEventArgs(percentProgress, userState);

            if (async == null)
            {
                // we can report progress before a call to RunWorkerAsync - but we do it sync
                OnProgressChanged(pcea);
            }
            else
            {
                async.Post(delegate(object o) {
                    ProgressChangedEventArgs e = o as ProgressChangedEventArgs;
                    OnProgressChanged(e);
                }, pcea);
            }
        }
All Usage Examples Of System.ComponentModel.AsyncOperation::Post