//Stop all running threads and switchers
        private void MainInterface_FormClosing(object sender, FormClosingEventArgs e)
        {
            InputDataTimer.Stop();
            ImageUpdateTimer.Stop();
            Log.Info("Update timers stopped.");

            robotThread.StopAsync();
            cameraThread.StopAsync();
            inputThread.StopAsync();
            controlsThread.StopAsync();

            robotThread.Stop();
            cameraThread.Stop();
            inputThread.Stop();
            controlsThread.Stop();
            Log.Info("All threads stopped.");

            Log.Stop();
        }
        //Once window loads, initialize logging window, load settings, and start threads
        private void MainInterface_Load(object sender, EventArgs e)
        {
            if (!settings.Load())
            {
                MessageBox.Show("An error occured while loading the settings.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            controlsThread.Settings = settings;

            Log.Info("Main window loaded.");
            cameraThread.Start();
            controlsThread.Start();
            Log.Info("Threads started.");

            InputDataTimer.Start();
            ImageUpdateTimer.Start();
            Log.Info("Update timers started.");

            robotThread.OnIdCollisionDetected += RobotThread_OnIdCollisionDetected;
            robotThread.OnConnectFailed       += RobotThread_OnConnectFailed;
            robotThread.OnTimeoutWarning      += RobotThread_OnTimeoutWarning;
            robotThread.OnErrorReceived       += RobotThread_OnErrorReceived;
        }