コード例 #1
0
            /// <summary>
            /// Starts sending response.
            /// </summary>
            /// <param name="response">IMAP response.</param>
            /// <param name="completedAsyncCallback">Callback to be called when this method completes asynchronously.</param>
            /// <returns>Returns true is method completed asynchronously(the completedAsyncCallback is raised upon completion of the operation).
            /// Returns false if operation completed synchronously.</returns>
            /// <exception cref="ArgumentNullException">Is raised when <b>response</b> is null reference.</exception>
            public bool SendResponseAsync(IMAP_r response,EventHandler<EventArgs<Exception>> completedAsyncCallback)
            {
                if(response == null){
                    throw new ArgumentNullException("response");
                }

                lock(m_pLock){
                    QueueItem responseItem = new QueueItem(response,completedAsyncCallback);
                    m_pResponses.Enqueue(responseItem);

                    // Start sending response, no active response sending.
                    if(!m_IsSending){
                        SendResponsesAsync();
                    }

                    // Response sent synchronously.
                    if(responseItem.IsSent){
                        return false;
                    }
                    // Response queued or sending is in progress.
                    else{
                        responseItem.IsAsync = true;

                        return true;
                    }
                }
            }
コード例 #2
0
                /// <summary>
                /// Default constructor.
                /// </summary>
                /// <param name="response">IMAP response.</param>
                /// <param name="completedAsyncCallback">Callback to be called when response sending completes asynchronously.</param>
                /// <exception cref="ArgumentNullException">Is raised when <b>response</b> is null reference.</exception>
                public QueueItem(IMAP_r response,EventHandler<EventArgs<Exception>> completedAsyncCallback)
                {
                    if(response == null){
                        throw new ArgumentNullException("response");
                    }

                    m_pResponse               = response;
                    m_pCompletedAsyncCallback = completedAsyncCallback;
                }
コード例 #3
0
            /// <summary>
            /// Starts sending response.
            /// </summary>
            /// <param name="response">IMAP response.</param>
            /// <exception cref="ArgumentNullException">Is raised when <b>response</b> is null reference.</exception>
            public void SendResponseAsync(IMAP_r response)
            {
                if(response == null){
                    throw new ArgumentNullException("response");
                }

                SendResponseAsync(response,null);
            }
コード例 #4
0
            /// <summary>
            /// Starts sending response.
            /// </summary>
            /// <param name="response">IMAP response.</param>
            /// <param name="completedAsyncCallback">Callback to be called when this method completes asynchronously.</param>
            /// <returns>Returns true is method completed asynchronously(the completedAsyncCallback is raised upon completion of the operation).
            /// Returns false if operation completed synchronously.</returns>
            /// <exception cref="ArgumentNullException">Is raised when <b>response</b> is null reference.</exception>
            public bool SendResponseAsync(IMAP_r response,EventHandler<EventArgs<Exception>> completedAsyncCallback)
            {
                if(response == null){
                    throw new ArgumentNullException("response");
                }

                QueueItem responseItem = new QueueItem(response,completedAsyncCallback);
                m_pResponses.Enqueue(responseItem);

                // Start sending response(s).
                SendResponsesAsync(false);

                return !responseItem.IsSent;
            }