Ejemplo n.º 1
0
    public void Modify(int index)
    {
        if (!GetLanguage)
        {
            options = camps;
            optionsModi = modifies;
        }
        else
            options = campos;

        Task taskToModify = tasks.Get(index);

        Console.Clear();
        contCamps = 0;
        config.WriteFore(0, 4, options[contCamps], "white", false);
        Console.Write("  ");

        Console.ForegroundColor = ConsoleColor.Gray;
        Console.WriteLine(optionsModi[contCamps], taskToModify.Description);
        string answer = Console.ReadLine();
        if (answer != "")
            taskToModify.Description = answer;
        contCamps++;

        config.WriteFore(options[contCamps], "white", false);
        Console.Write("  ");

        Console.ForegroundColor = ConsoleColor.Gray;
        Console.WriteLine(optionsModi[contCamps], taskToModify.DateStart);
        answer = Console.ReadLine();
        if (answer != "")
            taskToModify.DateStart = answer;
        contCamps++;

        config.WriteFore(options[contCamps], "white", false);
        Console.Write("  ");

        Console.ForegroundColor = ConsoleColor.Gray;
        Console.WriteLine(optionsModi[contCamps], taskToModify.DateDue);
        answer = Console.ReadLine();
        if (answer != "")
            taskToModify.DateDue = answer;
        contCamps++;

        config.WriteFore(options[contCamps], "white", false);
        Console.Write("  ");

        Console.ForegroundColor = ConsoleColor.Gray;
        Console.WriteLine(optionsModi[contCamps], taskToModify.Category);
        answer = Console.ReadLine();
        if (answer != "")
            taskToModify.Category = answer;
        contCamps++;

        config.WriteFore(options[contCamps], "white", false);
        Console.Write("  ");

        Console.ForegroundColor = ConsoleColor.Gray;
        Console.WriteLine(optionsModi[contCamps], taskToModify.Priority);
        answer = Console.ReadLine();
        if (answer != "")
            taskToModify.Priority = Convert.ToInt32(answer);
        contCamps++;

        config.WriteFore(options[contCamps], "white", false);
        Console.Write("  ");

        Console.ForegroundColor = ConsoleColor.Gray;
        if (!GetLanguage)
        {
            if (taskToModify.Confidential)
                Console.WriteLine(optionsModi[contCamps] + "(was yes)");
            else if (!taskToModify.Confidential)
                Console.WriteLine(optionsModi[contCamps] + "(was no)");
        }
        else
        {
            if (taskToModify.Confidential)
                Console.WriteLine(optionsModi[contCamps] + "(era si)");
            else if (!taskToModify.Confidential)
                Console.WriteLine(optionsModi[contCamps] + "(era no)");
        }
        answer = Console.ReadLine();
        if (answer == "yes" || answer == "si")
            taskToModify.Confidential = true;
        else if (answer == "no")
            taskToModify.Confidential = false;

        tasks.Set(index, taskToModify);

    }