int messageCount;//number of message #endregion #region Constructor public ChatroomIHM(ClientChatRoom clientChatRoom, TopicForm topicForm) { this.topicForm = topicForm; this.clientChatRoom = clientChatRoom; InitializeComponent(); topicNameLabel.Text = clientChatRoom.Topic; }
private void JoinTopicButton_Click(object sender, EventArgs e) { ClientChatRoom chatroom = (ClientChatRoom)ctm.JoinTopic(CreateTopicTextBox.Text); Debug.WriteLine("MARCHE?"); chatroom.Join(chatter); chatroomIHM = new ChatroomIHM(chatroom); }
public void JoinTopic(string topic) { if (!topicRooms.ContainsKey(topic)) { ClientChatRoom chatroom = (ClientChatRoom)ctm.JoinTopic(topic); chatroom.Join(chatter); chatroom.Topic = topic; chatroomIHM = new ChatroomIHM(chatroom, this); topicRooms.Add(topic, chatroomIHM); chatroomIHM.Show(); } else { topicRooms[topic].Activate(); } }
public static void test() { IPAddress Ip = IPAddress.Parse("127.0.0.1"); int port = 55555; ServerGestTopics server = new ServerGestTopics(Ip); ParameterizedThreadStart ts = new ParameterizedThreadStart(server.startServer); Thread t = new Thread(ts); t.Start(port); ClientGestTopics client1 = new ClientGestTopics(port, Ip); Thread test1 = new Thread(new ThreadStart(client1.connect)); test1.Start(); ClientGestTopics client2 = new ClientGestTopics(port, Ip); Thread test2 = new Thread(new ThreadStart(client2.connect)); test2.Start(); client1.createTopic("Ruby"); client1.createTopic("Java"); client2.createTopic("PHP"); Console.WriteLine(client1.listTopics()); ClientChatRoom cr1 = (ClientChatRoom)client1.joinTopic("PHP"); ClientChatRoom cr2 = (ClientChatRoom)client2.joinTopic("PHP"); TextChatter bob = new TextChatter("bob"); TextChatter joe = new TextChatter("joe"); cr1.join(bob); cr1.post("Je suis seul ou quoi ?", bob); cr2.join(joe); cr1.post("Tiens, salut Bob !", bob); cr2.post("Yop", joe); cr1.receiveMessages(); // cr1.quit(bob); cr2.post("Toi aussi tu chat sur les forums de jeux pendant les TP,Bob ?", joe); }
public void sendHistoryMessages(List <UserChatMessage> userChatMsgs, ClientChatRoom chatRoom) { _hub.Clients.Caller.receiveHistoryMessage(userChatMsgs, chatRoom, DateTime.Now); }
public void receiveChatMessage(string userId, UserChatMessage userChatMsg, ClientChatRoom chatRoom, bool isOnline) { _hub.Clients.User(userId).receiveChatMessage(userChatMsg, chatRoom, isOnline); }
public void initiateChatUI(string userId, ClientChatRoom chatRoom, bool isOnline, int totalUnreadMsg = 0) { _hub.Clients.User(userId).initiateChatUI(chatRoom, isOnline, totalUnreadMsg); }
public void setCR(ClientChatRoom currentCR) { this.currentCR = currentCR; }