/// <summary> /// Creates a clone of the object. /// </summary> /// <returns> /// The <see cref="BandData"/>. /// </returns> public BandData Clone() { var bandHealth = new BandData { CapturedAt = this.CapturedAt, MotionType = this.MotionType, Pace = this.Pace, Speed = this.Speed, HeartRate = this.HeartRate, SkinTemperature = this.SkinTemperature, }; return(bandHealth); }
/// <summary> /// Creates a clone of the object. /// </summary> /// <returns> /// The <see cref="BandData"/>. /// </returns> public BandData Clone() { var bandHealth = new BandData { CapturedAt = this.CapturedAt, MotionType = this.MotionType, Pace = this.Pace, Speed = this.Speed, HeartRate = this.HeartRate, SkinTemperature = this.SkinTemperature, }; return bandHealth; }
private async Task SetupBand() { try { // Loads in any previously saved health data this.RecordedData = await LoadRecordedData(); } catch (Exception) { this.RecordedData = new List<BandData>(); } // Gets the first available Band from the device this.bandInfo = (await BandClientManager.Instance.GetBandsAsync()).FirstOrDefault(); if (this.bandInfo == null) { throw new InvalidOperationException("No Microsoft Band available to connect to."); } var isConnecting = false; using (new DisposableAction(() => isConnecting = true, () => isConnecting = false)) { // Attempts to connect to the Band this.bandClient = await BandClientManager.Instance.ConnectAsync(this.bandInfo); if (this.bandClient == null) { throw new InvalidOperationException("Could not connect to the Microsoft Band available."); } // This sample uses the Heart Rate sensor so the user must have granted access prior to the BG task running if (this.bandClient.SensorManager.HeartRate.GetCurrentUserConsent() != UserConsent.Granted) { throw new InvalidOperationException( "User has not granted access to the Microsoft Band heart rate sensor."); } this.ResetReceivedFlags(); this.bandData = new BandData(); await this.SetupSensors(); } }