Esempio n. 1
0
        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");
            }
        }
Esempio n. 2
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            Exercise = await GetExercise();

            Exercise = await RepController.PrepareRepSummaryAsync(Exercise);

            Exercise.Key = Key;
            Refresh();
        }
Esempio n. 3
0
        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);
        }
Esempio n. 6
0
 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");
     }
 }
Esempio n. 7
0
        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();
        }
Esempio n. 8
0
 public LoginViewController(RepController repController)
 {
     _repController = repController;
 }
Esempio n. 9
0
 public AppUserController(RepController repController)
 {
     _repController = repController;
 }