コード例 #1
0
 private void BeginJoinChatRoomFinished(IAsyncResult ar)
 {
     currentOperation.End("BeginJoinChatRoomFinished", () => session.EndJoin(ar));
     currentOperation.Begin("Get Recent History:", () => session.BeginGetRecentChatHistory(30, BeginGetRecentChatHistoryFinished, null));
 }
コード例 #2
0
        private static void RoomChatHistory(ChatRoomSession session)
        {
            Console.WriteLine(String.Format("Obtaining the chat history in chat room [{0}]...", session.Name));

            // Get the three messages that were sent before, the simple chat message, the simple story, and the complicated message
            ReadOnlyCollection <ChatMessage> chatMessages = session.EndGetRecentChatHistory(session.BeginGetRecentChatHistory(3, null, null));

            Console.WriteLine(string.Format("Three most recent chat history messages: \n\t1) {0} \n\t2) {1} \n\t3) {2}",
                                            chatMessages[0].MessageContent, chatMessages[1].MessageContent, chatMessages[2].MessageContent));
        }
コード例 #3
0
        public void RoomChatHistory(ChatRoomSession session, int recentCount)
        {
            if (session == null)
            {
                return;
            }

            Console.WriteLine(String.Format("Obtaining the chat history in chat room [{0}]. 最近{1}条", session.Name, recentCount));

            // Get the three messages that were sent before, the simple chat message, the simple story, and the complicated message
            ReadOnlyCollection <ChatMessage> chatMessages = session.EndGetRecentChatHistory(session.BeginGetRecentChatHistory(recentCount, null, null));

            for (int i = 0; i < chatMessages.Count; i++)
            {
                Console.WriteLine(string.Format("recent chat history messages \n\t 第{0}条:ID:{1} 作者:{2} 时间: {3}内容:{4}", i, chatMessages[i].MessageId, chatMessages[i].MessageAuthor, chatMessages[i].Timestamp, chatMessages[i].MessageContent));
            }
        }