/// <summary> /// Initiates the CPR sequence based on /// the provided rythm style. /// </summary> public void BeginSequence(RythmStyle style) { if (startTime == null) { startTime = DateTime.Now; } if (cycles == 1) { if (stepSize == StepSize.Small) { smallNShock2.PreviousStep = step1; smallNShock2.NextStep = step1; steps.Remove(smallNShock1); } else { smallNShock2.PreviousStep = step1; smallNShock2.NextStep = step1; steps.Remove(smallNShock1); } } switch (style) { case RythmStyle.Shockable: CurrentStep.NextStep = smallShock1; break; case RythmStyle.NonShockable: if (stepSize == StepSize.Big) { CurrentStep.NextStep = steps[2]; } else { CurrentStep.NextStep = steps[3]; } break; } }
public IRythmStyleProcessor GetNewStyle(RythmStyle rythmStyle, AudioMetadata audioMetadata) { if (rythmStyle == RythmStyle.Regular) { return(new RegularRythmStyleProcessor()); } if (rythmStyle == RythmStyle.Chains) { return(new ChainRythmStyleProcessor()); } if (rythmStyle == RythmStyle.FeverTime) { return(new FeverRythmStyleProcessor()); } if (rythmStyle == RythmStyle.DoublesSame) { return(new DoublesSameRythmStyleProcessor()); } if (rythmStyle == RythmStyle.SimpleObstacle) { return(new SimpleObstacleRythmStyleProcessor(audioMetadata)); } throw new ArgumentOutOfRangeException(nameof(rythmStyle)); }
/// <summary> /// Adds drug shots to the drug queue if it /// does not exist in it already. /// </summary> public void AddDrugsToQueue(ObservableCollection <DrugShot> list, RythmStyle style) { if (drugs != null && drugs.Count > 0) { foreach (Drug drug in drugs) { var shot = drug.GetDrugShot(Cycles, style); if (shot != null && !list.Contains(shot)) { if (cycles == 0 && CurrentStep.NextStep.RythmStyle == RythmStyle.NonShockable) { shot.TimeRemaining = TimeSpan.FromMinutes(2); list.Add(shot); } else { shot.ResetShot(); list.Add(shot); } } } } }
/// <summary> /// Gets the correct DrugShot based on total cycles. /// </summary> /// <param name="cycles">Total Cycles</param> /// <param name="style">Shockable/Non-Shockable</param> /// <returns>Returns a drugshot for the current situation. Null if there isn't one.</returns> public DrugShot GetDrugShot(int cycles, RythmStyle style) { DrugShot result = null; switch (DrugType) { case DrugType.Adrenalin: //result = Doses[0]; // Address adrenaline immediatelly on the // first non-shockable step, then every // 3-5 minutes. switch (style) { case RythmStyle.NonShockable: // Address immediatelly in NShockable if (Injected == false) { Injected = true; LastInjection = DateTime.Now.Add(TimeSpan.FromMinutes(2)); result = Doses[0]; } // Then every 3-5 minutes else if (cycles >= 1 && DateTime.Now.Subtract(LastInjection).TotalMinutes >= 3) { LastInjection = DateTime.Now.Add(TimeSpan.FromMinutes(3)); result = Doses[0]; } break; case RythmStyle.Shockable: // Address first time in Shockable after 3 cycles if (cycles >= 2 && Injected == false) { Injected = true; LastInjection = DateTime.Now.Add(PrepTime); result = Doses[0]; } // Then every 3-5 minutes else if (cycles > 3 && DateTime.Now.Subtract(LastInjection).TotalMinutes >= 3) { result = Doses[0]; LastInjection = DateTime.Now.Add(TimeSpan.FromMinutes(3)); } break; } break; case DrugType.Amiodaron: if (style == RythmStyle.Shockable) { // Give at 3rd cycle, smaller dose if // cycles >= 5. if (cycles >= 3 && cycles % 3 == 0 && Injected == false) { result = Doses[0]; LastInjection = DateTime.Now.Add(PrepTime); } // Address after 5 additional cycles, // rather than 5 in total else if (cycles >= 5 && Injected == true && ((cycles - 3) % 5) == 0) { result = Doses[1]; LastInjection = DateTime.Now.Add(PrepTime); } } break; case DrugType.Bikarbonat: case DrugType.Calcium: result = Doses[0]; LastInjection = DateTime.Now.Add(PrepTime); break; } return(result); }