static void Main(string[] args)
        {
            ICamera camera = new TimerDecorator(new FlashDecorator(new SimpleCamera()));

            Console.WriteLine(camera.Capture());

            var newCam = new LensDecorator(CameraDecorator.RemoveRole <TimerDecorator>(camera));

            Console.WriteLine(newCam.Capture());

            var timer = CameraDecorator.GetRole <TimerDecorator>(camera);

            timer.WaitTimer();
        }
Example #2
0
        public static void Main(string[] args)
        {
            var reverser           = new ReverseBehavior();
            var exceptionDecorator = new ExceptionDecorator(reverser);
            var loggingDecorator   = new LoggingDecorator(exceptionDecorator);
            var threadingDecorator = new ThreadingDecorator(loggingDecorator);
            var timerDecorator     = new TimerDecorator(threadingDecorator);
            //var nullDecorator = new NullDecorator(timerDecorator);

            var result = timerDecorator.Apply("abc");

            Console.WriteLine(result);

            Console.ReadKey();
        }