Exemplo n.º 1
0
        public IAsyncResult BeginJoinChatRoom(long guildKey, long cid, string sender, AsyncCallback callback, object asyncState)
        {
            JoinAsyncResult joinAsyncResult = new JoinAsyncResult(callback, asyncState);

            if (this.JoinRequested != null)
            {
                ChatJoinEventArg e = new ChatJoinEventArg
                {
                    GuildKey    = guildKey,
                    CID         = cid,
                    Sender      = sender,
                    AsyncResult = joinAsyncResult,
                    Callback    = new JoinCompleted(this.JoinCallback)
                };
                this.JoinRequested(this, e);
                return(joinAsyncResult);
            }
            IAsyncResult result;

            try
            {
                result = joinAsyncResult;
            }
            finally
            {
                joinAsyncResult.Complete();
            }
            return(result);
        }
Exemplo n.º 2
0
        public string EndJoinChatRoom(IAsyncResult result)
        {
            JoinAsyncResult joinAsyncResult = result as JoinAsyncResult;

            if (joinAsyncResult != null)
            {
                return(joinAsyncResult.Result);
            }
            return(null);
        }
Exemplo n.º 3
0
        private void JoinCallback(string result, IAsyncResult ar)
        {
            JoinAsyncResult joinAsyncResult = ar as JoinAsyncResult;

            if (joinAsyncResult != null)
            {
                joinAsyncResult.Result = result;
                joinAsyncResult.Complete();
            }
        }