private void SetSyringe(object sender) { ComboBox cb = (ComboBox)sender; if (syringeCombobox.SelectedItem == null) { validateSyringe(); } else { if (syringe != syringes[cb.SelectedIndex]) { syringe = syringes[cb.SelectedIndex]; decoder.setSyringe(syringe); reset(sw); } DisplaySpeedValue(); communication.sendCommand(Commands.HARD_STOP.ToString("D"), syringe.getStop()); set_syringe.Enabled = false; t.Start(); Thread.Sleep(100); t.Stop(); } }
private static long calculateProperties(Syringe syringe, double injectionVolume, int currentPosition) { double param = injectionVolume / (syringe.volume * 1000); long stop = (long)(currentPosition + getDistance(syringe, param)); return(stop); }
/// <summary> /// Create New Syringe Form. /// </summary> /// <param ID="id"> /// Id of new syringe to create /// </param> /// <param Decoder="d"></param> public NewSyringe(int id, ProgressDecoder d) { InitializeComponent(); initColors(); decoder = d; connector = SyringesBaseConnector.getInstance(); newSyringe = new Syringe() { ID = id }; this.ok_btn.DialogResult = DialogResult.OK; t = new System.Timers.Timer(); t.Interval = 25; t.Elapsed += new ElapsedEventHandler(getData); t.AutoReset = true; communication = Communication.getCommunicationManager(); speed_cmb.SelectedIndex = 0; decoder.NewPositionArrived += new EventHandler <DecoderArgs>(newPositionEvent); decoder.HomingDoneArrived += new EventHandler <DecoderArgs>(homeDoneEvent); }
public static bool startPosition(Syringe syringe) { try { long startPos = Convert.ToInt32(syringe.start_pos); communication.sendCommand(Commands.SET_START.ToString("D"), startPos); return(true); } catch { return(false); } }
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); } }
/// <summary> /// Add new Syringe. /// Write to CSV all values of new Syringe. /// </summary> /// <param Syringe object = "syringe"></param> /// <returns> /// return true if write, false if raise exception. /// </returns> public bool addSyringe(Syringe syringe) { try { using (StreamWriter sw = File.AppendText(path)) { sw.Write(string.Format("\n{0};{1};{2};{3};{4}", syringe.ID, syringe.name, syringe.volume, syringe.length, syringe.start_pos)); sw.Close(); } return(true); } catch { return(false); } }
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 static double getDistance(Syringe syringe, double param) { return(syringe.length * param); }
public void setSyringe(Syringe syringe) { this.syringe = syringe; }
public ProgressDecoder(Syringe syringe) { this.syringe = syringe; }