private void OnRobotChange(object sender, TopBar.RobotChangeEventArgs e) { if (connectionThread == null || connectionThread.IsAlive == false) { currentConfig = e.ConfigFiles; connectionThread = new Thread(new ThreadStart(delegate() { connect(); })); connectionThread.Start(); } else { e.Cancel = true; } }
private void OnRobotChange(object sender, TopBar.RobotChangeEventArgs e) { try { if (connectionThread == null || connectionThread.IsAlive == false) { // Initialize Myro connectionThread = new Thread(new ThreadStart(delegate() { connect(e.ConfigFiles); })); connectionThread.Start(); } } catch (Exception err) { GUIUtilities.ReportUnexpectedException(err); } }