diff --git a/VERSION b/VERSION
index 308c0cb..1365b92 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-8.2.2
+8.2.3
diff --git a/src/Moryx.ControlSystem/VisualInstructions/EnumInstructionResult.cs b/src/Moryx.ControlSystem/VisualInstructions/EnumInstructionResult.cs
index 882b55b..605f6c7 100644
--- a/src/Moryx.ControlSystem/VisualInstructions/EnumInstructionResult.cs
+++ b/src/Moryx.ControlSystem/VisualInstructions/EnumInstructionResult.cs
@@ -49,6 +49,20 @@ public static int ResultToEnumValue(Type resultEnum, InstructionResult result)
return int.Parse(result.Key);
}
+ ///
+ /// Extract result from response object depending on what values is present
+ ///
+ 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));
+ }
+
///
/// Convert string result to typed enum
///
diff --git a/src/Moryx.ControlSystem/VisualInstructions/VisualInstructorExtensions.cs b/src/Moryx.ControlSystem/VisualInstructions/VisualInstructorExtensions.cs
index dc900cd..5134d41 100644
--- a/src/Moryx.ControlSystem/VisualInstructions/VisualInstructorExtensions.cs
+++ b/src/Moryx.ControlSystem/VisualInstructions/VisualInstructorExtensions.cs
@@ -163,6 +163,7 @@ 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,
@@ -170,7 +171,7 @@ private static long ExecuteWithEnum(this IVisualInstructor instructor, string ti
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)