PM.BLL/PMService.cs
/// <summary>
/// Builds the commands required for a fixed workout
/// </summary>
/// <param name="interval">The interval</param>
/// <returns>An enumerable of the commands</returns>
Builds the commands required for a fixed workout
Builds the commands required for a fixed workout
private IEnumerable<ICommand>? BuildFixedWorkout(Interval interval)
        {
            if (interval == null)
            {
                _logger.LogError("Interval must be defined when setting a fixed workout. No workout has been set.");
                return null;
            }
            if (interval.WorkoutType == null || interval.Duration == null)
            {
                _logger.LogError("A minimum of workout type and duration must be defined when setting a fixed workout. No workout has been set.");
                return null;
            }
            WorkoutDetails? workoutDetails = GetWorkoutDetails(interval);
            if (workoutDetails == null)
            {
                _logger.LogError("An error occurred while extracting the workout details. No workout has been set.");
                return null;
            }
            IEnumerable<ICommand>? builtCommands = BuildInterval(interval, workoutDetails.Value);
            if (builtCommands == null)
            {
                _logger.LogError("An error occurred while building the interval. No workout has been set.");
                return null;
            }
            List<ICommand> commands = new(builtCommands);
            commands.AddRange(new List<ICommand>
            {
                new SetConfigureWorkoutCommand(WorkoutProgrammingMode.Enable),
                new SetScreenStateCommand(ScreenType.Workout, ScreenValueWorkout.PrepareToRowWorkout)
            });
            return commands;
        }
private IEnumerable < ICommand > ? BuildFixedWorkout ( Interval interval ) { if ( interval == null ) { _logger . LogError ( " " ) ; return null ; } if ( interval . WorkoutType == null || interval . Duration == null ) { _logger . LogError ( " " ) ; return null ; } WorkoutDetails ? workoutDetails = GetWorkoutDetails ( interval ) ; if ( workoutDetails == null ) { _logger . LogError ( " " ) ; return null ; } IEnumerable < ICommand > ? builtCommands = BuildInterval ( interval , workoutDetails . Value ) ; if ( builtCommands == null ) { _logger . LogError ( " " ) ; return null ; } List < ICommand > commands = new ( builtCommands ) ; commands . AddRange ( new List < ICommand > { new SetConfigureWorkoutCommand ( WorkoutProgrammingMode . Enable ) , new SetScreenStateCommand ( ScreenType . Workout , ScreenValueWorkout . PrepareToRowWorkout ) } ) ; return commands ; }
Builds the commands required for a fixed workout
Builds the commands required for a fixed workout
An enumerable of the commands
An enumerable of the commands
interval
Interval
None