Inheritance: IAsyncResult
Esempio n. 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;
 }
Esempio n. 2
0
 public void Initialize(ISnapInPlatform snapInPlatform)
 {
     if (snapInPlatform == null)
     {
         throw new ArgumentNullException("snapInPlatform");
     }
     AsyncDelegate[] array = null;
     lock (this.SyncRoot)
     {
         this._snapInPlatform = snapInPlatform;
         array = new AsyncDelegate[this._pendingDelegates.Values.Count];
         this._pendingDelegates.Values.CopyTo(array, 0);
         this._pendingDelegates.Clear();
     }
     if (array != null)
     {
         foreach (AsyncDelegate delegate2 in array)
         {
             delegate2.Execute(false);
         }
     }
 }