private void updateChannelsMenu(IEnumerable <string> selectedChannels) { // todo: merge this method with the notes one // remove possible previous entries while (ChannelsMenu_shortcuts > 0) { //OutCommands.Add(_separator); ChannelsMenu.RemoveAt(0); ChannelsMenu_shortcuts -= 1; } if (_selectedChannels.Count == 0) { return; } // else, create the selected channel options, one per channel. This list is already of unique channels _selectedChannelsMenuItem.Children = _selectedChannels.Select(c => new MenuItemViewModel { Text = c, Tag = c }).ToList(); foreach (var item in _selectedChannelsMenuItem.Children) { ChannelsMenu.Insert(0, item); ChannelsMenu_shortcuts += 1; } }
private void updateChannelsMenu(IEnumerable <string> selectedChannels) { // todo: merge this method with the notes one if (!_selectedChannels.Where(c => c != _channel).Any()) { // if we have a single channel, remove the seperator if (ChannelsMenu.Contains(_selectedChannelsMenuItem)) { ChannelsMenu.Remove(SEPARATOR); ChannelsMenu.Remove(_selectedChannelsMenuItem); } return; } // else, create the selected channel options, one per channel. This list is already of unique channels _selectedChannelsMenuItem.Children = _selectedChannels.Select(c => new MenuItemViewModel { Text = c, Tag = c }).ToList(); if (!ChannelsMenu.Contains(_selectedChannelsMenuItem)) { ChannelsMenu.Insert(0, SEPARATOR); ChannelsMenu.Insert(0, _selectedChannelsMenuItem); } }
private void updateChannelsMenu(IEnumerable <string> selectedChannels) { if (!_selectedChannels.Where(c => c != _channel).Any()) { if (ChannelsMenu.Contains(_selectedChannelsMenuItem)) { ChannelsMenu.Remove(SEPARATOR); ChannelsMenu.Remove(_selectedChannelsMenuItem); } return; } _selectedChannelsMenuItem.Children = _selectedChannels.Select(c => new MenuItemViewModel { Text = c, Tag = c }).ToList(); if (!ChannelsMenu.Contains(_selectedChannelsMenuItem)) { ChannelsMenu.Add(SEPARATOR); ChannelsMenu.Add(_selectedChannelsMenuItem); } }