Example #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);

    }
Example #2
0
    public void ShowTaskCursor(TasksList tasksList, int option)
    {
        string[] camps = { "Description:", "DateStart:", "DateDue:",
                           "Category:",    "Priority:",  "Confidential:" };
        string[] campos = { "Descripcion:", "DataInicio:", "DateFin:",
                            "Categoria:",   "Prioridad:",  "Confidencial:" };
        int      contCamps;

        try
        {
            if (!GetLanguage)
            {
                option   += 1;
                contCamps = 0;
                config.WriteFore(0, 4, camps[contCamps],
                                 "green", false);
                config.WriteFore((camps[contCamps].Length + 4), 4,
                                 tasksScreen.checkVacio(tasksList.Get(option).Description),
                                 "green", true);
                contCamps++;

                Console.WriteLine();
                config.WriteFore(0, 7, camps[contCamps],
                                 "green", false);
                config.WriteFore((camps[contCamps].Length + 4), 7,
                                 tasksScreen.checkVacio(tasksList.Get(option).DateStart),
                                 "green", true);
                contCamps++;

                config.WriteFore(0, 8, camps[contCamps],
                                 "green", false);
                config.WriteFore((camps[contCamps].Length + 4), 8,
                                 tasksScreen.checkVacio(tasksList.Get(option).DateDue),
                                 "green", true);
                contCamps++;

                Console.WriteLine();
                config.WriteFore(0, 10,
                                 camps[contCamps], "green", false);
                config.WriteFore((camps[contCamps].Length + 4), 10,
                                 tasksScreen.checkVacio(tasksList.Get(option).Category),
                                 "green", true);
                contCamps++;

                config.WriteFore(0, 12,
                                 camps[contCamps], "green", false);
                config.WriteFore((camps[contCamps].Length + 4), 12,
                                 tasksScreen.checkVacio(tasksList.Get(option).Priority),
                                 "green", true);
                contCamps++;

                config.WriteFore(0, 14,
                                 camps[contCamps], "green", false);
                config.WriteFore((camps[contCamps].Length + 4), 14,
                                 tasksScreen.checkVacio(tasksList.Get(option).Confidential),
                                 "green", true);
                contCamps = 0;
            }
            else
            {
                option   += 1;
                contCamps = 0;
                config.WriteFore(0, 4, campos[contCamps],
                                 "green", false);
                config.WriteFore((campos[contCamps].Length + 4), 4,
                                 tasksScreen.checkVacio(tasksList.Get(option).Description),
                                 "green", true);
                contCamps++;

                Console.WriteLine();
                config.WriteFore(0, 7, campos[contCamps],
                                 "green", false);
                config.WriteFore((campos[contCamps].Length + 4), 7,
                                 tasksScreen.checkVacio(tasksList.Get(option).DateStart),
                                 "green", true);
                contCamps++;

                config.WriteFore(0, 8, campos[contCamps],
                                 "green", false);
                config.WriteFore((campos[contCamps].Length + 4), 8,
                                 tasksScreen.checkVacio(tasksList.Get(option).DateDue),
                                 "green", true);
                contCamps++;

                Console.WriteLine();
                config.WriteFore(0, 10,
                                 campos[contCamps], "green", false);
                config.WriteFore((campos[contCamps].Length + 4), 10,
                                 tasksScreen.checkVacio(tasksList.Get(option).Category),
                                 "green", true);
                contCamps++;

                config.WriteFore(0, 12,
                                 campos[contCamps], "green", false);
                config.WriteFore((campos[contCamps].Length + 4), 12,
                                 tasksScreen.checkVacio(tasksList.Get(option).Priority),
                                 "green", true);
                contCamps++;

                config.WriteFore(0, 14,
                                 campos[contCamps], "green", false);
                config.WriteFore((campos[contCamps].Length + 4), 14,
                                 tasksScreen.checkVacio(tasksList.Get(option).Confidential),
                                 "green", true);
                contCamps = 0;
            }
            //Para ingresar bien la opcion ya que en el Get luego se resta 1
        }
        catch (Exception e)
        {
            Console.WriteLine("Error: " + e.Message);
        }
    }