Example #1
0
        private void GetBotsInfo(string[] addBots = null)
        {
            if (addBots != null)
            {
                foreach (string bot_server in addBots)
                {
                    BotServer bs = new BotServer(bot_server);
                    botServers.Add(bs);
                }
            }

            try
            {
                BeginInvoke(new Action(() => lv_BotsInfo.Items.Clear()));

                foreach (BotServer bot in botServers)
                {
                    BeginInvoke(new Action(() =>
                    {
                        lv_BotsInfo.Items.Add(new ListViewItem(bot.GetFullInfo()));
                    }));
                }
            }
            catch { }
        }
Example #2
0
        private void UpdatingStates()
        {
            Thread thr_update = new Thread(new ThreadStart(() =>
            {
                while (IsEnabledUpdating)
                {
                    //try
                    //{

                    BeginInvoke(new Action(() =>
                    {
                        int selected_index = 0;
                        bool SelectAgain   = false;

                        if (lv_BotsInfo.SelectedItems.Count > 0)
                        {
                            selected_index = lv_BotsInfo.SelectedItems[0].Index;
                            SelectAgain    = true;
                        }


                        for (int i = 0; i < botServers.Count; i++)
                        {
                            botServers[i] = new BotServer(botServers[i].TelegraphPage);

                            lv_BotsInfo.Items[i] = new ListViewItem(botServers[i].GetFullInfo());
                        }

                        if (SelectAgain == true)
                        {
                            lv_BotsInfo.Items[selected_index].Selected = true;
                        }
                    }));


                    //}
                    //catch { }

                    Thread.Sleep(2000);
                }
            }));

            thr_update.Start();
        }