コード例 #1
0
        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);
        }
コード例 #2
0
        private static WorkoutStepMesg CreateWorkoutStepRepeat(int messageIndex, uint repeatFrom, uint repetitions)
        {
            var workoutStepMesg = new WorkoutStepMesg();

            workoutStepMesg.SetMessageIndex((ushort)messageIndex);

            workoutStepMesg.SetDurationType(WktStepDuration.RepeatUntilStepsCmplt);
            workoutStepMesg.SetDurationValue(repeatFrom);

            workoutStepMesg.SetTargetType(WktStepTarget.Open);
            workoutStepMesg.SetTargetValue(repetitions);

            return(workoutStepMesg);
        }