Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        public virtual IAsyncResult BeginRecv(IEnumerable <uint> serialNumbers, IEnumerable <string> uids, AsyncCallback callback)
        {
            if (serialNumbers == null)
            {
                throw new ArgumentNullException("serialNumbers");
            }
            if (uids == null)
            {
                throw new ArgumentNullException("uids");
            }
            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");
            }
            RecvDelegate delegate2 = new RecvDelegate(this._GetMessages);

            return(delegate2.BeginInvoke(serialNumbers, uids, callback, this));
        }
Ejemplo n.º 3
0
 private async void readAsync()
 {
     var recvDelegate = new RecvDelegate(read);
     await Task.Factory.FromAsync(recvDelegate.BeginInvoke, recvDelegate.EndInvoke, null);
 }