-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathGatherStep.cs
More file actions
104 lines (92 loc) · 3.86 KB
/
GatherStep.cs
File metadata and controls
104 lines (92 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the Microsoft Research license.
namespace Sigma
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.Psi.Interop.Serialization;
/// <summary>
/// Represents a gather step.
/// </summary>
public class GatherStep : Step
{
/// <summary>
/// Initializes a new instance of the <see cref="GatherStep"/> class.
/// </summary>
public GatherStep()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="GatherStep"/> class.
/// </summary>
/// <param name="label">The step label.</param>
/// <param name="verb">The verb.</param>
/// <param name="noun">The noun.</param>
/// <param name="objects">The set of objects to gather.</param>
public GatherStep(string label, string verb, string noun, List<string> objects)
{
this.Label = label;
this.Verb = verb;
this.Noun = noun;
this.Objects = objects;
}
/// <summary>
/// Gets or sets the step label.
/// </summary>
public string Label { get; set; }
/// <summary>
/// Gets or sets the verb.
/// </summary>
public string Verb { get; set; }
/// <summary>
/// Gets or sets the noun.
/// </summary>
public string Noun { get; set; }
/// <summary>
/// Gets or sets the set of objects to gather.
/// </summary>
public List<string> Objects { get; set; }
/// <inheritdoc/>
public override string GetSpokenInstructions() => $"{this.Verb} the {this.Noun.ToLower()} listed below.";
/// <inheritdoc/>
public override string GetDisplayInstructions() => $"{this.Noun}:";
/// <inheritdoc/>
public override StepPanel UpdateStepPanel(
StepPanel stepPanel,
TaskPanelUserInterfaceCommand taskPanelUserInterfaceCommand,
TaskPanelUserInterfaceConfiguration taskPanelUserInterfaceConfiguration,
float maxHeigth,
string name)
{
var gatherStepPanel = (stepPanel as GatherStepPanel) ?? new GatherStepPanel(
taskPanelUserInterfaceConfiguration.Width,
taskPanelUserInterfaceConfiguration.Padding,
taskPanelUserInterfaceConfiguration.AccentColor,
taskPanelUserInterfaceConfiguration.StepInstructionsTextStyle,
taskPanelUserInterfaceConfiguration.GatherStepObjectColor,
taskPanelUserInterfaceConfiguration.GatherStepObjectTextStyle,
taskPanelUserInterfaceConfiguration.GatherStepHighlightObjectColor,
taskPanelUserInterfaceConfiguration.GatherStepHighlightObjectTextStyle,
name);
gatherStepPanel.Update(this.Label, this.GetDisplayInstructions(), taskPanelUserInterfaceCommand.ObjectsChecklist);
return gatherStepPanel;
}
/// <inheritdoc/>
public override void Write(BinaryWriter writer)
{
InteropSerialization.WriteString(this.Label, writer);
InteropSerialization.WriteString(this.Verb, writer);
InteropSerialization.WriteString(this.Noun, writer);
InteropSerialization.WriteCollection(this.Objects, writer, o => InteropSerialization.WriteString(o, writer));
}
/// <inheritdoc/>
public override void ReadFrom(BinaryReader reader)
{
this.Label = InteropSerialization.ReadString(reader);
this.Verb = InteropSerialization.ReadString(reader);
this.Noun = InteropSerialization.ReadString(reader);
this.Objects = InteropSerialization.ReadCollection(reader, InteropSerialization.ReadString)?.ToList();
}
}
}