void _BotCycle_Finishing(int id) { lock (this) { BotThreadItem bti = null; BotThreadControl btc = null; foreach (BotThreadItem i in listBotThreads.Items) { btc = i.BTC; if (btc.Id == id) { bti = i; break; } } if (bti == null) { return; } id2bot_thread_control.Remove(btc.Id); listBotThreads.Items.Remove(bti); this.groupBoxBotThread.Controls.Remove(btc); btc.Dispose(); MainForm.This.DisplayStatus2("Thread Count", Convert.ToString(listBotThreads.Items.Count)); } }
void _BotCycle_Created(int id) { BotThreadControl btc = (BotThreadControl)System.Activator.CreateInstance(GetBotThreadControlType(), id); btc.AutoSize = true; btc.Dock = System.Windows.Forms.DockStyle.Fill; btc.Location = new System.Drawing.Point(3, 16); btc.MinimumSize = new System.Drawing.Size(100, 100); btc.Size = new System.Drawing.Size(402, 286); btc.TabIndex = 0; // btc.Visible = false; this.groupBoxBotThread.Controls.Add(btc); lock (this) { id2bot_thread_control[id] = btc; listBotThreads.Items.Add(new BotThreadItem("#" + id, btc)); MainForm.This.DisplayStatus2("Thread Count", Convert.ToString(listBotThreads.Items.Count)); } }
public BotThreadItem(string name, BotThreadControl btc) { this.Name = name; BTC = btc; }
private void listBotThreads_SelectedIndexChanged(object sender, EventArgs e) { try { lock (this) { if (current_btc != null) current_btc.Visible = false; if (listBotThreads.SelectedIndex < 0) { current_btc = null; return; } current_btc = ((BotThreadItem)listBotThreads.Items[listBotThreads.SelectedIndex]).BTC; current_btc.Visible = true; groupBoxBotThread.SetText(current_btc.Text); } } catch (Exception ex) { LogMessage.Error(ex); } }