예제 #1
0
 public void ApplySwitchsignal(bool turnOn)
 {
     if (turnOn)
     {
         _switchableDevice.TurnOn();
     }
     else
     {
         _switchableDevice.TurnOff();
     }
 }
예제 #2
0
 public void Toggle()
 {
     IsSwitchOn = !IsSwitchOn;
     if (IsSwitchOn)
     {
         device.TurnOn();
     }
     else
     {
         device.TurnOff();
     }
 }
예제 #3
0
        public void Switch(ISwitchable device)
        {
            if (device.IsOn)
            {
                device.TurnOff();
            }
            else
            {
                device.TurnOn();
            }

            device.IsOn = !device.IsOn;
        }
예제 #4
0
        public void Toggle()
        {
            isOn = !isOn;

            if (isOn)
            {
                switchable.TurnOn();
            }
            else
            {
                switchable.TurnOff();
            }
        }
예제 #5
0
        static void Main(string[] args)
        {
            MessWithOnOff <Light> messer = new MessWithOnOff <Light>();

            messer.Flip(new Light());

            List <Person> group = new List <Person> {
                new Person {
                    Name = "Bob", Age = 50
                },
                new Person {
                    Name = "Tom", Age = 30
                }
            };

            group.Sort();
            //int[] arr = { 1, 2, 3, 4, 5 };
            //test(ref arr[3]);
            //Console.WriteLine(arr[3]);
            //IEnumerable<string> names = new string[] { "John", "Bob", "Tom" };
            Light       a = new Light();
            ISwitchable b = a;
            I38Faucet   c = a;

            //a.TurnOn();
            b.TurnOn();
            c.TurnOn();
            IEnumerable <ISwitchable> switchPanel = new List <ISwitchable> {
                new Light(), new Light()
            };

            switchPanel = new List <Light> {
                new Light(), new Light()
            };



            Console.ReadLine();
        }
예제 #6
0
 public void Toggle()
 {
     swhithable.TurnOff();
     swhithable.TurnOn();
 }