Beispiel #1
0
        /// <summary>
        /// Test for the implementation of the mediator pattern
        /// </summary>
        private async static Task MediatorTest()
        {
            //create mediator
            Cordinator cordinator = new Cordinator();

            //create colleagues
            Drone raven  = new FWD("Raven");
            Drone martin = new SRD("Martin");
            Drone hope   = new MRD("Hope");

            //register colleagues
            cordinator.Register(raven, martin, hope);

            //test => fake movement (press escape to exit)
            while (!(Console.KeyAvailable && Console.ReadKey(true).Key == ConsoleKey.Escape))
            {
                //send the new cordinates
                raven.Send(GetRandomNumber(), GetRandomNumber());

                //sleep for 1 second
                await Task.Delay(1000);
            }
        }
Beispiel #2
0
 public FWD(FWD i)
 {
     Break    = i.Break;
     Continue = i.Continue;
 }