private void GroupChatting_Btn_Click(object sender, RoutedEventArgs e) { if (client == null) { MessageBox.Show("먼저 로그인해주세요.", "Information", MessageBoxButton.OK, MessageBoxImage.Information); return; } string getUserProtocol = myName + "<GiveMeUserList>"; byte[] byteData = new byte[getUserProtocol.Length]; byteData = Encoding.Default.GetBytes(getUserProtocol); client.GetStream().Write(byteData, 0, byteData.Length); UserListWindow userListWindow = new UserListWindow(StaticDefine.GROUP_CHATTING); if (userListWindow.ShowDialog() == true) { string groupChattingUserStrData = MainWindow.myName; foreach (var item in userListWindow.GroupChattingReceivers) { groupChattingUserStrData += "#"; groupChattingUserStrData += item.userName; } string chattingStartMessage = string.Format("{0}<GroupChattingStart>", groupChattingUserStrData); byte[] chattingStartByte = Encoding.Default.GetBytes(chattingStartMessage); client.GetStream().Write(chattingStartByte, 0, chattingStartByte.Length); } }
private void OneOnOneChatting_Btn_Click(object sender, RoutedEventArgs e) { if (client == null) { MessageBox.Show("먼저 로그인해주세요.", "Information", MessageBoxButton.OK, MessageBoxImage.Information); return; } string getUserProtocol = myName + "<GiveMeUserList>"; byte[] byteData = new byte[getUserProtocol.Length]; byteData = Encoding.Default.GetBytes(getUserProtocol); client.GetStream().Write(byteData, 0, byteData.Length); UserListWindow userListWindow = new UserListWindow(StaticDefine.ONE_ON_ONE_CHATTING); if (userListWindow.ShowDialog() == true) { if (chattingThreadDic.ContainsKey(userListWindow.OneOnOneReceiver)) { MessageBox.Show("해당유저와는 이미 채팅중입니다.", "Information", MessageBoxButton.OK, MessageBoxImage.Information); return; } string chattingStartMessage = string.Format("{0}<ChattingStart>", userListWindow.OneOnOneReceiver); byte[] chattingStartByte = Encoding.Default.GetBytes(chattingStartMessage); client.GetStream().Write(chattingStartByte, 0, chattingStartByte.Length); } }