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)); }
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); }
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)); }
public void Finish() { SavedTraining.Add(this, DateTime.Now); OnTrainingFinished(); Reset(); }
public void PostResult(SavedTraining training) { ServerProvider.Connect(); ServerProvider.SendData(training); }