Beispiel #1
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();
        }
Beispiel #2
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}");
        }
Beispiel #3
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();
        }