Example #1
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            BotListView.LargeImageList = BotListView.SmallImageList = AvatarImageList;

            Program.InitCore();
            Logging.InitFormLogger();
            await Program.InitASF();             // No ConfigureAwait, we need GUI thread

            foreach (KeyValuePair <string, Bot> bot in Bot.Bots)
            {
                BotStatusForm botStatusForm = new BotStatusForm(bot.Value);

                BotIndexes[bot.Key] = AvatarImageList.Images.Count;

                AvatarImageList.Images.Add(bot.Key, botStatusForm.AvatarPictureBox.Image);

                botStatusForm.TopLevel = false;
                BotStatusPanel.Controls.Add(botStatusForm);

                ListViewItem botListViewItem = new ListViewItem {
                    ImageIndex = BotIndexes[bot.Key],
                    Text       = bot.Key
                };

                BotListView.Items.Add(botListViewItem);
            }

            if (BotListView.Items.Count <= 0)
            {
                return;
            }

            BotListView.Items[0].Selected = true;
            BotListView.Select();
        }