public void setChannelMeasurement(int chn, Keithley2700MeasurementTypes type) { if (isValidChannelIndex(chn)) { measureType[chn] = type; changeSettings(); } }
private Keithley2700MeasurementTypes[] getMeasurementTypes() { Keithley2700MeasurementTypes[] types = new Keithley2700MeasurementTypes[dgvKeithley2700.Rows.Count]; int i = 0; foreach (DataGridViewRow row in dgvKeithley2700.Rows) { types[i] = (Keithley2700MeasurementTypes)Enum.Parse(typeof(Keithley2700MeasurementTypes), (string)row.Cells["Type"].Value, true); i++; } return(types); }
private void updateKeithleySettings() { if (ke2700Instr != null) { DataTable sett = k2700Setup.getKeithleyData(); ke2700Instr.settings.freezeSettings = true; for (int i = 0; i < sett.Rows.Count; i++) { int portNr = (int)(sett.Rows[i]["PortNumber"]) - 1; bool enabled = (bool)(sett.Rows[i]["Enabled"]); Keithley2700ChannelUnits unit = (Keithley2700ChannelUnits)sett.Rows[i]["Unit"]; Keithley2700MeasurementTypes type = (Keithley2700MeasurementTypes)sett.Rows[i]["MeasurementType"]; double range = (double)sett.Rows[i]["MaxRange"]; //keithleyData.Columns.Add("Unit", typeof(MeasurementUnit)); ke2700Instr.settings.setChannelEnabled(portNr, enabled); ke2700Instr.settings.setChannelUnit(portNr, unit); ke2700Instr.settings.setChannelMeasurement(portNr, type); ke2700Instr.settings.setChannelMaxRange(portNr, range); dgvKeithley2700.Rows[i].Cells["ChannelName"].Value = (string)sett.Rows[i][sett.Columns.IndexOf("Label")]; dgvKeithley2700.Rows[i].Cells["Type"].Value = type.ToString(); dgvKeithley2700.Rows[i].Cells["Enabled"].Value = (bool)sett.Rows[i][sett.Columns.IndexOf("Enabled")]; dgvKeithley2700.Rows[i].Cells["MaxRange"].Value = (double)sett.Rows[i][sett.Columns.IndexOf("MaxRange")]; } ke2700Instr.settings.freezeSettings = false; ke2700Instr.settings.settingsChanged = true; } }