private async Task WorkoutRemove(IWorkout workout, PlaylistModel list) { list.Workouts.Remove(list.Workouts.First(w => w.Id == workout.Id && w.WorkoutType == workout.WorkoutType)); var type = workout.WorkoutType.ToString(); await db_.Database.Table <ListWorkoutDBModel>().DeleteAsync(s => s.PlaylistId == list.Playlist.Id && s.WorkoutId == workout.Id && s.WorkoutType.Equals(type)); }
public async Task ScheduleReocurring(IWorkout workout, DateTime when, TimeSpan interval) { Notification toInsert; if (when < nextToPop_?.TriggerTime) { toInsert = nextToPop_; nextToPop_.Workout = workout; nextToPop_.TriggerTime = when; nextToPop_.Id = await NextScheduleId; nextToPop_.Next = interval; } else { var id = await NextScheduleId; toInsert = new Notification { Id = id, Next = interval, TriggerTime = when, Workout = workout }; } await AddScheduleToDb(toInsert); if (nextToPop_ == null) { await ReloadSchedule(); } }
// TODO: Once an erg has been established with the server (using an ititiating hub call, serial number shouldn't be needed for each communication because the channel should be open and unique // TODO: Return intentional success/failure on every communication with the Erg for reporting public async Task DefineWorkout(string serialNumber, IWorkout workout) { if (string.IsNullOrWhiteSpace(serialNumber)) { _logger.LogWarning("When requested to send a workout to the Erg, the serial number was null. Returning without sending."); return; } if (workout == null) { _logger.LogWarning("When requested to send a workout to the Erg, the workout was null. Returning without sending."); return; } bool workoutSet = false; if (_pmService.IsReadyToProgramWorkout(serialNumber)) { // Send the workout _pmService.SetWorkout(serialNumber, workout); workoutSet = true; } if (!workoutSet) { // Send a failure report back to the server } }
void IObserver.OnNotify(object parametr, GAME_EVENTS notificationName) { switch (notificationName) { case GAME_EVENTS.ButtonHandlerLoaded: StartBehaviour(); break; case GAME_EVENTS.WordsEnded: print("ScoreValue = " + GetCorrectAnswers()); WordsEndedBehaviour(); break; case GAME_EVENTS.CorrectAnswer: AddWorkoutProgress(currentWord, subWorkout); if (currentWord.AllWorkoutDone()) { currentWord.AddLicenseLevel(); } break; case GAME_EVENTS.BuildTask: IWorkout workout = parametr as IWorkout; subWorkout = workout.WorkoutName; currentWord = workout.GetCurrentWord(); break; } }
public App() { InitializeComponent(); Scorecard = new ScorecardService(); TopScores = new RecordKeeper(Properties); WorkoutState = new WorkoutStateService(); Workouts = new WorkoutRepository(); MainPage = new NavigationPage(new MainPage()); }
private async Task WorkoutAttach(IWorkout workout, PlaylistModel list) { list.Workouts.Add(workout); await db_.Database.InsertAsync(new ListWorkoutDBModel { PlaylistId = list.Playlist.Id, WorkoutId = workout.Id, WorkoutType = workout.WorkoutType.ToString() }); }
public async Task EditSchedule(int id, IWorkout workout, DateTime when, TimeSpan interval) { var schedule = await ScheduleDBModel.FromDB(id, database_); schedule.WorkoutId = workout.Id; schedule.WorkoutType = workout.WorkoutType; schedule.When = when; schedule.Interval = interval; await schedule.AddOrUpdate(database_); await ReloadSchedule(); }
public pwx GetExtendedWorkoutData(IAthlete athlete, IWorkout workout) { var stm = new MemoryStream(); var stw = new StreamWriter(stm); var xmlData = workout.ExtendedPwXmlNode = soapClient.GetExtendedWorkoutDataForAccessibleAthlete(athlete.TPData.LoginName, athlete.TPData.LoginPassword, athlete.TPData.PersonID, workout.TPWorkoutID); stw.Write(xmlData.OuterXml); stw.Flush(); stm.Position = 0; var ser = new XmlSerializer(typeof (pwx)); var pwxObj = ser.Deserialize(stm); workout.pwxData = pwxObj; return pwxObj as pwx; }
public static IWorkout MapExtendedCycleWorkout(pwx pwx, IWorkout shortWorkout) { pwxWorkout pwxWo = pwx.workout[0]; IAthlete athlete = new Athlete(); athlete.FTBikePower = 231; shortWorkout.TrainingStressScore = pwxWo.summarydata.tss; ICycleWorkout cycleWorkout = shortWorkout as ICycleWorkout; if (cycleWorkout == null) return shortWorkout; PWXDataExtractor dataExtractor = new PWXDataExtractor(pwx); var workoutSamples = dataExtractor.ExtractData(); WorkoutSamplesCalculator calc = new WorkoutSamplesCalculator(workoutSamples, athlete); cycleWorkout.IntensityFactor = calc.CalcualteIntensityFactor(); cycleWorkout.NormalizedPower = (int)calc.GetNormalizedPower(); return shortWorkout; }
public pwx GetExtendedWorkoutData(IAthlete athlete, IWorkout workout) { var stm = new MemoryStream(); var stw = new StreamWriter(stm); var xmlData = workout.ExtendedPwXmlNode = soapClient.GetExtendedWorkoutDataForAccessibleAthlete(athlete.TPData.LoginName, athlete.TPData.LoginPassword, athlete.TPData.PersonID, workout.TPWorkoutID); stw.Write(xmlData.OuterXml); stw.Flush(); stm.Position = 0; var ser = new XmlSerializer(typeof(pwx)); var pwxObj = ser.Deserialize(stm); workout.pwxData = pwxObj; return(pwxObj as pwx); }
/// <inheritdoc /> public void SetWorkout(string serialNumber, IWorkout workout) { if (string.IsNullOrWhiteSpace(serialNumber)) { _logger.LogError("Serial number must not be null. No workout has been set."); return; } if (workout == null) { _logger.LogError("Workout must not be null. No workout has been set."); return; } // Determine which type of workout based on intervals defined and set it throw new NotImplementedException(); }
public static IWorkout MapExtendedCycleWorkout(pwx pwx, IWorkout shortWorkout) { pwxWorkout pwxWo = pwx.workout[0]; IAthlete athlete = new Athlete(); athlete.FTBikePower = 231; shortWorkout.TrainingStressScore = pwxWo.summarydata.tss; ICycleWorkout cycleWorkout = shortWorkout as ICycleWorkout; if (cycleWorkout == null) { return(shortWorkout); } PWXDataExtractor dataExtractor = new PWXDataExtractor(pwx); var workoutSamples = dataExtractor.ExtractData(); WorkoutSamplesCalculator calc = new WorkoutSamplesCalculator(workoutSamples, athlete); cycleWorkout.IntensityFactor = calc.CalcualteIntensityFactor(); cycleWorkout.NormalizedPower = (int)calc.GetNormalizedPower(); return(shortWorkout); }
public Coach() { workoutBuilder = new FitnessExercices(); }
private Task PostponeWorkout(IWorkout workout) { return(DependencyService.Get <Schedule.NotificationManager>().Schedule(workout, DateTime.Now + TimeSpan.FromMinutes(5))); }
public NutritionRepository() { _workoutRepository = new WorkoutRepository(); }
public RegistrationRepository() { _workoutRepository = new WorkoutRepository(); _nutritionRepository = new NutritionRepository(); }
public WorkoutController(IWorkout repository) { this.repository = repository; }
public Task Schedule(IWorkout workout, DateTime when) => ScheduleReocurring(workout, when, TimeSpan.Zero);
protected override Task OnInitializedAsync() { workout = new Spartacus(); workoutState = WorkoutState.NotStarted; return(Task.CompletedTask); }