public virtual void EndRecv(IAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentNullException("asyncResult"); } IAsyncResult result = (IAsyncResult)asyncResult; RecvAllDelegate asyncDelegate = result.AsyncState as RecvAllDelegate; if (asyncDelegate != null) { asyncDelegate.EndInvoke(asyncResult); this.State = EPop3ClientState.Awaiting; } else { RecvDelegate delegate3 = result.AsyncState as RecvDelegate; if (delegate3 != null) { delegate3.EndInvoke(asyncResult); this.State = EPop3ClientState.Awaiting; } else { this.State = EPop3ClientState.Awaiting; } } }
public virtual IAsyncResult BeginRecv(AsyncCallback callback) { lock (this) { if (this.State != EPop3ClientState.Awaiting) { throw new InvalidOperationException("Pop3Client doesn't allow executing multiple operations simulteneously in a few threads using one object"); } this.State = EPop3ClientState.Busy; } if (this.ConnectionState != EPop3ConnectionState.Authenticated) { this.State = EPop3ClientState.Awaiting; throw new Pop3WrongStateException("The command cannot be executed in this state"); } RecvAllDelegate delegate2 = new RecvAllDelegate(this._GetAllMessages); return(delegate2.BeginInvoke(callback, this)); }