/// <summary>
        /// Event Handler for Lamp Availability Changed. When it fires, we want to update to
        /// Lamp toggle UI to show that lamp is available or not
        /// </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 async void Lamp_AvailabilityChanged(Lamp sender, LampAvailabilityChangedEventArgs args)
        {
            // Update the Lamp Toggle UI to indicate lamp has been consumed by another application
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                if (lampToggle.IsOn)
                {
                    lampToggle.IsOn = args.IsAvailable;
                }

                lampToggle.IsEnabled = args.IsAvailable;
            });

            await LogStatusAsync(string.Format(CultureInfo.InvariantCulture, "Lamp Availability Changed Notification has fired, IsAvailable= {0}", args.IsAvailable), NotifyType.StatusMessage);
        }
        /// <summary>
        /// Event Handler for Lamp Availability Changed. When it fires, we want to update to
        /// Lamp toggle UI to show that lamp is available or not
        /// </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 async void Lamp_AvailabilityChanged(Lamp sender, LampAvailabilityChangedEventArgs args)
        {
            // Update the Lamp Toggle UI to indicate lamp has been consumed by another application
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                if (lampToggle.IsOn)
                {
                    lampToggle.IsOn = args.IsAvailable;
                }

                lampToggle.IsEnabled = args.IsAvailable;
            });

            await LogStatusAsync(string.Format(CultureInfo.InvariantCulture,"Lamp Availability Changed Notification has fired, IsAvailable= {0}", args.IsAvailable), NotifyType.StatusMessage);
        }
Example #3
0
 //<SnippetAvailabilityChangedHandler>
 private void Lamp_AvailabilityChanged(Lamp sender, LampAvailabilityChangedEventArgs args)
 {
     lampToggleSwitch.IsEnabled = args.IsAvailable;
 }
Example #4
0
 static async void Lamp_AvailabilityChanged(Lamp sender, LampAvailabilityChangedEventArgs args)
 {
     Console.WriteLine("{0} {1}", sender.Color.ToString(), args.IsAvailable.ToString());
 }
 /// <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);
 }