private async void Save_Clicked(object sender, EventArgs e) { //If entries are valid if (MasterModel.vd.FormEntriesValid(FormController.GetAllEntries(gridForm)) == true) { try { //Save SelectedType.Reps = RepController.SaveRepsFromEntries(gridForm, repeatableLblText); Exercise.Types[Index] = SelectedType; await MasterModel.DAL.SaveSelectedExerciseAsync(Exercise); await Navigation.PopAsync(); } catch (Exception ex) { //Display error await DisplayAlert("Error", ex.Message, "OK"); throw; } } //Entries are invalid else { //Display error await DisplayAlert("Error", MasterModel.vd.error, "OK"); } }
protected override async void OnAppearing() { base.OnAppearing(); Exercise = await GetExercise(); Exercise = await RepController.PrepareRepSummaryAsync(Exercise); Exercise.Key = Key; Refresh(); }
protected override async void OnAppearing() { base.OnAppearing(); SavedExercises = await GetExercisesAsync(); SavedExercises = await RepController.PrepareRepSummariesAsync(SavedExercises); RefreshList(); }
protected override async void OnAppearing() { base.OnAppearing(); selectedLoadout = await MasterModel.DAL.GetExerciseLoadoutAsync(Key); SavedExercises = await MasterModel.DAL.GetSavedExercisesAsync(); SavedExercises = await RepController.PrepareRepSummariesAsync(SavedExercises); Refresh(); }
private async Task <string> PrepareAddExerciseSummary(Exercise ex) { string summary = null; ex = await RepController.PrepareRepSummaryAsync(ex); foreach (var eType in ex.Types) { summary += (eType.Summary + "\n"); } return(summary); }
private async void NewType_Clicked(object sender, EventArgs e) { if (MasterModel.vd.FormEntriesValid(new string[] { entryRep.Text }) == true) { List <Rep> tempReps = RepController.SaveRepsFromEntries(gridForm, repeatableLblText); Exercise.Types.Add(new ExerciseType { Name = entryType.Text, Reps = tempReps }); ResetForm(); entryType.Focus(); } else { await DisplayAlert("Error", MasterModel.vd.error, "OK"); } }
private async void Save_Clicked(object sender, EventArgs e) { //Ugly band-aid fix for if types already exist but the user just //wants to save... if (MasterModel.vd.FormEntriesValid(new string[] { entryName.Text }) == true) { //If there are more than one exercise types if (Exercise.Types.Count > 0) { //If there are entries on the current page then add those too. if (MasterModel.vd.FormEntriesValid(FormController.GetAllEntries(gridForm)) == true) { Exercise.Types.Add(new ExerciseType { Name = entryType.Text, Reps = RepController.SaveRepsFromEntries(gridForm, repeatableLblText) }); } //In the case the if statement isn't met //it ignores the current form and saves the data await SaveData(); return; } } if (MasterModel.vd.FormEntriesValid(FormController.GetAllEntries(gridForm)) == false) { await DisplayAlert("Error", MasterModel.vd.error, "OK"); return; } //At this point, the form is valid and is the very first exercise type. Exercise.Types.Add(new ExerciseType { Name = entryType.Text, Reps = RepController.SaveRepsFromEntries(gridForm, repeatableLblText) }); await SaveData(); }
public LoginViewController(RepController repController) { _repController = repController; }
public AppUserController(RepController repController) { _repController = repController; }