private void cboSavedPositions_SelectedIndexChanged(object sender, EventArgs e) { if (cboSavedPositions.SelectedIndex != 0) { // get position from config SavedPosition position = config.GetMove(cboSavedPositions.SelectedItem.ToString()); trackBarBasic.Value = position.BasicAngle; trackBarShoulder.Value = position.SoulderAngle; trackBarEllbow.Value = position.EllbowAngle; trackBarWristVert.Value = position.HandAngle_ver; trackBarWristRot.Value = position.HandAngle_rot; trackBarGripper.Value = position.Gripper; } }
//return the savedPosition with the name //if name doesn't exist --> return null public SavedPosition GetMove(string name) { SavedPosition temp = null; foreach (SavedPosition p in StandardPositions) { if (p.Name == name) { temp = p; break; } } return(temp); }