Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
CoffeeIngredientContainer.cs
Go to the documentation of this file.
1using System.ComponentModel;
3using Ctc.Palplus.Integration.Driver.Entities;
4
6{
10 internal class CoffeeIngredientContainer : IConsumablePuddle
11 {
12 private Quantity mCurrentLevel;
13
14 public CoffeeIngredientContainer(CoffeeIngredient forPool, string location, string containerName, Quantity maxLevel, Quantity currentLevel)
15 {
16 ParentPool = forPool;
17 Location = CoffeeConsumableManager.GetLocationIdentifier(forPool.ForDevice, location);
18 MaxLevel = new Quantity(maxLevel.Value, maxLevel.Unit);
19 CurrentLevel = new Quantity(currentLevel.Value, currentLevel.Unit);
20 ContainerName = containerName;
21 }
22
23 public string ContainerName { get; }
24
25 public event PropertyChangedEventHandler PropertyChanged;
26 public IConsumablePool ParentPool { get; }
27 public string Location { get; }
28 public Quantity MaxLevel { get; }
29
30 public Quantity CurrentLevel
31 {
32 get => mCurrentLevel;
33 private set
34 {
35 mCurrentLevel = value;
36 PropertyChanged?.Invoke(this,new PropertyChangedEventArgs(nameof(CurrentLevel)));
37 }
38 }
39
40 public void ModifyBy(Quantity relativeAmount)
41 {
42 if (relativeAmount != null)
43 {
44 CurrentLevel = CurrentLevel + relativeAmount;
45 }
46 }
47
48 public void SetTo(Quantity absoluteAmount)
49 {
50 CurrentLevel = absoluteAmount;
51 }
52
53 public CoffeeIngredientContainer Clone(CoffeeIngredient forPool)
54 {
55 return new CoffeeIngredientContainer(forPool, Location, ContainerName, MaxLevel, CurrentLevel);
56 }
57 }
58
59}
Information about the available consumables with a common name (like "Water" or "Liners")
Implement this on the representation of a single source for some consumable.