Esempio n. 1
0
        static void Main(string[] args)
        {
            var tv = new TV();

            var controller = new UniversalController(tv);

            controller.TurnOn();
            controller.TurnOff();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            var tv       = new TV();
            var tvButton = new ClickSwitch(tv);

            tvButton.On();
            tvButton.Off();

            var radio       = new Radio();
            var radioButton = new ClickSwitch(radio);

            radioButton.On();
            radioButton.Off();

            Console.ReadKey();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            EntertainmentDevice myTV    = new TV(100, 3, true);
            EntertainmentDevice myMemir = new Memir(50, 15, true);
            RemoteControl       control = new RemoteControl(myTV);

            control.PrintState();
            control.TurnOff();
            control.TurnOn();
            control.PressNext();
            control.PressPrevious();
            control.SetDevice(myMemir);
            control.PrintState();
            control.TurnOff();
            control.TurnOn();
            control.PressNext();
            control.PressPrevious();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Memir memir = new Memir(1, 10, false);
            TV    tv    = new TV(5, 99, true);

            RemoteControl remote = new RemoteControl(memir);

            remote.PrintStatus();
            remote.On();
            remote.PrintStatus();
            remote.Next();
            remote.Prev();
            remote.PrintStatus();

            remote.Device = tv;
            remote.PrintStatus();
            remote.Off();
            remote.Next();
            remote.PrintStatus();
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            var           radio         = new Radio();
            RemoteControl remoteControl = new BasicRemoteControl(radio, "Radio");

            remoteControl.Device.SetPower(false);
            var volume = remoteControl.ToggleVolume(12, "-");

            Console.WriteLine($"[{remoteControl.DeviceName}] - Status do dispositivo - {remoteControl.Device.GetPower()}");
            Console.WriteLine($"[{remoteControl.DeviceName}] - Volume que esta o dispositivo - {volume}");

            var tv = new TV();
            var remoteTouchControl = new TouchControl(tv, "TV");

            remoteTouchControl.Device.SetPower(true);
            var volumeTV = remoteTouchControl.ToggleVolume(12, "+");

            Console.WriteLine($"[{remoteTouchControl.DeviceName}] - Status do dispositivo - {remoteTouchControl.Device.GetPower()}");
            Console.WriteLine($"[{remoteTouchControl.DeviceName}] - Volume que esta o dispositivo - {volumeTV}");
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            Console.WriteLine("############## Universal Control ###############");
            Console.WriteLine(" TV ");
            Device device = new TV();

            Console.WriteLine($"Volume : {device.Volume}");
            RemoteControl remoteControl = new AdvancedRemoteControl(device);

            remoteControl.VolumeUp();
            Console.WriteLine($"Volume changed: {device.Volume}");
            remoteControl.TogglePower();

            Console.WriteLine(" Radio ");
            device = new Radio();
            Console.WriteLine($"Volume : {device.Volume}");
            remoteControl = new AdvancedRemoteControl(device);
            remoteControl.VolumeUp();
            Console.WriteLine($"Volume changed: {device.Volume}");
            remoteControl.TogglePower();
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            TV    tv       = new TV(3, true);
            Memir YesOrHot = new Memir(4, false);

            RemoteControl remote = new RemoteControl(tv);

            remote.Next();
            remote.Next();
            remote.Next();
            remote.Next();

            remote.SetDevice(YesOrHot);
            remote.Next();
            remote.Next();
            remote.Next();
            remote.Next();
            remote.Next();
            remote.Next();
            remote.Off();
        }