Chronos Plugins 5.9.0
This documentation covers the plugin interfaces definitions and an example implementation.
Loading...
Searching...
No Matches
CoffeMakerParams.cs
Go to the documentation of this file.
1using System;
2using System.ComponentModel;
3using System.Drawing.Design;
4
5namespace MockPlugin.Device
6{
14 [Serializable]
15 [Editor(typeof(CoffeeMakerParamsEditor),typeof(UITypeEditor))]
16 public class CoffeMakerParams
17 {
18 public bool AmbientLight { get; set; }
19 public int? WarmerTemperature { get; set; }
20
21 public override string ToString()
22 {
23 return $"Ambient light {(AmbientLight ? "on" : "off")}, warmer temperature (°C) {(WarmerTemperature?.ToString() ?? "(off)")}";
24 }
25
26 #region Overrides of Object
27
28 public override bool Equals(object obj)
29 {
30 return obj is CoffeMakerParams other && other.AmbientLight == AmbientLight &&
31 other.WarmerTemperature == WarmerTemperature;
32 }
33
38 public override int GetHashCode()
39 {
40 return ToString().GetHashCode();
41 }
42
43 #endregion
44
45 public int CompareTo(object obj)
46 {
47 if (obj is CoffeMakerParams other && other.AmbientLight == AmbientLight && other.WarmerTemperature == WarmerTemperature)
48 {
49 return 0;
50 }
51 else
52 {
53 return 1;
54 }
55 }
56
61 }
62}
A fake device. This namespace contains the fake device driver and auxiliary classes for settings,...
We have a fancy coffee machine that can regulate the warmer temperature for the pot and has lamps for...
override int GetHashCode()
Since all parameters are represented in the ToString representation, we can use its hash code instead...
override bool Equals(object obj)