Microsoft.ManagementConsole.AsyncDelegate.Execute C# (CSharp) Method

Execute() public method

public Execute ( bool completeSync ) : void
completeSync bool
return void
        public void Execute(bool completeSync)
        {
            try
            {
                this._delegateResult = this._asyncDelegate.DynamicInvoke(this._args);
            }
            finally
            {
                this._isCompleted = true;
                this._completedSync = completeSync;
                this._completedEvent.Set();
            }
        }

Usage Example

Example #1
0
 public IAsyncResult BeginInvoke(Delegate method, object[] args)
 {
     AsyncDelegate delegate2 = new AsyncDelegate(method, args);
     if (!this.InvokeRequired)
     {
         delegate2.Execute(true);
         return delegate2;
     }
     BeginInvokeCommand command = null;
     lock (this.SyncRoot)
     {
         int key = this._nextInvokeId++;
         this._pendingDelegates.Add(key, delegate2);
         if (this._snapInPlatform != null)
         {
             command = new BeginInvokeCommand();
             command.Id = key;
         }
     }
     if (command != null)
     {
         this._snapInPlatform.ProcessCommand(command);
     }
     return delegate2;
 }