private void CreateWorkoutForYussuf() //NYI { //show a button that will cancel the workout routine //Variables set up. These will need to be user input via a dialog int numberOfExercises = 2; MuscleGroupEnum muscleGroup = MuscleGroupEnum.Abs; bool highRep = true; //this guy is for high reps low weight, or low reps high weight List <ExerciseItem> exercisesByGroup = AllExerciseItems.Where(x => x.MuscleGroup == muscleGroup).ToList(); if (numberOfExercises > exercisesByGroup.Count) { throw new Exception("There are not enough exercises in the selected group to make a routine of the requested size"); //Handle this a bit better, possibly from within the dialog itself } Random rnd = new Random(); List <ExerciseItem> workoutExercises = exercisesByGroup.OrderBy(x => rnd.Next()).Take(numberOfExercises).ToList(); //this works, but also has the possiblity to get the same item twice, we dont really want that. or do we? List <ExerciseItem> tempStoredExercises = ExerciseItemsToDo.ToList(); //this isnt a permanent solution as temporarily storing things like this means it wont get saved on app close which is rather frustrating. Best action would be to create a new table in the db to store these //At this point we need to figure out the starting weights foreach (ExerciseItem ex in workoutExercises) { //show some dialog to get the starting weight //for now just use the given weight as the starting weight. } ExerciseItemsToDo.Clear(); //remove the old list. Its ok though, it should be stored ;) for (int i = 0; i < numberOfExercises; i++) { } }
private void ShowEditRosterDialog() { var dialogViewModel = new EditRosterViewModel(AllExerciseItems); List <ExerciseItem> temp = AllExerciseItems.ToList(); bool?success = dialogService.ShowDialog <EditRosterView>(this, dialogViewModel); if (success == true) { ExerciseItemsToDo.Clear(); foreach (var rosterItem in dialogViewModel.RosterItems) { ExerciseItem exerciseItem = temp.FirstOrDefault(x => x.GUIDID == rosterItem.GUIDID); exerciseItem.IsUsedInRoster = rosterItem.IsUsedInRoster; dataStore.UpdateIsUsedInRoster(exerciseItem); RaisePropertyChangedEvent("IsUsedInRoster"); if (!temp.Contains(exerciseItem)) { exerciseItem.DueTime = DateTime.Now; } if (exerciseItem.IsUsedInRoster) { ExerciseItemsToDo.Add(exerciseItem); } } RebuildList(); } else //revert it to the way it was { } }
private void RebuildList() { List <ExerciseItem> temp = ExerciseItemsToDo.OrderBy(x => x.DueTime).ToList(); ExerciseItemsToDo.Clear(); foreach (var item in temp) { ExerciseItemsToDo.Add(item); } }