예제 #1
0
        static void Main(string[] args)
        {
            //var todos = new List<string>()

            //var DoneTodos = new List<string>();

            Welcome();

            var name = Console.ReadLine();

            while (true)
            {
                var option = showMenuAndGetChoice(name);


                if (option == "1")
                {
                    Console.WriteLine("=============================================");

                    Console.WriteLine("Add TODO:");

                    Console.WriteLine("=============================================");

                    string input = Console.ReadLine();

                    Todos.Add(input);
                }
                else if (option == "2")
                {
                    Console.WriteLine("=============================================");

                    Console.WriteLine(" View TODOLIST:");

                    Console.WriteLine("=============================================");

                    for (var i = 0; i < Todos.Count; i++)
                    {
                        Console.WriteLine(Todos[i]);
                    }
                }
                else if (option == "3")
                {
                    Console.WriteLine("=============================================");

                    Console.WriteLine(" Remove a TODO from your TODOLIST: ");

                    Console.WriteLine("=============================================");

                    for (var i = 0; i < Todos.Count; i++)
                    {
                        Console.WriteLine((i + 1) + " - " + Todos[i]);
                    }

                    Console.WriteLine("=============================================");

                    Console.WriteLine("Enter the number of the TODO you want to remove:");

                    Console.WriteLine("=============================================");

                    string input = Console.ReadLine();

                    int choiceInt = int.Parse(input);

                    string taskToMove = Todos[choiceInt];

                    Todos.RemoveAt(choiceInt);

                    DoneTodos.Add(taskToMove);
                }

                else if (option == "4")
                {
                    Console.WriteLine("=============================================");

                    Console.WriteLine(" View Completed TODOLIST: ");

                    Console.WriteLine("=============================================");

                    for (var i = 0; i < DoneTodos.Count; i++)
                    {
                        Console.WriteLine(DoneTodos[i]);
                    }
                }

                else if (option == "5")
                {
                    Console.WriteLine("=============================================");

                    Console.WriteLine(" QUIT ");

                    Console.WriteLine("=============================================");

                    break;
                }
                else
                {
                    Console.WriteLine("Only enter 1, 2 , 3, 4, or 5");
                }
            }
        }
 private Task DeleteTodoImpl(int index)
 {
     Todos.RemoveAt(index);
     return(Task.FromResult(Unit.Default));
 }