public void Add() { if (!GetLanguage) options = camps; else options = campos; Console.Clear(); contCamps = 0; config.WriteFore(options[contCamps], "white", false); string description = Console.ReadLine(); contCamps++; config.WriteFore(options[contCamps], "white", false); string dateStart = Console.ReadLine(); contCamps++; config.WriteFore(options[contCamps], "white", false); string dateDue = Console.ReadLine(); contCamps++; config.WriteFore(options[contCamps], "white", false); string category = Console.ReadLine(); contCamps++; config.WriteFore(options[contCamps], "white", false); string answer = Console.ReadLine(); int priority = 0; if (answer != "") priority = Convert.ToInt32(answer); contCamps++; config.WriteFore(options[contCamps], "white", false); answer = Console.ReadLine(); bool confidential = false; if (answer == "yes") confidential = true; else if (answer == "no") confidential = false; contCamps = 0; tasks.Add(new Task( description, dateStart, dateDue, category, priority, confidential)); tasks.Save(); }
private void GetChosenOption(ref TasksList Task, ref int option, ref bool exit) { ConsoleKeyInfo key; do { key = Console.ReadKey(true); } while (Console.KeyAvailable); switch (key.Key) { case ConsoleKey.Escape: exit = true; Task.Save(); break; case ConsoleKey.NumPad1: Add(); break; case ConsoleKey.NumPad2: Modify(option); break; case ConsoleKey.NumPad3: Delete(option); break; //case ConsoleKey.NumPad4: Search();break; case ConsoleKey.DownArrow: if (option < Task.Count) option++; else option = 1; break; case ConsoleKey.UpArrow: if (option > 1) option--; else option = Task.Count; break; default: break; } }