private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount == 2) { if ((sender as TextBlock).Text != App.Socket.Nick) { ChatRoom privateRoom = new ChatRoom((sender as TextBlock).Text); privateRoom.UserList.Add(App.Socket.Nick); privateRoom.UserList.Add((sender as TextBlock).Text); ChatRooms.Add(privateRoom); } } }
private void Socket_TextMessageRecieved(object sender, TextMessage e) { Dispatcher.BeginInvoke(new Action(() => { ChatRoom activeRoom = ChatRooms[0]; if (e.Command.Key.StartsWith("private")) { activeRoom = ChatRooms.FirstOrDefault(x => x.Name == e.From); if (activeRoom == null) { activeRoom = new ChatRoom(e.From); activeRoom.UserList.Add(App.Socket.Nick); activeRoom.UserList.Add(e.From); ChatRooms.Add(activeRoom); } e.Text = e.Command.Value.Substring(e.Command.Value.IndexOf(' ') + 1); } activeRoom.History.Add(e); })); }