Example #1
0
        static void Main(string[] args)
        {
            var res1 = MenuFigura();
            var res2 = MenuColor();

            Figuras figura = null;
            IColor  color  = null;

            switch (res1)
            {
            case 1:
                figura = new Circulo();
                break;

            case 2:
                figura = new Cuadrado();
                break;

            case 3:
                figura = new Rectangulo();
                break;
            }

            switch (res2)
            {
            case 1:
                color = new Verde();
                break;

            case 2:
                color = new Azul();
                break;

            case 3:
                color = new Rojo();
                break;
            }

            Console.Clear();
            figura.Color = color;
            figura.PintarFigura();
        }
Example #2
0
        private void clickRojo(object sender, RoutedEventArgs e)
        {
            Rojo r = new Rojo();

            r.ShowDialog();
        }