Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        private void WhisperCallback(bool result, IAsyncResult ar)
        {
            WhisperAsyncResult whisperAsyncResult = ar as WhisperAsyncResult;

            if (whisperAsyncResult != null)
            {
                whisperAsyncResult.Result = result;
                whisperAsyncResult.Complete();
            }
        }
Beispiel #4
0
        public bool EndAsyncWhisperResultFromApp(IAsyncResult result)
        {
            WhisperAsyncResult whisperAsyncResult = result as WhisperAsyncResult;

            return(whisperAsyncResult != null && whisperAsyncResult.Result);
        }