private void GetExerciseButton_Click(object sender, EventArgs e) { using (ExerciseChooseForm Window = new ExerciseChooseForm()) { if (Window.ShowDialog() == DialogResult.OK) { this.ExerciseNameLabel.Text = Window.exerciseName; this.searchExerciseChosen = true; } } }
private void AddTrainToolStripMenuItem_Click(object sender, EventArgs e) { using (ExerciseChooseForm Window = new ExerciseChooseForm()) { if (Window.ShowDialog() == DialogResult.OK) { Workouts workout = new Workouts { Num_Sets = 0 }; workout.Exercises.Add(ctx.Exercises.FirstOrDefault(ex => ex.Name == Window.exerciseName)); workout.Days.Add(ctx.Days.FirstOrDefault(d => d.ID_Day == dayId)); ctx.Workouts.Add(workout); ctx.SaveChanges(); UpdateTreeView(); (new EditSetsForm(workout.ID_Workout)).ShowDialog(); UpdateTreeView(); } } }
private void ChooseExToolStripMenuItem_Click(object sender, EventArgs e) { string exerciseName; using (ExerciseChooseForm Window = new ExerciseChooseForm()) { if (Window.ShowDialog() == DialogResult.OK) { exerciseName = Window.exerciseName; } else { return; } } List <string> exercises = new List <string>(); exercises.Add(exerciseName); this.UpdateChart(exercises); }