Exemplo n.º 1
0
        public static Workout FromTemplate(WorkoutTemplate workoutTemplate)
        {
            Workout workout = new Workout()
            {
                Title = workoutTemplate.Title,
                WorkoutTemplatePath = workoutTemplate.WorkoutTemplatePath,
                MinLength = workoutTemplate.MinLength,
                MaxLength = workoutTemplate.MaxLength,
                Template = workoutTemplate
            };

            foreach (WorkoutTemplatePart part in workoutTemplate.WorkoutTemplateParts)
            {
                workout.WorkoutParts.Add(new WorkoutPart()
                {
                    Title = part.Title,
                    Template = part,
                    MinLength = part.MinLength,
                    MaxLength = part.MaxLength
                });
            }

            return workout;
        }
Exemplo n.º 2
0
        private void newButton_Click(object sender, EventArgs e)
        {
            using (NewWorkoutForm form = new NewWorkoutForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    template = form.Template;

                    workout = Workout.Workout.FromTemplate(template);

                    RefreshWorkout();
                }
            }
        }