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); }
public string EndJoinChatRoom(IAsyncResult result) { JoinAsyncResult joinAsyncResult = result as JoinAsyncResult; if (joinAsyncResult != null) { return(joinAsyncResult.Result); } return(null); }
private void JoinCallback(string result, IAsyncResult ar) { JoinAsyncResult joinAsyncResult = ar as JoinAsyncResult; if (joinAsyncResult != null) { joinAsyncResult.Result = result; joinAsyncResult.Complete(); } }