Esempio n. 1
0
        public override IEnumerator <InstructionBase> Simulate()
        {
            Console.WriteLine($"Going to sleep at time period {Context.TimePeriod}");

            // wait till the alarm rings
            yield return(new WaitNotificationInstruction <AlarmRingingNotification>());

            Console.WriteLine($"Alarm ringing at time period {Context.TimePeriod}");
            Console.WriteLine($"Going back to sleep at time period {Context.TimePeriod}");

            // go back to sleep and wait till it rings again
            yield return(new WaitNotificationInstruction <AlarmRingingNotification>());

            Console.WriteLine($"Alarm ringing again..waking up at time period {Context.TimePeriod}");

            // notify now awake
            var notification = new AwakeNotification();

            yield return(RaiseNotificationInstruction.New(notification));
        }
Esempio n. 2
0
        public override IEnumerator <InstructionBase> Simulate()
        {
            var notification = new AlarmRingingNotification();

            yield return(RaiseNotificationInstruction.New(notification));
        }