示例#1
0
        static void Main(string[] args)
        {
            Bocina bocina1 = new Bocina();
            bocinaCancionCommand      cambiarB1      = new bocinaCancionCommand(bocina1);
            bocinaPoderCommand        poderB1        = new bocinaPoderCommand(bocina1);
            bocinaReproduccionCommand reproduccionB1 = new bocinaReproduccionCommand(bocina1);

            Bocina bocina2 = new Bocina();
            bocinaCancionCommand      cambiarB2      = new bocinaCancionCommand(bocina2);
            bocinaPoderCommand        poderB2        = new bocinaPoderCommand(bocina2);
            bocinaReproduccionCommand reproduccionB2 = new bocinaReproduccionCommand(bocina2);

            Aspiradora                aspiradora1 = new Aspiradora();
            aspiradoraPoderCommand    poderA1     = new aspiradoraPoderCommand(aspiradora1);
            aspiradoraAlfombraCommand alfombraA1  = new aspiradoraAlfombraCommand(aspiradora1);

            CeilingFan          fan1       = new CeilingFan();
            velocidadFanCommand velocidad1 = new velocidadFanCommand(fan1);


            Invoker controlUniversal = new Invoker(8);

            //controlUniversal.setCommand(cambiarB1, 0);
            controlUniversal.setCommand(velocidad1, 0);
            controlUniversal.setCommand(velocidad1, 1);
            //controlUniversal.setCommand(poderB1, 1);
            //controlUniversal.setCommand(reproduccionB1, 2);
            //controlUniversal.setCommand(cambiarB2, 3);
            //controlUniversal.setCommand(poderB2, 4);
            //controlUniversal.setCommand(reproduccionB2, 5);
            //controlUniversal.setCommand(poderA1, 6);
            //controlUniversal.setCommand(alfombraA1, 7);

            controlUniversal.buttonPressed(0);
            controlUniversal.buttonPressed(0);
            controlUniversal.buttonPressed(0);
            controlUniversal.buttonPressed(1);
            controlUniversal.buttonPressed(1);
            controlUniversal.buttonPressed(0);
            controlUniversal.buttonPressed(0);
            controlUniversal.buttonPressed(0);
            //controlUniversal.buttonPressed(0);
            //controlUniversal.buttonPressed(0);
            //controlUniversal.buttonPressed(0);
            //Console.ReadLine();
            //Console.Clear();
            //controlUniversal.buttonPressed(1);
            //controlUniversal.buttonPressed(1);
            //controlUniversal.buttonPressed(1);
            //Console.ReadLine();
            //Console.Clear();
            //controlUniversal.buttonPressed(2);
            //controlUniversal.buttonPressed(2);
            //controlUniversal.buttonPressed(2);
            //Console.ReadLine();
            //Console.Clear();
            //controlUniversal.buttonPressed(3);
            //controlUniversal.buttonPressed(3);
            //controlUniversal.buttonPressed(3);
            //Console.ReadLine();
            //Console.Clear();
            //controlUniversal.buttonPressed(4);
            //controlUniversal.buttonPressed(4);
            //controlUniversal.buttonPressed(4);
            //Console.ReadLine();
            //Console.Clear();
            //controlUniversal.buttonPressed(5);
            //controlUniversal.buttonPressed(5);
            //controlUniversal.buttonPressed(5);
            //Console.ReadLine();
            //Console.Clear();
            //controlUniversal.buttonPressed(6);
            //controlUniversal.buttonPressed(6);
            //controlUniversal.buttonPressed(6);
            //Console.ReadLine();
            //Console.Clear();
            //controlUniversal.buttonPressed(7);
            //controlUniversal.buttonPressed(7);
            //controlUniversal.buttonPressed(7);
            Console.ReadLine();
            Console.Clear();
        }
示例#2
0
 public velocidadFanCommand(CeilingFan f)
 {
     this.fan       = f;
     this.velocidad = 0;
 }