private void setCompassParamsButton_Click(object sender, EventArgs e) { ParameterInputBox tib = new ParameterInputBox(Properties.Settings.Default.compassParams); DialogResult result; result = tib.ShowDialog(); if (result == DialogResult.OK) { Properties.Settings.Default.compassParams = tib.parameters; Properties.Settings.Default.Save(); setupCompass(); } }
private void setCompassParamsButton_Click(object sender, EventArgs e) { String calibrationString = ""; int index = -1; if (Properties.Settings.Default.compassParams2 != null) { foreach (String str in Properties.Settings.Default.compassParams2) { if (str.StartsWith(spatial.SerialNumber.ToString())) { index = Properties.Settings.Default.compassParams2.IndexOf(str); calibrationString = str.Substring(str.IndexOf(',') + 1); break; } } } ParameterInputBox tib = new ParameterInputBox(calibrationString); DialogResult result; result = tib.ShowDialog(); if (result == DialogResult.OK) { //remove old string, add the new one if (index >= 0) Properties.Settings.Default.compassParams2.RemoveAt(index); if (Properties.Settings.Default.compassParams2 == null) Properties.Settings.Default.compassParams2 = new System.Collections.Specialized.StringCollection(); if(tib.parameters.Length > 0) Properties.Settings.Default.compassParams2.Add(spatial.SerialNumber.ToString() + "," + tib.parameters); Properties.Settings.Default.Save(); setupCompass(); } }