public static void Main(string[] args) { var lamp = new Lamp.Lamp("Mr Lamperdoodle"); while (!lamp.HasBrokenBulb) { lamp.FlipSwitch(); } lamp.ReplaceBulb(); lamp.FlipSwitch(); lamp.FlipSwitch(); lamp.BreakBulb(new NamedEntity("Myke")); lamp.BreakBulb(new NamedEntity("Frederick")); lamp.ReplaceBulb(); }
/// <summary> /// /// </summary> /// <param name="sender">Contains information regarding Lamp object that fired event</param> /// <param name="e">Contains state information and event data associated with the event</param> private void Lamp_AvailabilityChanged(Lamp sender, LampAvailabilityChangedEventArgs args) { // Update the Lamp Toggle UI to indicate lamp has been consumed by another app lampToggle.IsEnabled = args.IsAvailable; LogStatus(string.Format(CultureInfo.InvariantCulture, "Lamp Availability Changed Notification has fired, IsAvailable= {0}", args.IsAvailable), NotifyType.StatusMessage); }