public void AddChat(ChatRoom room) { var r = room; this.Dispatcher.Invoke(new Action(() => { var chatBarItem = new ChatBarItem(r) { Height = this.barHeight.Value }; chatBarItem.HeaderMouseUp += ChatBarItemOnPreviewMouseUp; this.Items.Add(chatBarItem); if (room.GroupUser != null && room.GroupUser.UserName.ToLowerInvariant() == "lobby") { return; } this.SelectedItem = chatBarItem; })); }
public void AddChat(ChatControl chat) { if (!Dispatcher.CheckAccess()) { Dispatcher.Invoke(new Action(() => this.AddChat(chat))); return; } var chatBarItem = new ChatBarItem(chat) { Height = this.barHeight.Value }; chatBarItem.HeaderMouseUp += ChatBarItemOnPreviewMouseUp; this.Items.Add(chatBarItem); Sounds.PlayMessageSound(); this.SelectedItem = chatBarItem; }
/// <summary> /// This happens when a new room is created. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="room"> /// The room. /// </param> private void LobbyCreateRoom(object sender, ChatRoom room) { var r = room; this.Dispatcher.Invoke(new Action(() => { if (Items.OfType <ChatBarItem>().Any(x => x.Room.Rid == room.Rid)) { return; } var chatBarItem = new ChatBarItem(r) { Height = this.barHeight.Value }; chatBarItem.HeaderMouseUp += ChatBarItemOnPreviewMouseUp; this.Items.Add(chatBarItem); if (room.GroupUser != null && room.GroupUser.UserName.ToLowerInvariant() == "lobby") { return; } this.SelectedItem = chatBarItem; })); }
/// <summary> /// This happens when a new room is created. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="room"> /// The room. /// </param> private void LobbyCreateRoom(object sender, ChatRoom room) { var r = room; this.Dispatcher.Invoke(new Action(() => { if (Items.OfType<ChatBarItem>().Any(x => x.Room.Rid == room.Rid)) return; var chatBarItem = new ChatBarItem(r) { Height = this.barHeight.Value }; chatBarItem.HeaderMouseUp += ChatBarItemOnPreviewMouseUp; this.Items.Add(chatBarItem); if (room.GroupUser != null && room.GroupUser.UserName.ToLowerInvariant() == "lobby") { return; } Sounds.PlayMessageSound(); this.SelectedItem = chatBarItem; })); }