Esempio n. 1
0
        static void Main(string[] args)
        {
            List <Task> taskList = new List <Task>();
            bool        repeat   = true;

            taskList = TestData();

            while (repeat)
            {
                try
                {
                    switch (GetInputFromMainMenu())
                    {
                    case 1:
                        Console.Clear();
                        DisplayAllTasks(taskList);
                        Pause();

                        break;

                    case 2:
                        taskList.Add(Task.AddOrEdit(null));
                        UserInput.Display("New task added!");
                        Pause();

                        break;

                    case 3:
                        if (DeleteTask(taskList))
                        {
                            UserInput.Display("\nDeleted!\n\n");
                        }
                        Pause();

                        break;

                    case 4:
                        MarkTaskAsComplete(taskList);
                        Pause();

                        break;

                    case 5:
                        Console.Clear();
                        while (repeat)
                        {
                            int selectedOption = AdvancedOptionMenu();
                            //if user exit advanced option repeat equals false
                            repeat = PerformAdvancedTask(selectedOption, taskList);
                            if (repeat)
                            {
                                Pause();
                            }
                        }
                        repeat = true;    //Set back to true for main menu


                        break;

                    case 6:
                        if (UserInput.UserConfirmationPrompt("Are you sure(Y/N)?"))
                        {
                            repeat = false;
                        }
                        break;

                    default:
                        break;
                    }
                }
                catch (ArgumentOutOfRangeException)
                {
                    UserInput.Display("That record does not exists. " +
                                      "Use option 1 to view the list of tasks");
                }
            }//while
            UserInput.Display("Goodbye!\n");
        }
Esempio n. 2
0
 private static void Pause()
 {
     UserInput.Display("Press any key to continue.......");
     Console.ReadKey();
 }