static void Main(string[] args)
        {
            string        CurrentDirectory = Directory.GetCurrentDirectory();
            DirectoryInfo directory        = new DirectoryInfo(CurrentDirectory);
            var           fileName         = Path.Combine(directory.FullName, "TrainingRoutine.csv");
            var           fileContents     = ReadTrainingRoutine(fileName);

            UserScreen.WelcomeScreen();

            int option = 0;

            while ((option = Menu.Prompt()) != 4)
            {
                switch (option)
                {
                case 1:
                    DisplayFullRoutine(fileContents);
                    break;

                case 2:
                    EditSelection();
                    break;

                case 3:
                    DisplayEditedRoutine();
                    break;
                }
            }
        }
        // Case 3: Displays selected Routines.
        static void DisplayEditedRoutine()
        {
            Console.Clear();
            Console.WriteLine("-----------------------------------");
            Console.WriteLine("        Your Edited Workout        ");
            Console.WriteLine("-----------------------------------");

            _editedTrainingRoutine.ForEach((routine) => Console.WriteLine(routine));

            UserScreen.ClosingCase();
        }
        // Case 1: Displays Full Routine.
        static void DisplayFullRoutine(List <TrainingRoutine> _output)
        {
            Console.Clear();
            Console.WriteLine("-----------------------------------");
            Console.WriteLine("   View Full Race Training Plan    ");
            Console.WriteLine("-----------------------------------");
            foreach (var item in _output)
            {
                Console.WriteLine("Your Week " + item.Week + ", Day " + item.Day + ", Workout is " + item.Workout);
            }

            UserScreen.ClosingCase();
        }
Example #4
0
        // Displays the application menu and prompts the user for selection.
        internal static int Prompt()
        {
            Console.WriteLine("--------------------------------------------------");
            Console.WriteLine("            Select One of the Following           ");
            Console.WriteLine("--------------------------------------------------");

            Display();
            int option = 0;

            option = UserScreen.Prompt("Please select an option (1-" + (_options.Length.ToString()) + "): ",
                                       (int)1, (int)4);

            return(option);
        }
        // Case 2: Prompts user for Week, Day, and Routine and edits routine.


        static void EditSelection()
        {
            Console.Clear();
            Console.WriteLine("-----------------------------------");
            Console.WriteLine("            Edit Workout           ");
            Console.WriteLine("-----------------------------------");

            bool done = false;

            do
            {
                int    weekSelection    = UserScreen.Prompt("Which week do you want to edit? ", 1, 12);
                int    daySelection     = UserScreen.Prompt("Which day do you want to edit? ", 1, 7);
                string workoutSelection = UserScreen.Prompt("What workout will you do? ");
                //+"" is the same as converting an INT to a STRING
                _editedTrainingRoutine.Add(new TrainingRoutine {
                    Week = weekSelection + "", Day = daySelection + "", Workout = workoutSelection
                });
                done = UserScreen.Continue("Edit another routine? Press y/n ");
            } while(!done);

            Console.Clear();
        }