Пример #1
0
        private void LoadChannels(string playerAndServer)
        {
            List <ComboBoxItemDetails> items = new List <ComboBoxItemDetails>
            {
                new ComboBoxItemDetails {
                    Text = Properties.Resources.SELECT_ALL
                },
                new ComboBoxItemDetails {
                    Text = Properties.Resources.UNSELECT_ALL
                }
            };

            int selectedCount = 0;

            ChatManager.GetChannels(playerAndServer).ForEach(chan =>
            {
                selectedCount += chan.IsChecked ? 1 : 0;
                items.Add(chan);
            });

            channels.ItemsSource = items;

            if (items.Count > 0)
            {
                items[0].SelectedText = selectedCount + " Channels Selected";
                channels.SelectedItem = items[0];
            }
        }
Пример #2
0
        private void LoadChannels(string playerAndServer)
        {
            List <ChannelDetails> items = new List <ChannelDetails>();

            items.Add(new ChannelDetails {
                Text = "Select All"
            });
            items.Add(new ChannelDetails {
                Text = "Unselect All"
            });

            int selectedCount = 0;

            ChatManager.GetChannels(playerAndServer).ForEach(chan =>
            {
                selectedCount += chan.IsChecked ? 1 : 0;
                items.Add(chan);
            });

            channels.ItemsSource = items;

            if (items.Count > 0)
            {
                items[0].SelectedText = selectedCount + " Selected Channels";
                channels.SelectedItem = items[0];
            }
        }