Example #1
0
 private void ShowErrorInChatControl(ChatMessagingControl chatControl, DateTime time, string text)
 {
     PrintMessage(chatControl, new Message {Text = text, TimeStamp = time},
                  ChatMessagingControl.MessageStyle.Error);
 }
Example #2
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();
 }
Example #3
0
 private void PrintMessage(ChatMessagingControl chatControl, Message message, ChatMessagingControl.MessageStyle style = ChatMessagingControl.MessageStyle.None)
 {
     chatControl.AddMessage(message, engine, style);
 }
Example #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));
 }