Esempio n. 1
0
 //All instances of books/other media are instantiated within the Catalog constructor
 public Catalog()
 {
     Books     = CatalogToDisk.GenerateBookListFromDisk();
     CDs       = CatalogToDisk.GenerateMusicCdListFromDisk();
     Magazines = CatalogToDisk.GenerateMagazineListFromDisk();
     Medias    = new List <Media>();
     Medias.AddRange(Books);
     Medias.AddRange(Magazines);
     Medias.AddRange(CDs);
 }
Esempio n. 2
0
        public void DisplayMenu()
        {
            while (true)
            {
                Console.Clear();

                Console.WriteLine("\n\n\n\t\t\t=====EIDMAR=LIBRARY=====");
                Console.WriteLine("\t\t\t/--x-/--x-/--x-/--x-/--x");
                Console.WriteLine("\t\t\t====WHY=ARE=YOU=HERE====");
                Console.WriteLine("\t\t\t[1] Browse our collection");
                Console.WriteLine("\t\t\t[2] Search our collection");
                Console.WriteLine("\t\t\t[3] Give it back");
                Console.WriteLine("\t\t\t[4] Let me out");
                Console.WriteLine("\t\t\t========================");
                Console.WriteLine("\t\t\tx--/-x--/-x--/-x--/-x--/");
                Console.WriteLine("\t\t\t========================");

                ConsoleKeyInfo keyInput = Console.ReadKey();

                if (keyInput.Key == ConsoleKey.D1 || keyInput.Key == ConsoleKey.NumPad1)
                {
                    Console.Clear();
                    Console.WriteLine("\t\t==========OUR=COLLECTION==========");
                    DisplayMediaOptions();
                }
                else if (keyInput.Key == ConsoleKey.D2 || keyInput.Key == ConsoleKey.NumPad2)
                {
                    Console.Clear();
                    Console.WriteLine("\n\n\t\t\t========================");
                    Console.WriteLine("\t\t\t=========Search=========\n");
                    DisplaySearchOptions();
                }
                else if (keyInput.Key == ConsoleKey.D3 || keyInput.Key == ConsoleKey.NumPad3)
                {
                    Console.Clear();
                    Console.WriteLine("\t\t\t==========BORROWED=ITEMS==========");
                    ReturnBook();
                    //Console.ReadKey();
                }
                else if (keyInput.Key == ConsoleKey.D4 || keyInput.Key == ConsoleKey.NumPad4)
                {
                    Console.Clear();
                    Console.WriteLine("\n\n\n\t\t\tLater.\n\n\n\n\n\n");

                    // Save before exiting
                    CatalogToDisk.SaveBooksStateToDisk(this);
                    CatalogToDisk.SaveCdStateToDisk(this);
                    CatalogToDisk.SaveMagazinesStateToDisk(this);

                    break;
                }
                else if (keyInput.Key == ConsoleKey.D0 || keyInput.Key == ConsoleKey.NumPad0)
                {
                    Console.Clear();
                    Console.Write("\n\n\t\t\t...What is your name?: ");
                    string name = Console.ReadLine();
                    if (name.ToLower().Contains("julius") || name.ToLower().Contains("cesar"))
                    {
                        Console.Clear();
                        Console.WriteLine("\n\n\t\t\tThe senators will meet you at the exit\n\n\n\n");
                        break;
                    }
                    else
                    {
                        continue;
                    }
                }
                else
                {
                    Console.Clear();
                    continue;
                }
            }
        }