private void cmb_params_SelectedIndexChanged(object sender, EventArgs e) { lbl_message.Text = ""; paramSelected = (GrblParameterBase)this.cmb_params.SelectedItem; Description = paramSelected.Desc + " (" + paramSelected.Unit + ")"; string displayText = string.Empty; string unit = paramSelected.Unit; switch (paramSelected.ValueType) { case "int": SetValue(paramSelected.Val, EditorType.Int); break; case "float": SetValue(paramSelected.Val, EditorType.Float); break; case "bool": SetValue(paramSelected.Val, EditorType.Bool); displayText = paramSelected.Val; break; case "mask": SetValue(paramSelected.Val, EditorType.Mask); int intVal = int.Parse(paramSelected.Val); displayText = Pad(Convert.ToString(intVal, 2), 3, "0"); break; } }
private void btn_Update_Click(object sender, EventArgs e) { string msg = ValidateText(_textVal); if (msg == string.Empty) { GrblParameterBase selected = (GrblParameterBase)cmb_params.SelectedItem; string paramVal = GetValue(); DialogResult result = MessageBox.Show( $"Update {selected.Desc} from [{selected.Val}] to [{paramVal}]?", "Warning", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { grbl.UpdateParameter(selected.ID, paramVal); } } else { lbl_message.Text = msg; } }