コード例 #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));
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #4
0
 public bool SaveTraining(SavedTraining training)
 {
     return(_db.Save(training));
 }
コード例 #5
0
 public bool AddTraining(SavedTraining training)
 {
     return(_db.Insert(training));
 }
コード例 #6
0
 public void Finish()
 {
     SavedTraining.Add(this, DateTime.Now);
     OnTrainingFinished();
     Reset();
 }
コード例 #7
0
ファイル: Avatar.cs プロジェクト: DenisGovorov/GymNotes
 public void PostResult(SavedTraining training)
 {
     ServerProvider.Connect();
     ServerProvider.SendData(training);
 }