March 2018
Beginner to intermediate
410 pages
10h 40m
English
Our data source will only contain two static embedded root nodes. We add these in code:
public static ActuatorNode ActuatorNode = new ActuatorNode();
public static SensorNode SensorNode = new SensorNode();
public IEnumerable<INode> RootNodes =>
new INode[] { ActuatorNode, SensorNode };
Access to all nodes in the source is provided through the GetNodeAsync method. Since our implementation only contains two static nodes, we do a simple if-then-else sequence to check for the identities. In a more dynamic setting, some form of look-up procedure would be used:
public Task<INode> GetNodeAsync(IThingReference NodeRef) { if (SensorNode.SameThing(NodeRef)) return Task.FromResult<INode>(SensorNode); else if (ActuatorNode.SameThing(NodeRef)) ...Read now
Unlock full access