protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            geolocator = new Geolocator();
            path = new Path();
            geolocator.ReportInterval = 500;
            geolocator.DesiredAccuracy = PositionAccuracy.High;
            geolocator.StatusChanged += geolocator_StatusChanged;

            request = new DisplayRequest();
            request.RequestActive();
        }
        private async void RecordButton_Tapped(object sender, TappedRoutedEventArgs e)
        {
            if (recording)
            {
                DateTime end = DateTime.UtcNow;

                Activity activity = new Activity
                {
                    AccountId = UserState.CurrentId,
                    BeginTime = begin,
                    EndTime = end,
                    Steps = pedometer.Steps,
                    Distance = path.Distance
                };

                GPSSpinner.IsActive = true;
                ((Button)sender).IsEnabled = false;
                geolocator.PositionChanged -= geolocator_PositionChanged;
                pedometer.Stepped -= pedometer_Stepped;
                activity.Type = await Api.Do.Predict(activity);

                activity = (await Api.Do.SendActivity(activity)).Item1;

                path.ActivityId = activity.Id;

                path = await Api.Do.PostPath(path);

                PageDispatch.ViewActivity(Frame, activity);
            }
            else
            {
                begin = DateTime.UtcNow;
                current = DateTime.UtcNow;

                timer = new Timer((o) =>
                {
                    current = current.AddSeconds(1);
                    Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => DurationDisplay.Text = "Duration: " + (current - begin).ToString("hh':'mm':'ss"));
                }, null, 1000, 1000);

                ((Button)sender).Content = "Stop Activity";

                pedometer.Start();
                begin = DateTime.UtcNow;

                pedometer.Stepped += pedometer_Stepped;
                recording = true;

                geolocator.PositionChanged += geolocator_PositionChanged;
            }
        }
 public Task<Path> PostPath(Path path)
 {
     throw new NotImplementedException();
 }