private void ChangeMode(int mode) { Predator_Button.Enabled = false; User_Button.Enabled = false; Prey_Button.Enabled = false; ron.terminateRovio(); switch (mode) { case 1: ron = new predator(login[0], login[1], login[2]); Predator_Button.Enabled = false; User_Button.Enabled = true; Prey_Button.Enabled = true; break; case 2: ron = new Prey(login[0], login[1], login[2]); Predator_Button.Enabled = true; User_Button.Enabled = true; Prey_Button.Enabled = false; break; default: ron = new User(login[0], login[1], login[2]); Predator_Button.Enabled = true; User_Button.Enabled = false; Prey_Button.Enabled = true; break; } robot_thread = new System.Threading.Thread(new System.Threading.ThreadStart(ron.runRovio)); robot_thread.IsBackground = true; robot_thread.Start(); }
private void MainForm_Load(object sender, EventArgs e) { ron = new User(login[0], login[1], login[2]); map = new Mapping(); looker = new Vision(); robot_thread = new System.Threading.Thread(new System.Threading.ThreadStart(ron.runRovio)); map_thread = new System.Threading.Thread(new System.Threading.ThreadStart(map.runMap)); vision_thread = new System.Threading.Thread(new System.Threading.ThreadStart(looker.runVision)); robot_thread.IsBackground = true; map_thread.IsBackground = true; vision_thread.IsBackground = true; robot_thread.Start(); map_thread.Start(); vision_thread.Start(); }