private void MainForm_Load(object sender, EventArgs e) { Console = Cons; LoadUserData(); LoadBotData(); LoadConnect4Data(); Connect4Games = new List <MainGame>(); MainForm_Resize(null, null); var T1 = new System.Timers.Timer(1000); T1.Start(); T1.Elapsed += (s, t) => { T1.Dispose(); MyBot = new CodeSelBot(); }; var T2 = new System.Timers.Timer(10); T2.Start(); T2.Elapsed += (s, t) => { try { if (Cons.Text.EndsWith("Log: Disconnected\n")) { ConnectionState = "Disconnected"; } else if (Cons.Text.EndsWith("Log: Unknown Opcode: 9\n")) { ConnectionState = "Connection Error"; } else if (CodeSelBot.discord != null) { ConnectionState = CodeSelBot.discord.State.ToString(); } try { pictureBox_ServerStatus.Invoke(new Action(UpdateServerAvailability_PictureBox)); label_ServerStatus.Invoke(new Action(UpdateServerAvailability_Label)); } catch (Exception) { } } catch (Win32Exception) { } }; #if !DEBUG WindowState = FormWindowState.Minimized; #endif }
private void RunBot() { CodeSelBot.Connect(); }