private void buttonConfig_Click(object sender, RibbonControlEventArgs e) { TimersConfiguration timersConfig = new TimersConfiguration(); Range range = Activesheet.Range["T6:U17"]; try { int rowStart = range.Row; int colStart = range.Column; for (int rowIndex = 0; rowIndex < 12; rowIndex++) { Range valueRange = Activesheet.Cells[rowStart + rowIndex, colStart]; int value = (int)valueRange.Value; Range keyRange = Activesheet.Cells[rowStart + rowIndex, colStart + 1]; String key = keyRange.Value.ToString(); switch (key) { case "AZQ9": timersConfig.periodCarrier = value; break; case "AZQ8": timersConfig.periodGap = value; break; case "AZQ22": timersConfig.onGap = value; break; case "AZQ23": timersConfig.offGap = value; break; case "AZQ13": timersConfig.periodBunch = value; break; case "AZQ16": timersConfig.dutyBunch = value; break; case "AZQ27": timersConfig.startGap = value; break; case "AZQ28": timersConfig.stopGap = value; break; case "AZQ35": timersConfig.startHigh = value; break; case "AZQ36": timersConfig.stopHigh = value; break; case "AZQ43": timersConfig.startLow = value; break; case "AZQ44": timersConfig.stopLow = value; break; } } client.setTimersConfiguration(timersConfig); } catch (Exception ex) { showMessage(ex.ToString()); } }
public void SetTimersConfiguraion(TimersConfiguration timersConfiguration) { TeslaCommunication.TimersConfiguration tc = new TeslaCommunication.TimersConfiguration(); Utils.Copy(timersConfiguration, tc); client.setTimersConfiguration(tc); }