Exemple #1
0
        private Training MapTraining(EndoMondoTraining endomondoTraining)
        {
            Training training = new Training();

            training.Application = "Endomondo";
            training.Account     = this.Account;

            training.Sport = GetSport(endomondoTraining.sport);

            training.Name   = endomondoTraining.name;
            training.Source = endomondoTraining.source;
            if (training.Source == null)
            {
                if (endomondoTraining.Gpx != null)
                {
                    training.Source = "Imported";
                }
                else
                {
                    training.Source = "INPUT_MANUAL";
                }
            }
            training.Duration     = (int)endomondoTraining.duration_s;
            training.Start        = DateTime.Parse(endomondoTraining.start_time);
            training.End          = DateTime.Parse(endomondoTraining.end_time);
            training.Distance     = endomondoTraining.distance_km;
            training.Calories     = endomondoTraining.calories_kcal;
            training.AverageSpeed = endomondoTraining.speed_avg_kmh;
            training.Pictures     = endomondoTraining.Pictures;
            training.Gpx          = endomondoTraining.Gpx;
            return(training);
        }
 private void LoadPictures(EndoMondoTraining training)
 {
     training.Pictures = new List <byte[]>();
     foreach (var picture in training.PicturesLinks)
     {
         string path  = System.IO.Path.Combine(this.Path, picture);
         byte[] bytes = File.ReadAllBytes(path);
         training.Pictures.Add(bytes);
     }
 }