private void MimePartSentCallbackHandler(IAsyncResult result) { MimePartContext context = (MimePartContext)result.AsyncState !; MimeBasePart part = (MimeBasePart)context._partsEnumerator.Current; part.EndSend(result); if (context._partsEnumerator.MoveNext()) { part = (MimeBasePart)context._partsEnumerator.Current; IAsyncResult sendResult = part.BeginSend(context._writer, _mimePartSentCallback !, _allowUnicode, context); if (sendResult.CompletedSynchronously) { MimePartSentCallbackHandler(sendResult); } return; } else { IAsyncResult closeResult = ((MimeWriter)context._writer).BeginClose(new AsyncCallback(MimeWriterCloseCallback), context); if (closeResult.CompletedSynchronously) { MimeWriterCloseCallbackHandler(closeResult); } } }
private void ContentStreamCallbackHandler(IAsyncResult result) { MimePartContext context = (MimePartContext)result.AsyncState !; context._outputStream = context._writer.EndGetContentStream(result); context._writer = new MimeWriter(context._outputStream !, ContentType.Boundary !); if (context._partsEnumerator.MoveNext()) { MimeBasePart part = (MimeBasePart)context._partsEnumerator.Current; _mimePartSentCallback = new AsyncCallback(MimePartSentCallback); IAsyncResult sendResult = part.BeginSend(context._writer, _mimePartSentCallback, _allowUnicode, context); if (sendResult.CompletedSynchronously) { MimePartSentCallbackHandler(sendResult); } return; } else { IAsyncResult closeResult = ((MimeWriter)context._writer).BeginClose(new AsyncCallback(MimeWriterCloseCallback), context); if (closeResult.CompletedSynchronously) { MimeWriterCloseCallbackHandler(closeResult); } } }
private void ContentStreamCallbackHandler(IAsyncResult result) { MimePartContext asyncState = (MimePartContext)result.AsyncState; asyncState.outputStream = asyncState.writer.EndGetContentStream(result); asyncState.writer = new MimeWriter(asyncState.outputStream, base.ContentType.Boundary); if (asyncState.partsEnumerator.MoveNext()) { MimeBasePart current = asyncState.partsEnumerator.Current; this.mimePartSentCallback = new AsyncCallback(this.MimePartSentCallback); IAsyncResult result2 = current.BeginSend(asyncState.writer, this.mimePartSentCallback, asyncState); if (result2.CompletedSynchronously) { this.MimePartSentCallbackHandler(result2); } } else { IAsyncResult result3 = ((MimeWriter)asyncState.writer).BeginClose(new AsyncCallback(this.MimeWriterCloseCallback), asyncState); if (result3.CompletedSynchronously) { this.MimeWriterCloseCallbackHandler(result3); } } }