private static void DisplayMenu(MenuOption[] options, MenuOption exitOption, out int min, out int max) { min = 1; int count; for(count = 0 ; count < options.Length ; count++) { Console.WriteLine("{0,4}. {1}", count + 1, options[count]); } max = count; if (exitOption != null) Console.WriteLine("{0,4}. {1}", min = 0, exitOption); }
public Menu(string title, MenuOption[] menuOptions, MenuOption exitOption) { _Title = title; _MenuOptions = menuOptions; _ExitOption = exitOption; }
public Menu GetBorrowingsList() { MenuOption[] borrowingsList = new MenuOption[_RecordOfBorrowings.Count]; try { int i = 0; foreach (Borrowing b in _RecordOfBorrowings.Values) { borrowingsList[i] = new MenuOption(b.Item.ToString(), b, null, null); i++; } } catch (RecordCustomerException e) { Console.WriteLine(e.Message); } return new Menu(null, borrowingsList, MenuOption.Cancel); }
public Menu GetPatronList() { MenuOption[] patronList = new MenuOption[_Patrons.Count]; try { int i = 0; foreach (Patron p in _Patrons.Values) { patronList[i] = new MenuOption(p.ToString(), p, null, null); i++; } } catch (DisplayPatronException e) { Console.WriteLine(e.Message); } return new Menu(null, patronList, MenuOption.Cancel); }
public Menu GetBookList() { MenuOption[] bookList = new MenuOption[_Books.Count]; try { int i = 0; foreach (BorrowableItem b in _Books.Values) { bookList[i] = new MenuOption(b.ToString(), b, null, null); i++; } } catch (DisplayBookException e) { Console.WriteLine(e.Message); } return new Menu(null, bookList, MenuOption.Cancel); }