private void BLE_DeviceUpdatedHandler(object sender, NetPropertiesUpdateDataModel args) { ErrReport report; WrapErr.ToErrReport(out report, 200052, "Failure on BLE_DeviceUpdatedHandler", () => { this.BLE_DeviceUpdated?.Invoke(this, args); }); }
/// <summary>Fired when the device is changed</summary> /// <param name="sender"></param> /// <param name="updateInfo"></param> private void DevWatcher_Updated(DeviceWatcher sender, DeviceInformationUpdate updateInfo) { this.log.Info("DevWatcher_Updated", () => string.Format("UPDATED ***** {0}", updateInfo.Id)); WrapErr.ToErrReport(9999, () => { NetPropertiesUpdateDataModel dm = updateInfo.CreatePropertiesUpdateData(); this.DeviceUpdated?.Invoke(this, dm); }); }
public static NetPropertiesUpdateDataModel CreatePropertiesUpdateData(this DeviceInformationUpdate updateInfo) { NetPropertiesUpdateDataModel dm = new NetPropertiesUpdateDataModel() { Id = updateInfo.Id, ServiceProperties = NetPropertyHelpers.CreatePropertiesDictionary(updateInfo.Properties), }; return(dm); }
private void BLE_DeviceUpdatedHandler(object sender, NetPropertiesUpdateDataModel args) { this.Dispatcher.Invoke(() => { WrapErr.ToErrReport(9999, "Failure on BLE Device Updated", () => { this.log.Info("", () => string.Format("Updating '{0}'", args.Id)); // Disconnect the list from control before changing. Maybe change to Observable collection this.listBox_BLE.ItemsSource = null; BluetoothLEDeviceInfo item = this.infoList_BLE.Find((x) => x.Id == args.Id); if (item != null) { // This will raise events on change. How to deal with that. Think only if it is the current on display item.Update(args.ServiceProperties); } this.listBox_BLE.ItemsSource = this.infoList_BLE; }); }); }