Пример #1
0
        public static void Main(string[] args)
        {
            var ventilator = new Ventilator();

            ventilator.startVentilate();
            ventilator.pauseVentilate();
            ventilator.startVentilate();
            ventilator.stopVentilate();
            ventilator.stopVentilate();

            // OUTPUT
            // Ventilator is ventilating 1
            // Ventilator is ventilating 2
            // Ventilator is ventilating 3
            // Ventilator change state disabled pause
            // Ventilator is paused
            // Ventilator change state enabled start
            // Ventilator is ventilating 1
            // Ventilator is ventilating 2
            // Ventilator is ventilating 3
            // Ventilator change state disabled stop
            // Ventilator is disabled
            // Ventilator is disabled
        }
Пример #2
0
 public EnabledState(Ventilator ventilator)
 {
     this.ventilator = ventilator;
 }