private void startPumping(PacientCodeEnum patCodeEnum, int periodSecounds) { if (dictPacientPump.ContainsKey(patCodeEnum)) { MessageBox.Show("The selecteed pacient has the pump already started"); return; } PumpSensorValues sensorValuesPump = new PumpSensorValues(patCodeEnum.ToString(), periodSecounds); sensorValuesPump.StartPumping(); sensorValuesPump.newSensorValueEvent += new OnNewSensorValue(OnNewSensorValueHandler); dictPacientPump.Add(patCodeEnum, sensorValuesPump); }
private void bStopPumping_Click(object sender, EventArgs e) { PacientCodeEnum currPacientStop = (PacientCodeEnum)cbPacientCodeStart.SelectedItem; if (dictPacientPump.ContainsKey(currPacientStop)) { PumpSensorValues pumpToBeStoped = dictPacientPump[currPacientStop]; pumpToBeStoped.StopPumping(); dictPacientPump.Remove(currPacientStop); } else { MessageBox.Show("The selected pacient has no pump values started"); } }