Chronos Plugins 5.4.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
CoffeeIngredient.cs
Go to the documentation of this file.
1using System.Collections.ObjectModel;
2using System.ComponentModel;
3using System.Linq;
6
8{
9
14 {
16 {
17 Puddles = new ReadOnlyObservableCollection<IConsumablePuddle>(mPuddles);
18 }
19
20 protected CoffeeIngredient(string ingredientName, MockDevice forDevice, CoffeeConsumableManager parentManager) : this()
21 {
22 ForDevice = forDevice;
23 ParentManager = parentManager;
24 ConsumableName = ingredientName;
25 }
26
27 private CoffeeIngredient(CoffeeIngredient copyFrom, CoffeeConsumableManager forManager) : this()
28 {
29 ForDevice = copyFrom.ForDevice;
30 ParentManager = forManager;
32 foreach (var somePuddle in copyFrom.mPuddles.OfType<CoffeeIngredientContainer>().Select(somePuddle => somePuddle.Clone(this)))
33 {
34 mPuddles.Add(somePuddle);
35 }
36 }
37
38 public MockDevice ForDevice { get; }
39
40 public event PropertyChangedEventHandler PropertyChanged;
42 public string ConsumableName { get; }
43
44 protected readonly ObservableCollection<IConsumablePuddle> mPuddles = new ObservableCollection<IConsumablePuddle>();
45 public ReadOnlyObservableCollection<IConsumablePuddle> Puddles { get; }
46
48 {
49 return new CoffeeIngredient(this, forManager);
50 }
51
52 // ReSharper disable once UnusedMember.Global
53 protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
54 {
55 PropertyChanged?.Invoke(this, e);
56 }
57 }
58}
A fake device. This namespace contains the fake device driver and auxiliary classes for settings,...
Information about the available consumables with a common name (like "Water" or "Liners")
Keeps track of all consumables that are associated to our mock coffee machine.
Base class for all used mock coffee ingredients.
ReadOnlyObservableCollection< IConsumablePuddle > Puddles
List of all different "storages" for the consumable. Those have some "location" and can contain a def...
CoffeeIngredient Clone(CoffeeConsumableManager forManager)
virtual void OnPropertyChanged(PropertyChangedEventArgs e)
CoffeeIngredient(string ingredientName, MockDevice forDevice, CoffeeConsumableManager parentManager)
IManageConsumables ParentManager
Reference to the manager that is responsible for this consumable pool.
PropertyChangedEventHandler PropertyChanged
readonly ObservableCollection< IConsumablePuddle > mPuddles
CoffeeIngredient(CoffeeIngredient copyFrom, CoffeeConsumableManager forManager)
string ConsumableName
User readable name of the managed consumable.
A chronos plugin implementation for a fake device. We pretend we are controlling a mixture of coffee ...
Definition: MockDevice.cs:53