Ejemplo n.º 1
0
        public override System.Collections.Generic.IEnumerator<NSimulate.Instruction.InstructionBase> Simulate()
        {
            Console.WriteLine(string.Format("Going to sleep at time period {0}", Context.TimePeriod));

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

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

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

            Console.WriteLine(string.Format("Alarm ringing again..waking up at time period {0}", Context.TimePeriod));

            // notify now awake
            var notification = new AwakeNotification();
            yield return new RaiseNotificationInstruction<AwakeNotification>(notification);
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
0
        public override System.Collections.Generic.IEnumerator <NSimulate.Instruction.InstructionBase> Simulate()
        {
            Console.WriteLine(string.Format("Going to sleep at time period {0}", Context.TimePeriod));

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

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

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

            Console.WriteLine(string.Format("Alarm ringing again..waking up at time period {0}", Context.TimePeriod));

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

            yield return(new RaiseNotificationInstruction <AwakeNotification>(notification));
        }