private static WorkoutStepMesg CreateWorkoutStepSwim(int messageIndex, float distance, String name = null, String notes = null, Intensity intensity = Intensity.Active, SwimStroke swimStroke = SwimStroke.Invalid, WorkoutEquipment?equipment = null) { var workoutStepMesg = new WorkoutStepMesg(); workoutStepMesg.SetMessageIndex((ushort)messageIndex); if (name != null) { workoutStepMesg.SetWktStepName(name); } if (notes != null) { workoutStepMesg.SetNotes(notes); } workoutStepMesg.SetIntensity(intensity); workoutStepMesg.SetDurationType(WktStepDuration.Distance); workoutStepMesg.SetDurationDistance(distance); workoutStepMesg.SetTargetType(WktStepTarget.SwimStroke); workoutStepMesg.SetTargetStrokeType((byte)swimStroke); if (equipment.HasValue) { workoutStepMesg.SetEquipment(equipment); } return(workoutStepMesg); }
private static WorkoutStepMesg CreateWorkoutStep(int messageIndex, String name = null, String notes = null, Intensity intensity = Intensity.Active, WktStepDuration durationType = WktStepDuration.Open, uint?durationValue = null, WktStepTarget targetType = WktStepTarget.Open, uint targetValue = 0, uint?customTargetValueLow = null, uint?customTargetValueHigh = null) { if (durationType == WktStepDuration.Invalid) { return(null); } var workoutStepMesg = new WorkoutStepMesg(); workoutStepMesg.SetMessageIndex((ushort)messageIndex); if (name != null) { workoutStepMesg.SetWktStepName(name); } if (notes != null) { workoutStepMesg.SetNotes(notes); } workoutStepMesg.SetIntensity(intensity); workoutStepMesg.SetDurationType(durationType); if (durationValue.HasValue) { workoutStepMesg.SetDurationValue(durationValue); } if (targetType != WktStepTarget.Invalid && customTargetValueLow.HasValue && customTargetValueHigh.HasValue) { workoutStepMesg.SetTargetType(targetType); workoutStepMesg.SetTargetValue(0); workoutStepMesg.SetCustomTargetValueLow(customTargetValueLow); workoutStepMesg.SetCustomTargetValueHigh(customTargetValueHigh); } else if (targetType != WktStepTarget.Invalid) { workoutStepMesg.SetTargetType(targetType); workoutStepMesg.SetTargetValue(targetValue); workoutStepMesg.SetCustomTargetValueLow(0); workoutStepMesg.SetCustomTargetValueHigh(0); } return(workoutStepMesg); }