protected override async void OnNavigatedTo(NavigationEventArgs e) { StorageFile parameter = e.Parameter as StorageFile; if (parameter == null) { ShowErrorDialog("No file defined for showing, please try again.", "Fine not defined"); } System.Diagnostics.Debug.WriteLine("Attempting to read : + " + parameter.Name); FileName.Text = parameter.Name; string valuesString = await FileIO.ReadTextAsync(parameter); string[] valuesArray = valuesString.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); System.Diagnostics.Debug.WriteLine("valuesArray Count : " + valuesArray.Count()); int intValue; List <HeartbeatMeasurement> tmpData = new List <HeartbeatMeasurement>(); foreach (string value in valuesArray) { if (Int32.TryParse(value, out intValue)) { tmpData.Add(HeartbeatMeasurement.GetHeartbeatMeasurementFromData((ushort)intValue, DateTimeOffset.Now)); } } System.Diagnostics.Debug.WriteLine("adding data count : " + tmpData.Count); chartControlOne.PlotChart(tmpData.ToArray()); }
public async void Run(IBackgroundTaskInstance taskInstance) { System.Diagnostics.Debug.WriteLine("WE are @ Background"); _deferral = taskInstance.GetDeferral(); _taskInstance = taskInstance; _taskInstance.Canceled += new BackgroundTaskCanceledEventHandler(OnCanceled); GattCharacteristicNotificationTriggerDetails details = (GattCharacteristicNotificationTriggerDetails)taskInstance.TriggerDetails; //get the characteristics data and get heartbeat value out from it byte[] ReceivedData = new byte[details.Value.Length]; DataReader.FromBuffer(details.Value).ReadBytes(ReceivedData); HeartbeatMeasurement tmpMeasurement = HeartbeatMeasurement.GetHeartbeatMeasurementFromData(ReceivedData); System.Diagnostics.Debug.WriteLine("Background heartbeast values: " + tmpMeasurement.HeartbeatValue); // send heartbeat values via progress callback _taskInstance.Progress = tmpMeasurement.HeartbeatValue; //update the value to the Tile LiveTile.UpdateSecondaryTile("" + tmpMeasurement.HeartbeatValue); //Check if we are within the limits, and alert by starting the app if we are not alertType alert = await checkHeartbeatLevels(tmpMeasurement.HeartbeatValue); _deferral.Complete(); }