private void BtnSmartLampHallwayPower_Click(object sender, RoutedEventArgs e) { if (lampHallway.IsOn) { lblSmartLampHallway.Content = lampHallway.PowerOff(); lblSmartLampHallway.Background = Brushes.Red; } else { lblSmartLampHallway.Content = lampHallway.PowerOn(); lblSmartLampHallway.Background = Brushes.LightGreen; } }
private void btnSmartLampGangPower_Click(object sender, RoutedEventArgs e) { if (lampGang.IsOn) { lblSmartLampGang.Content = lampGang.PowerOff(); lblSmartLampGang.Background = Brushes.Red; } else { lblSmartLampGang.Content = lampGang.PowerOn(); lblSmartLampGang.Background = Brushes.Green; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { tvLivingRoom = new Television("leefkamer"); radioKitchen = new Radio("keuken"); lampHallway = new SmartLamp("gang"); electricalAppliances = new List <IPowerable> { tvLivingRoom, radioKitchen, lampHallway }; lblTVLivingRoomVolume.Content = tvLivingRoom.CurrentVolume; lblRadioKitchenVolume.Content = radioKitchen.CurrentVolume; lblTVLivingRoom.Content = tvLivingRoom.PowerOff(); lblRadioKitchen.Content = radioKitchen.PowerOff(); lblSmartLampHallway.Content = lampHallway.PowerOff(); }