示例#1
0
        /* Displays the workout associated with this control. It will be presented as rows of 
         * sets, with the exercise name at the top. 
         * Note that no existing children controls are removed before adding the new ones.
         */
        private void DisplayWorkout()
        {
            this.dateLbl.Text = this.date.Date.ToString("dd.MM.yy");
            
            //get all sets from the database, and add them as SetRowControls.
            List<SetActivityExercise> rows = this.db.GetSetsActivitiesExercises(this.date);

            int currentSeqNum = -1;
            SetRowControl prevRowControl = null;
            foreach (SetActivityExercise row in rows)
            {
                //for every time a new activity is encountered, the exercise name is added.
                if (currentSeqNum != row.activity.seqNum)
                {
                    ExerciseNameTitle nameRow = new ExerciseNameTitle();
                    nameRow.Tag = row.activity;
                    nameRow.SetExerciseName(row.exercise.exerciseName);
                    nameRow.SetRefreshCallback(RefreshBtn_Click, nameRow);

                    this.setListFlp.Controls.Add(nameRow);

                    currentSeqNum = row.activity.seqNum;
                    prevRowControl = null;

                }

                Workload workload = new Workload(row.exercise.exerciseFormat, row.set.reps, 
                    row.set.weight, row.set.secs);

                SetRowControl rowControl = new SetRowControl(this.db, row.set.setSeqNum, workload, 
                    row.activity.activityId, this.date);
                this.setListFlp.Controls.Add(rowControl);

                if (prevRowControl != null)
                {
                    prevRowControl.SetNextSetRowControl(rowControl);
                }
                prevRowControl = rowControl;
                
            }

            this.commentsRichTextBox.Text = this.db.GetCommentsAtDate(this.date);
        }
示例#2
0
 public void SetNextSetRowControl(SetRowControl nextSet)
 {
     this.nextSet = nextSet;
 }