private void listBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) { var newConversation = ((ListBoxItem)sender).Content.ToString(); if (newConversation == mainWindow.username) { MessageBox.Show("You can't talk to yourself", "Error!"); return; } var windowDialog = new WindowDialog(); this.currentConversations.Add(newConversation, windowDialog); windowDialog.Owner = this; windowDialog.Show(); }
private void privateMessagesTimer_Tick(object sender, EventArgs e) { var privateMessages = mainWindow.proxy.Receive(mainWindow.username); foreach (var message in privateMessages) { if (!this.currentConversations.ContainsKey(message.From)) { var newConversation = message.From; var windowDialog = new WindowDialog(); this.currentConversations.Add(newConversation, windowDialog); windowDialog.Owner = this; windowDialog.Show(); } this.currentConversations[message.From].listBoxConversation.Items.Add(message.From + ": " + message.Text); } }