public void Add(ChannelSettings channelSettings) { if (channelSettings == null) { throw new ArgumentNullException(nameof(channelSettings)); } var list = Channels.ToList(); list.Add(channelSettings); Channels = list.ToArray(); }
private void OnChatMessage(ChatMessage message) { this.Do(() => { foreach (TabItem tabItem in _tabControl.Items) { if (tabItem.Header == message.Channel) { return; } } var chatSettings = new ChannelSettings { Channel = message.Channel, UseBlocking = true, RussianOnly = true }; _chatsSettings.Add(chatSettings); var chatControl = new ChatControl(_eventsSource, _chatsSettings) { Channels = new[] { message.Channel } }; var newItem = new TabItem { Header = message.Channel, Content = chatControl, ContextMenu = new ContextMenu() }; CreateContextMenu(chatControl, newItem.ContextMenu); _tabControl.Items.Add(newItem); chatControl.OnChatMessage(message); }); }