Exemplo n.º 1
0
        private void loadChannels()
        {
            Variables.slackToken = token;

            var ch_name    = new List <string>();
            var ch_name_id = new Dictionary <string, string>();

            combobox_channels.DataSource = null;
            bList.Clear();
            combobox_channels.DataSource = bs;

            var    slackClient = new SlackClient(Variables.slackToken);
            string ch_response = slackClient.GetChannelsList(true).Content;
            var    ch          = JsonConvert.DeserializeObject <ChannelsListResponse>(ch_response);

            foreach (var item in ch.channels)
            {
                ch_name_id.Add(item.name, item.id);
            }

            foreach (var item in ch.channels)
            {
                ch_name.Add(item.name);
            }

            foreach (string name in ch_name)
            {
                bList.Add(name);
            }

            ch_list = ch_name;
            ch_dict = ch_name_id;
        }