public async Task GetThingById() { IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration); IThingClient thingClient = connection.CreateThingClient(); PersonInfo personInfo = await connection.GetPersonInfoAsync(); HealthRecordInfo record = personInfo.SelectedRecord; await DeletePreviousThings(thingClient, record); LocalDateTime nowLocal = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime; var weight = new Weight( new HealthServiceDateTime(nowLocal), new WeightValue(81, new DisplayValue(81, "KG", "kg"))); await thingClient.CreateNewThingsAsync( record.Id, new List <IThing> { weight }); Weight remoteWeight = await thingClient.GetThingAsync <Weight>(record.Id, weight.Key.Id); Assert.IsNotNull(remoteWeight); Assert.AreEqual(weight.Key.Id, remoteWeight.Key.Id); Assert.AreEqual(weight.Value.Value, remoteWeight.Value.Value); }
public override async Task OnNavigateBackAsync() { await LoadAsync(async() => { IThingClient thingClient = _connection.CreateThingClient(); PersonInfo personInfo = await _connection.GetPersonInfoAsync(); _medication = await thingClient.GetThingAsync <Medication>(personInfo.SelectedRecord.Id, _medication.Key.Id); UpdateDisplay(); await base.OnNavigateBackAsync(); }); }