예제 #1
0
        private void MoveTask()
        {
            Console.Clear();
            int           moveInt;
            List <string> taskInfo        = new List <string>();
            List <string> sortOptionsMenu = AddEnumItems.CreateUpperCase(typeof(sortMenuItems));

            //Add tasks to specified list and displays them
            int returnIndex = DisplayMenu(sortOptionsMenu, "Type Menu");

            switch (returnIndex)
            {
            case (int)sortMenuItems.Todo:
                foreach (Task task in todoHandler.GetTasks(TodoHandler.ListType.Todo))
                {
                    taskInfo.Add(task.Title);
                }
                break;

            case (int)sortMenuItems.Doing:
                foreach (Task task in todoHandler.GetTasks(TodoHandler.ListType.Doing))
                {
                    taskInfo.Add(task.Title);
                }
                break;

            case (int)sortMenuItems.Done:
                foreach (Task task in todoHandler.GetTasks(TodoHandler.ListType.Done))
                {
                    taskInfo.Add(task.Title);
                }
                break;

            default:
                break;
            }

            moveInt = DisplayMenu(taskInfo, "Tasks");

            var choice = taskInfo[moveInt];

            var taskIndex = todoHandler.GetTasks().FindIndex(p => p.Title == choice);

            todoHandler.MoveTask(taskIndex, todoHandler.GetListType(taskIndex));
        }