Exemplo n.º 1
0
        private async void Finish_Clicked(object sender, EventArgs e)
        {
            aTimer.Enabled = false;
            var tour = new Course
            {
                courseStart = DateTime.Now.ToString("yyyy-MM-dd"),
                calories    = 555,
                steps       = 4578,
                maptrack    = JsonConvert.SerializeObject(CoursesLocations),
                user        = Settings.UserId
            };


            var issucced = await _restService.CourseAddAsync(tour.calories, tour.steps, tour.maptrack);

            if (issucced)
            {
                //Debug.WriteLine(tour.mapTrack);
                JArray a = JArray.Parse(Settings.UserCoursesList);
                a.Add(JToken.FromObject(tour));
                Settings.UserCoursesList = a.ToString();

                //Debug.WriteLine(Settings.UserCoursesList);

                await App.Current.MainPage.Navigation.PopModalAsync();
            }
        }