Beispiel #1
0
            public static void Run()
            {
                IExecutive exec = ExecFactory.Instance.CreateExecutive();

                DateTime when = DateTime.Parse("Fri, 15 Jul 2016 03:51:21");

                Domain.Sample1.Dog rastro = new Domain.Sample1.Dog("Rastro");

                for (int i = 0; i < 5; i++)
                {
                    // Schedule 15 speaking events.

                    Domain.Sample1.Cat aCat = new Domain.Sample1.Cat("Cat_" + i);
                    Domain.Sample1.Dog aDog = new Domain.Sample1.Dog("Dog_" + i);

                    exec.RequestEvent(rastro.Speak, when, 0.0, null, ExecEventType.Detachable);
                    exec.RequestEvent(aDog.Speak, when, 0.0, null, ExecEventType.Detachable);
                    exec.RequestEvent(aCat.Speak, when, 0.0, null, ExecEventType.Detachable);

                    when += TimeSpan.FromMinutes(10.0);
                }

                exec.RequestEvent(RescindIndividual, when - TimeSpan.FromMinutes(35), rastro);
                exec.RequestEvent(RescindCats, when - TimeSpan.FromMinutes(25));

                exec.Start();
            }
Beispiel #2
0
 private static void RescindIndividual(IExecutive exec, object userData)
 {
     Domain.Sample1.Dog dog = (Domain.Sample1.Dog)userData;
     Console.WriteLine("{0} : Rescinding events to {1}.Speak()", exec.Now, dog.Name);
     exec.UnRequestEvents(new ExecEventReceiver(dog.Speak));
 }