Beispiel #1
0
        private void CreatePrivatePage(int userId, bool getPendingMessages = true)
        {
            var user = AllUsers.Instance.GetUser(userId);

            if (user == null)
            {
                return;
            }
            var userKey = userId.ToString();

            CreatePage(userKey, user.NickName);
            var newPage        = tabControl.TabPages[userKey];
            var newChatControl = new ChatMessagingControl {
                Dock = DockStyle.Fill
            };

            newChatControl.MessageEnteted   += message => engine.SendPrivateMessage(userId, message);
            newChatControl.ConversationLeft += () => LeaveConversationButtonClicked(userKey);
            newChatControl.Enable(engine.IsOnline());
            newPage.Controls.Add(newChatControl);
            UpdateImageIndexForPage(userKey);
            // posting old messages
            engine.GetPrivateMessages(userId).ForEach(m => PrintMessage(newChatControl, m));
            if (getPendingMessages)
            {
                engine.GetPendingPrivateMessages();
            }
        }
Beispiel #2
0
        private void CreatePageForRoom(string roomName)
        {
            CreatePage(roomName, roomName);
            var newPage        = tabControl.TabPages[roomName];
            var newChatControl = new ChatMessagingControl {
                Dock = DockStyle.Fill
            };

            newChatControl.MessageEnteted   += message => engine.SendMessage(roomName, message);
            newChatControl.ConversationLeft += () => LeaveConversationButtonClicked(roomName);
            newChatControl.Enable(engine.IsOnline());
            newPage.Controls.Add(newChatControl);
            UpdateImageIndexForPage(roomName);
            // posting old messages
            engine.GetMessages(roomName).ForEach(m => PrintMessage(newChatControl, m));
        }
Beispiel #3
0
 private void CreatePrivatePage(int userId, bool getPendingMessages = true)
 {
     var user = AllUsers.Instance.GetUser(userId);
     if (user == null)
         return;
     var userKey = userId.ToString();
     CreatePage(userKey, user.NickName);
     var newPage = tabControl.TabPages[userKey];
     var newChatControl = new ChatMessagingControl { Dock = DockStyle.Fill };
     newChatControl.MessageEnteted += message => engine.SendPrivateMessage(userId, message);
     newChatControl.ConversationLeft += () => LeaveConversationButtonClicked(userKey);
     newChatControl.Enable(engine.IsOnline());
     newPage.Controls.Add(newChatControl);
     UpdateImageIndexForPage(userKey);
     // posting old messages
     engine.GetPrivateMessages(userId).ForEach(m => PrintMessage(newChatControl, m));
     if (getPendingMessages)
         engine.GetPendingPrivateMessages();
 }
Beispiel #4
0
 private void CreatePageForRoom(string roomName)
 {
     CreatePage(roomName, roomName);
     var newPage = tabControl.TabPages[roomName];
     var newChatControl = new ChatMessagingControl { Dock = DockStyle.Fill };
     newChatControl.MessageEnteted += message => engine.SendMessage(roomName, message);
     newChatControl.ConversationLeft += () => LeaveConversationButtonClicked(roomName);
     newChatControl.Enable(engine.IsOnline());
     newPage.Controls.Add(newChatControl);
     UpdateImageIndexForPage(roomName);
     // posting old messages
     engine.GetMessages(roomName).ForEach(m => PrintMessage(newChatControl, m));
 }