예제 #1
0
    public void SaveImageDataExercise()
    {
        ImageFunctions img_crud = new ImageFunctions();

        List <Images> img_collections = new List <Images>();

        int  selection = 0, counter = 0;
        bool loop_control = true;


        while (loop_control)
        {
            WriteLine("***Bienvenido al gestor de imagenes***\n");

            WriteLine($"Numero de imagenes: {counter}\n");

            WriteLine("1. Agregar ficha");
            WriteLine("2. Ver fichas existentes");
            WriteLine("3. Buscar ficha");
            WriteLine("4. Salir");

            Write("Seleccione una opcion: ");
            selection = int.Parse(ReadLine());

            Clear();

            switch (selection)
            {
            case 1:

                if (counter <= 700)
                {
                    try{
                        img_collections.Add(img_crud.AddImages(img_collections));
                        counter++;
                    }
                    catch {
                        WriteLine("\nHa ingresado un valor incorrecto");
                    }
                }
                else
                {
                    WriteLine("Se ha excedido el limite de imagenes");
                }

                break;

            case 2:

                WriteLine(img_crud.WatchImages(img_collections));
                break;

            case 3:

                WriteLine(img_crud.SearchImages(img_collections));
                break;

            case 4:

                loop_control = false;
                break;

            default:

                WriteLine("No se ha seleccionado un valor correcto");
                break;
            }

            ex_prac04.StopConsole();
            Clear();
        }
    }