Exemple #1
0
        public Set  Forecast(int index)
        {
            var        stat = SavedTraining.GetTrainingHistory().FindAll(t => t.Sets.Any(s => s.Exercise.Name == this.Exercise.Name));
            List <Set> sets = stat.Select(savedTraining => savedTraining.Sets[index]).ToList();

            return(Forecast(sets));
        }
Exemple #2
0
        public static void Add(CurrentTraining current, DateTime time)
        {
            var training = new SavedTraining()
            {
                Sets     = current.GetSets(),
                StarTime = current.StarTime,
                Duration = time - current.StarTime,
            };

            _history.Add(training);
        }
Exemple #3
0
        public float ComparePrevious(CompareTypes compare)
        {
            var   last   = SavedTraining.GetTrainingHistory().FindLast(t => t.Sets.Any(s => s.Exercise.Name == this.Exercise.Name)).Sets[0];
            float result = 0;

            switch (compare)
            {
            case CompareTypes.Repeats:
                result = this.Repeats - (last?.Repeats ?? 0);
                break;

            case CompareTypes.WeightDistance:
                result = this.WeightDistance - (last?.WeightDistance ?? 0);
                break;

            case CompareTypes.Progress:
                result = CompareProgress(last);
                break;
            }
            return(result);
        }
 public bool SaveTraining(SavedTraining training)
 {
     return(_db.Save(training));
 }
 public bool AddTraining(SavedTraining training)
 {
     return(_db.Insert(training));
 }
Exemple #6
0
 public void Finish()
 {
     SavedTraining.Add(this, DateTime.Now);
     OnTrainingFinished();
     Reset();
 }
Exemple #7
0
 public void PostResult(SavedTraining training)
 {
     ServerProvider.Connect();
     ServerProvider.SendData(training);
 }