예제 #1
0
        private async Task UpdateFormReps()
        {
            MultipleAttributes ma = await FormController.LoadReps(new MultipleAttributes(
                                                                      gridForm,
                                                                      SelectedType,
                                                                      currentRow,
                                                                      btnAddRep,
                                                                      repeatableLblText));

            gridForm          = ma.grid;
            SelectedType      = ma.type;
            currentRow        = ma.num;
            btnAddRep         = ma.btn;
            repeatableLblText = ma.text;
        }
예제 #2
0
        public static async Task <MultipleAttributes> LoadReps(MultipleAttributes ma)
        {
            //Clarify the attributes
            Grid         gridForm          = ma.grid;
            int          currentRow        = Grid.GetRow(gridForm.Children[0]);
            ExerciseType selectedType      = ma.type;
            string       repeatableLblText = ma.text;
            Button       btnAddRep         = ma.btn;

            for (int i = 0; i < selectedType.Reps.Count; i++)
            {
                selectedType.Reps[i].Index = i;
                ++currentRow;

                gridForm.Children.Add(NewGridLabel(0, currentRow, repeatableLblText));

                //Fill in each rep entry
                Entry tempEntry = NewGridRepEntry(1, currentRow, null);
                tempEntry.Text = selectedType.Reps[i].Amount;
                gridForm.Children.Add(tempEntry);

                gridForm = await AddDeleteButton(currentRow, gridForm, selectedType, btnAddRep);

                //Move add button down with the new row
                Grid.SetRow(btnAddRep, currentRow);
            }

            //Save changes back to class and return it
            ma.grid = gridForm;
            ma.num  = currentRow;
            ma.type = selectedType;
            ma.text = repeatableLblText;
            ma.btn  = btnAddRep;

            return(ma);
        }