Пример #1
0
 static void OutputInfo(Task.Task1 task)
 {
     System.Console.WriteLine("- {0}", task.GetTitle());
     System.Console.WriteLine("[{0}][{1}]", task.typeString, task.stateString);
     System.Console.WriteLine("Priority: {0}, Due till {1}", task.priorityString, task.dateString);
     System.Console.WriteLine("{0}", task.GetSummary());
 }
Пример #2
0
        static void Main(string[] args)
        {
            List <Task.Task1> tasks = new List <Task.Task1>();

            while (true)
            {
                string inputMessage = Console.ReadLine();
                if (inputMessage == "add")
                {
                    Task.Task1 newTask = new Task.Task1();;
                    CreateTask(ref newTask);
                    tasks.Add(newTask);
                }
                if (inputMessage == "list")
                {
                    for (int i = 0; i < tasks.Count; i++)
                    {
                        if (tasks[i].stateString != "Done" && tasks[i].error == false)
                        {
                            OutputInfo(tasks[i]);
                        }
                    }
                }
                if (inputMessage == "done")
                {
                    DoneTask(tasks);
                }
                if (inputMessage == "wontdo")
                {
                    WontDoState(tasks);
                }
                if (inputMessage == "quit" || inputMessage == "q")
                {
                    Environment.Exit(0);
                }
            }
        }
Пример #3
0
        static void CreateTask(ref Task.Task1 task)
        {
            bool error = false;

            System.Console.WriteLine("Введите заголовок");
            string title = Console.ReadLine();

            System.Console.WriteLine("Введите описание");
            string summary = Console.ReadLine();

            System.Console.WriteLine("Введите срок");
            System.DateTime dueDate;

            bool isDate = DateTime.TryParse(Console.ReadLine(), out dueDate);

            if (isDate == false)
            {
                error = true;
            }
            task.dateString = dueDate.ToString();
            System.Console.WriteLine("Введите тип");
            string type = Console.ReadLine();

            TaskType.Type typeWork = TaskType.Type.Nullable;
            if (type == "Study")
            {
                task.typeString = "Study";
                typeWork        = TaskType.Type.Study;
            }
            else if (type == "Work")
            {
                task.typeString = "Work";
                typeWork        = TaskType.Type.Work;
            }
            else if (type == "Personal")
            {
                task.typeString = "Personal";
                typeWork        = TaskType.Type.Personal;
            }
            else
            {
                error = true;
            }

            System.Console.WriteLine("Установите приоритет");
            string priority = Console.ReadLine();

            TaskPriority.Priority priority1 = TaskPriority.Priority.Nullable;
            if (priority == "Low")
            {
                task.priorityString = "Low";
                priority1           = TaskPriority.Priority.Low;
            }
            else if (priority == "Normal")
            {
                task.priorityString = "Normal";
                priority1           = TaskPriority.Priority.Normal;
            }
            else if (priority == "High")
            {
                task.priorityString = "High";
                priority1           = TaskPriority.Priority.High;
            }
            else
            {
                error = true;
            }
            task.stateString = "New";
            if (error)
            {
                System.Console.WriteLine("Ошибка ввода!");
                task.error = true;
                return;
            }
            task.SetValue(title, summary, typeWork, priority1, dueDate);
        }
Пример #4
0
        public static void Main(string[] args)
        {
            bool calculatorWorks = true;

            while (calculatorWorks)
            {
                Console.WriteLine("0: Exit");
                Console.WriteLine("1: Task 1");
                Console.WriteLine("2: Task 2");
                Console.WriteLine("3: Task 3");
                Console.WriteLine("4: Task 4");
                Console.WriteLine("5: Task 5");
                Console.WriteLine("6: Task 6");
                Console.WriteLine("7: Task 7");
                Console.WriteLine("8: Task 8");
                Console.WriteLine("9: Task 9");
                Console.WriteLine("10: Task 10");
                Console.WriteLine("11: Task 11");
                Console.WriteLine("12: Task 12");
                Console.WriteLine("13: Task 13");

                switch (Console.ReadLine())
                {
                case "0":
                    calculatorWorks = false;
                    break;

                case "1":
                    Task1.Calc();
                    break;

                case "2":
                    Task2.Calc();
                    break;

                case "3":
                    Task3.Calc();
                    break;

                case "4":
                    Task4.Calc();
                    break;

                case "5":
                    Task5.Calc();
                    break;

                case "6":
                    Task6.Styles();
                    break;

                case "7":
                    Task7.Array();
                    break;

                case "8":
                    Task8.Array();
                    break;

                case "9":
                    Task9.Array();
                    break;

                case "10":
                    Task10.Array();
                    break;

                case "11":
                    Task11.Calc();
                    break;

                case "12":
                    Task12.String();
                    break;

                case "13":
                    Task13.Calc();
                    break;

                default:
                {
                    Console.WriteLine("Operation not entered correctly, enter again");
                }

                break;
                }
            }

            Console.ReadKey();
        }