private bool AddChat() { AddChatViewModel acvm = new AddChatViewModel(); AddChatWindow acw = new AddChatWindow(acvm); if (acw.ShowDialog() == true) { if (chatManager.AddChat(acvm.ChatName, acvm.Password)) { ChatTab chatTab = new ChatTab(acvm.ChatName); ChatTabs.Add(chatTab); return(true); } } return(false); }
public bool AddMessage(string chatTabName, ChatMessage message) { lock (_locker) { var existing = ChatTabs.Where(c => c.Name == chatTabName); if (existing.Count() == 0) { ChatTab chatTab = new ChatTab(chatTabName); chatTab.ChatMessages.Add(message); ChatTabs.Add(chatTab); } else { existing.Select(c => { c.ChatMessages.Add(message); return(c); }).ToList(); } } return(true); }