private async void LedUpdateStatusRequest_RequestReceived(object sender, DeviceControlLedStatusNeededEventArgs e) { DeviceControlReportLedStatusRequest reportLedStatusRequest = e.Request; await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { // Set UX to show we've got a device that supports the Local control functionality of Message Protocol service DeviceLedDetails.Visibility = Windows.UI.Xaml.Visibility.Visible; // Update LED toggle switch value, by removing Toggled event handler first, then adding it back after setting the new value to stop triggering it unnecessarily. LedToggleSwitch.Toggled -= ToggleSwitch_Toggled; LedToggleSwitch.IsOn = reportLedStatusRequest.LedStatus; LedToggleSwitch.Toggled += ToggleSwitch_Toggled; }); }
public DeviceControlLedStatusNeededEventArgs(DeviceControlReportLedStatusRequest request) { Request = request; }