void Chatting_eChatEvent(ChatRoom cr, Chatting.ChatEvent e, User user,object data) { Dispatcher.Invoke(new Action(() => { ChatWindow cw = Program.ChatWindows.FirstOrDefault(cww => cww.ID == cr.ID); if (cw == null) { ChatWindow c = new ChatWindow(cr.ID); c.Loaded += delegate { c.ChatEvent(cr, e, user, data); }; Program.ChatWindows.Add(c); if(cr.ID != 0) c.Show(); } else { if (cw.ID != 0) { cw.Show(); } } })); }
void gi_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { GroupChatListItem gi = sender as GroupChatListItem; if (gi != null) { foreach (ChatWindow cw in Program.ChatWindows) { if (gi.ThisRoom.ID == cw.ID) { cw.Show(); return; } } if (gi.ThisRoom.ID == 0) { ChatWindow cw = new ChatWindow(0); Program.ChatWindows.Add(cw); cw.Show(); } } }