public static bool startInjection(Syringe syringe) { try { communication.sendCommand(Commands.SET_PERIOD.ToString("D"), syringe.getDelay()); communication.sendCommand(Commands.RUN.ToString("D")); return(SUCCESS); } catch { return(ERROR); } }
public static bool startInjection(Syringe syringe, double injectionVolume, int currentPosition) { long stop = calculateProperties(syringe, injectionVolume, currentPosition); try { communication.sendCommand(Commands.SET_PERIOD.ToString("D"), syringe.getDelay()); communication.sendCommand(Commands.STOP_POS.ToString("D"), stop); communication.sendCommand(Commands.BOLUS.ToString("D")); return(SUCCESS); } catch { return(ERROR); } }
private void SetSpeed(object sender) { NumericUpDown nud = (NumericUpDown)sender; if (nud.Value == 0) { MessageBox.Show("Select a speed value!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { speed_val = Convert.ToDouble(nud.Value); DisplaySpeedValue(); set_speed.Enabled = false; syringe.setSpeed(speed_val); communication.sendCommand(Commands.SET_PERIOD.ToString("D"), syringe.getDelay()); } set_speed.Enabled = false; }