public IAsyncResult BeginAsyncWhisperFromApp(string from, long toCID, string message, AsyncCallback callback, object asyncState) { WhisperAsyncResult whisperAsyncResult = new WhisperAsyncResult(callback, asyncState); if (this.WhisperedAsync != null) { WhisperAsyncEventArg e = new WhisperAsyncEventArg { From = from, ToCID = toCID, Message = message, AsyncResult = whisperAsyncResult, Callback = new WhisperCompleted(this.WhisperCallback) }; this.WhisperedAsync(this, e); return(whisperAsyncResult); } IAsyncResult result; try { result = whisperAsyncResult; } finally { whisperAsyncResult.Complete(); } return(result); }
public IAsyncResult BeginAsyncWhisperResultFromApp(long toCID, int resultNo, string receiverName, AsyncCallback callback, object asyncState) { WhisperAsyncResult whisperAsyncResult = new WhisperAsyncResult(callback, asyncState); if (this.WhisperedAsync != null) { WhisperResultAsyncEventArg e = new WhisperResultAsyncEventArg { ToCID = toCID, ResultNo = resultNo, ReceiverName = receiverName, AsyncResult = whisperAsyncResult, Callback = new WhisperCompleted(this.WhisperCallback) }; this.WhisperResultAsync(this, e); return(whisperAsyncResult); } IAsyncResult result; try { result = whisperAsyncResult; } finally { whisperAsyncResult.Complete(); } return(result); }
private void WhisperCallback(bool result, IAsyncResult ar) { WhisperAsyncResult whisperAsyncResult = ar as WhisperAsyncResult; if (whisperAsyncResult != null) { whisperAsyncResult.Result = result; whisperAsyncResult.Complete(); } }
public bool EndAsyncWhisperResultFromApp(IAsyncResult result) { WhisperAsyncResult whisperAsyncResult = result as WhisperAsyncResult; return(whisperAsyncResult != null && whisperAsyncResult.Result); }