public void ShowRoutine() { ResetControls(); OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = RoutineManager.routineDirectoryPath; openFileDialog.Title = "Open routine"; DialogResult dialogResult = openFileDialog.ShowDialog(); if (dialogResult == DialogResult.OK) { try { StretchingRoutine stretchingRoutine = RoutineManager.LoadStretchingtRoutine(openFileDialog.FileName); MessageBox.Show("Stretching routine (" + stretchingRoutine.RoutineName + ") was opened succesfully."); FillListView(stretchingRoutine); stretchingRoutine.UpdateRoutine(); TotalExercisesLabel.Text = "Total Exercises: " + stretchingRoutine.TotalExercises; TotalSetsLabel.Text = "Total Sets: " + stretchingRoutine.TotalSets; StartLabel.Text = "Start: " + stretchingRoutine.Start.ToShortDateString(); if (stretchingRoutine.Duration.TotalDays >= 2) { DurationLabel.Text = "Duration: " + stretchingRoutine.Duration.TotalDays.ToString("F0") + " days"; } else { DurationLabel.Text = "Duration: " + stretchingRoutine.Duration.TotalDays.ToString("F0") + " day"; } } catch (InvalidCastException) { MessageBox.Show("Select the proper stretching routine."); } } }