Update Broker

This commit is contained in:
2019-04-24 23:14:10 +02:00
parent 0f91751087
commit ab85e78f4c
7 changed files with 87 additions and 7 deletions

View File

@@ -25,6 +25,27 @@ namespace PlantBox.Broker
public PlantBox GetPlantBox(ulong id) => this[id];
public void Add(PlantBox plantBox)
{
ulong id = plantBox.ID;
if (_plantBoxes.ContainsKey(id))
{
_plantBoxes[id] = plantBox;
}
else
{
_plantBoxes.Add(id, plantBox);
}
}
public void UpdatePlantsState()
{
foreach (PlantBox plantBox in _plantBoxes.Values)
{
plantBox.UpdateState();
}
}
public void Load()
{
Console.WriteLine("Loading storage...");