public static void Execute()
            {
                var element = new Element
                {
                    Text = "Test1"
                };

                DecoratorDemo.DrawElement(element);


                var elementBgnd = new ElementBgndDecorator(element)
                {
                    Background = new Bitmap(10, 10),
                    Text       = "Text2"
                };

                DecoratorDemo.DrawElement(elementBgnd);

                var elementStriked = new ElementStrikedDecorator(elementBgnd)
                {
                    Text = "Test3"
                };

                DecoratorDemo.DrawElement(elementStriked);
            }
Exemple #2
0
 public StructuralPattern()
 {
     _proxyDemo     = new ProxyDemo();
     _flyweightDemo = new FlyweightDemo();
     _adapterDemo   = new AdapterDemo();
     _bridgeDemo    = new BridgeDemo();
     _decoratorDemo = new DecoratorDemo();
     _facadeDemo    = new FacadeDemo();
 }
Exemple #3
0
        public static void Start()
        {
            int choice;

            do
            {
                Console.Clear();
                Console.WriteLine("------Structural Pattern Demo-------");
                Console.WriteLine("Enter Your Choice");
                Console.WriteLine("1 To See Adapter Design Pattern");
                Console.WriteLine("2 To See Decorator Design Pattern");
                Console.WriteLine("3 To See Facade Design Pattern");
                Console.WriteLine("0 To Go Back");
                Console.WriteLine("------------------------------------");
                choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    FacadeDemo.Start();
                    break;

                case 2:
                    DecoratorDemo.Start();
                    break;

                case 3:
                    AdapterDemo.Start();
                    break;

                case 4:
                    break;

                default:
                    Console.WriteLine("Please Enter Valid Choice");
                    break;
                }
            } while (choice != 0);
        }
 static void Main(string[] args)
 {
     DecoratorDemo.Execute();
     Console.ReadKey();
 }