コード例 #1
0
        internal override IAsyncResult BeginSend(BaseWriter writer, AsyncCallback?callback, bool allowUnicode,
                                                 object?state)
        {
            _allowUnicode = allowUnicode;
            PrepareHeaders(allowUnicode);
            writer.WriteHeaders(Headers, allowUnicode);
            MimePartAsyncResult result        = new MimePartAsyncResult(this, state, callback);
            MimePartContext     context       = new MimePartContext(writer, result, Parts.GetEnumerator());
            IAsyncResult        contentResult = writer.BeginGetContentStream(new AsyncCallback(ContentStreamCallback), context);

            if (contentResult.CompletedSynchronously)
            {
                ContentStreamCallbackHandler(contentResult);
            }
            return(result);
        }
コード例 #2
0
ファイル: MimePart.cs プロジェクト: tvrprasad/corefx
        internal override IAsyncResult BeginSend(BaseWriter writer, AsyncCallback callback, bool allowUnicode, object state)
        {
            PrepareHeaders(allowUnicode);
            writer.WriteHeaders(Headers, allowUnicode);
            MimePartAsyncResult result  = new MimePartAsyncResult(this, state, callback);
            MimePartContext     context = new MimePartContext(writer, result);

            ResetStream();
            _streamUsedOnce = true;
            IAsyncResult contentResult = writer.BeginGetContentStream(new AsyncCallback(ContentStreamCallback), context);

            if (contentResult.CompletedSynchronously)
            {
                ContentStreamCallbackHandler(contentResult);
            }
            return(result);
        }
コード例 #3
0
 internal override IAsyncResult BeginSend(BaseWriter writer, AsyncCallback callback, bool allowUnicode, 
     object state)
 {
     this.allowUnicode = allowUnicode;
     PrepareHeaders(allowUnicode);
     writer.WriteHeaders(Headers, allowUnicode);
     MimePartAsyncResult result = new MimePartAsyncResult(this, state, callback);
     MimePartContext context = new MimePartContext(writer, result, Parts.GetEnumerator());
     IAsyncResult contentResult = writer.BeginGetContentStream(new AsyncCallback(ContentStreamCallback), context);
     if (contentResult.CompletedSynchronously) {
        ContentStreamCallbackHandler(contentResult);
     }
     return result;
 }