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());
        }
Ejemplo n.º 2
0
        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();
        }
        public void AddChartData(HeartbeatMeasurement HeartbeatMeasurementValue)
        {
            // lets put the value into the UI control
            HeartbeatValueBox.Text = "" + HeartbeatMeasurementValue.HeartbeatValue;

            //we need to store it in an array in order to visualize the values with graph
            _data.Add(HeartbeatMeasurementValue);

            ReDrawChart();
        }
Ejemplo n.º 4
0
        private async void Instance_ValueChangeCompleted(HeartbeatMeasurement HeartbeatMeasurementValue)
        {
            System.Diagnostics.Debug.WriteLine("got heartbeat : " + HeartbeatMeasurementValue.HeartbeatValue);

            // Serialize UI update to the the main UI thread.
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                if (progressGrid.Visibility == Visibility.Visible)
                {
                    SetWaitVisibility(false);
                }

                chartControlOne.AddChartData(HeartbeatMeasurementValue);
            });
        }
Ejemplo n.º 5
0
        public async void Instance_ValueChangeCompleted(HeartbeatMeasurement HeartbeatMeasurementValue)
        {
            System.Diagnostics.Debug.WriteLine("got heartbeat : " + HeartbeatMeasurementValue.HeartbeatValue);
            me = HeartbeatMeasurementValue.HeartbeatValue;

            // Serialize UI update to the the main UI thread.
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                if (progressGrid.Visibility == Visibility.Visible)
                {
                    SetWaitVisibility(false);
                }

                // chartControlOne.AddChartData(HeartbeatMeasurementValue);
                myValues.Add(me);
                //avg = me/10;
                //System.Diagnostics.Debug.WriteLine("got avg : " + avg);
                //HrsValue.Text = pressureNorm.ToString();
                //library.Init(ref Display, ref Size, ref Colour);
            });
        }
        public void PlotChart(HeartbeatMeasurement[] data)
        {
            // First set the data points that we are going to render
            // The functions will use this data to plot the chart
            dataSet = data;

            // Remove previous rendering
            this.Children.Clear();

            CreateRenderingOptions();

            // Preprocess the data for rendering
            FillOffsetList();

            // Render the actual chart in natural Z order

            DrawBackground();

            DrawYAxis();

            DrawChart();

        }
Ejemplo n.º 7
0
        private async void Instance_ValueChangeCompleted(HeartbeatMeasurement HeartbeatMeasurementValue)
        {
            // Serialize UI update to the the main UI thread.
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                if (progressGrid.Visibility == Visibility.Visible)
                {
                    SetWaitVisibility(false);
                }

                // lets put the value into the UI control
                HeartbeatValueBox.Text = "" + HeartbeatMeasurementValue.HeartbeatValue;

                //we need to store it in an array in order to visualize the values with graph
                _data.Add(HeartbeatMeasurementValue);

                if (_data.Count >= 2)
                {
                    // and we have our custom control to show the graph
                    // this does not draw well if there is only one value, thus using it only after we got at least two values
                    outputDataChart.PlotChart(_data.ToArray());
                }
            });
        }
Ejemplo n.º 8
0
 private Task Handle(HeartbeatMeasurement measurement, CancellationToken cancellationToken)
 {
     return(Task.CompletedTask);
 }