Пример #1
0
        public Task AskForTask()
        {
            var mostRecentTasks = _taskService.GetTasksByTaskIds(_timeService.GetRecentlyRecordedTaskIds(5));

            _outputService.ShowInformation("Recent Tasks:");
            _outputService.OutputList(
                mostRecentTasks.Select(x => $"{x.Name,10} {x.Description.Truncate(50),10}"));

            var task = AskForSpecificTask();

            if (task != null)
            {
                return(task);
            }

            _outputService.ShowInformation(
                "Ok. Let's figure out what you are working on. We're going to list some projects.");
            var projects = _projectService.GetProjects().ToList();

            _outputService.ShowInformation(OutputProjects(projects));
            var projectKey = _inputService.AskForInput("Which project Key are you working on?");

            _outputService.LoadingMessage("Getting tasks for that project. This might take a while. (especially for large projects)");
            var project = _projectService.GetProjectByKey(projectKey);
            var tasks   = _taskService.GetTasksByProject(project);

            _outputService.ShowInformation("Ok. We've got the tasks. Outputting the tasks for that project.");
            _outputService.ShowInformation(OutputTasks(tasks));

            return(AskForSpecificTask());
        }