Пример #1
0
    public HabitTracker()
    {
        Console.SetWindowSize(ANCHO_PANTALLA, ALTO_PANTALLA);

        tuAnyoEnPixeles = new TuAnyoEnPixeles();
        salir           = new Salir();
    }
Пример #2
0
    public Resumen()
    {
        opcion = 0;

        tracker = new Carga();

        ranuraElegida = -1;

        do
        {
            tracker.Dibujar(ranuraElegida);
            ranuraElegida = tracker.CambiarOpcion();
        } while (ranuraElegida == -1);
        tuAnyoEnPixeles = new TuAnyoEnPixeles();
    }
Пример #3
0
    public int ConfirmarHabito()
    {
        int opcionActual = 0;
        int confirmar    = -1;

        Console.Clear();

        Console.SetCursorPosition(
            HabitTracker.ANCHO_PANTALLA / 2 -
            ("   _  _    ___    _  _   _   ___   _  _ ___ ___ _  _  ___ ___ ".Length /
             2), 3);
        Console.WriteLine(@"   _  _    ___    _  _   _   ___   _  _ ___ ___ _  _  ___ ___ ");
        Console.SetCursorPosition(
            HabitTracker.ANCHO_PANTALLA / 2 -
            ("   _  _    ___    _  _   _   ___   _  _ ___ ___ _  _  ___ ___ ".Length /
             2), 4);
        Console.WriteLine(@"  (_)| |  / _ \  | || | /_\ / __| | || | __/ __| || |/ _ \__ \");
        Console.SetCursorPosition(
            HabitTracker.ANCHO_PANTALLA / 2 -
            ("   _  _    ___    _  _   _   ___   _  _ ___ ___ _  _  ___ ___ ".Length /
             2), 5);
        Console.WriteLine(@" / /_| |_| (_) | | __ |/ _ \\__ \ | __ | _| (__| __ | (_) |/_/");
        Console.SetCursorPosition(
            HabitTracker.ANCHO_PANTALLA / 2 -
            ("   _  _    ___    _  _   _   ___   _  _ ___ ___ _  _  ___ ___ ".Length /
             2), 6);
        Console.WriteLine(@" \___|____\___/  |_||_/_/ \_\___/ |_||_|___\___|_||_|\___/(_) ");

        while (confirmar == -1)
        {
            TuAnyoEnPixeles.DibujarSiYNo(opcionActual);
            ConsoleKeyInfo tecla = Console.ReadKey(true);
            if (tecla.Key == ConsoleKey.RightArrow ||
                tecla.Key == ConsoleKey.LeftArrow)
            {
                opcionActual = (opcionActual + 1) % 2;
            }
            if (tecla.Key == ConsoleKey.Spacebar || tecla.Key == ConsoleKey.Enter)
            {
                return(opcionActual);
            }
        }
        return(-1);
    }
Пример #4
0
    public void EjecutarTuAnyoEnPixeles()
    {
        int opcionAnyo;

        do
        {
            tuAnyoEnPixeles.Dibujar();
            do
            {
                for (int i = 0; i < tuAnyoEnPixeles.GetNumeroDeOpciones(); i++)
                {
                    tuAnyoEnPixeles.DibujarOpcion(i);
                }
                opcionAnyo = tuAnyoEnPixeles.CambiarOpcion();
            } while (opcionAnyo == -1);

            switch (opcionAnyo)
            {
            case TuAnyoEnPixeles.ACTUALIZAR:
                tuAnyoEnPixeles.Actualizar();
                break;

            case TuAnyoEnPixeles.ACTUALIZAR_HOY:
                tuAnyoEnPixeles.ActualizarHoy();
                break;

            case TuAnyoEnPixeles.BORRAR:
                if (tuAnyoEnPixeles.BorrarTuAnyoEnPixeles() == 0)
                {
                    File.Delete(@"data\anyo.txt");
                    tuAnyoEnPixeles = new TuAnyoEnPixeles();
                }
                break;
            }
        } while (opcionAnyo != TuAnyoEnPixeles.VOLVER);
    }