Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxantron committed Oct 11, 2024
2 parents 9223da4 + 0f8aa29 commit 2abb4e5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.2.2
8.2.3
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ public static int ResultToEnumValue(Type resultEnum, InstructionResult result)
return int.Parse(result.Key);
}

/// <summary>
/// Extract result from response object depending on what values is present
/// </summary>
public static int ResultToEnumValue(Type resultEnum, ActiveInstructionResponse response)
{
if(response.SelectedResult != null)
return ResultToEnumValue(resultEnum, response.SelectedResult);

if (response.Result != null)
return ResultToEnumValue(resultEnum, response.Result);

throw new ArgumentException("No result found on response", nameof(response));
}

/// <summary>
/// Convert string result to typed enum
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,15 @@ private static long ExecuteWithEnum(this IVisualInstructor instructor, string ti

var results = EnumInstructionResult.PossibleResults(attr.ResultEnum);
var resultObjects = EnumInstructionResult.PossibleInstructionResults(attr.ResultEnum);

return instructor.Execute(new ActiveInstruction
{
Title = title,
Instructions = parameters,
PossibleResults = results,
Results = resultObjects.ToArray(),
Inputs = inputs
}, instructionResponse => callback(EnumInstructionResult.ResultToEnumValue(attr.ResultEnum, instructionResponse.Result), instructionResponse.Inputs, activityStart));
}, instructionResponse => callback(EnumInstructionResult.ResultToEnumValue(attr.ResultEnum, instructionResponse), instructionResponse.Inputs, activityStart));
}

private static VisualInstruction[] GetInstructions(ActivityStart activity)
Expand Down

0 comments on commit 2abb4e5

Please sign in to comment.