コード例 #1
0
ファイル: WorkoutStepMesg.cs プロジェクト: dgaff/fitsdk
 /// <summary>        
 /// Set TargetType field</summary>
 /// <param name="targetType_">Nullable field value to be set</param>      
 public void SetTargetType(WktStepTarget? targetType_)
 {
     SetFieldValue(3, 0, targetType_, Fit.SubfieldIndexMainField);
 }
コード例 #2
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);
        }