public MenuCreator(GarageCreator garageCreator) { BaseMenu.isPagedMenu = true; BaseMenu.setHeader("Garage List:\n type \"new\" to create a new garage!"); BaseMenu.setFooter("\u25c4 Previews Page\t\tNext Page \u25ba\nESC. Exit"); BaseMenu.addMethod("new", () => Menu.ActiveMenu = GarageCreateMenu); BaseMenu.addMethod("Escape", ExitApp); BaseMenu.setdefaultMethod(gotoMenuForGarage); BaseMenu.ViewInput = true; GarageCreateMenu.setHeader("Welcome to Garage!\nCreate your Garage by selecting a type\n"); GarageCreateMenu.addItem("AirPlanes"); GarageCreateMenu.addItem("Boats"); GarageCreateMenu.addItem("Busses"); GarageCreateMenu.addItem("Cars"); GarageCreateMenu.addItem("Motorcycles"); GarageCreateMenu.setFooter("\u25c4 Reset info\t\tNext Step \u25ba\nESC. Back"); GarageCreateMenu.addMethod("LeftArrow", () => { for (int i = 0; i < tempgarageinfo.Length; i++) { tempgarageinfo[i] = ""; } }); GarageCreateMenu.addMethod("RightArrow", buildGarage); GarageCreateMenu.addMethod("Escape", () => Menu.ActiveMenu = BaseMenu); GarageCreateMenu.setdefaultMethod(() => creategarage(garageCreator)); GarageCreateMenu.ViewInput = true; }
private void creategarage(GarageCreator garageCreator) { int number = 0; int number2 = 0; if (tempgarageinfo[0] == "") { GarageCreateMenu.ErrorMessage = "Please type the name!"; } else if (!int.TryParse(tempgarageinfo[0], out number) || !int.TryParse(tempgarageinfo[2], out number2)) { GarageCreateMenu.ErrorMessage = "You entered a string insdead of number in the size field!"; } else if (number == 0 || number2 == 0) { GarageCreateMenu.ErrorMessage = "Really 0?"; } else { switch (number) { case 1: garageCreator.createGarage <Airplane>(tempgarageinfo[1], number2); GarageCreateMenu.ErrorMessage = "Created a New Airplanes Garage!"; break; case 2: garageCreator.createGarage <Boat>(tempgarageinfo[1], number2); GarageCreateMenu.ErrorMessage = "Created a New Boats Garage!"; break; case 3: garageCreator.createGarage <Buss>(tempgarageinfo[1], number2); GarageCreateMenu.ErrorMessage = "Created a New Busses Garage!"; break; case 4: garageCreator.createGarage <Car>(tempgarageinfo[1], number2); GarageCreateMenu.ErrorMessage = "Created a New Cars Garage!"; break; case 5: garageCreator.createGarage <Motorcycle>(tempgarageinfo[1], number2); GarageCreateMenu.ErrorMessage = "Created a New Motorcycles Garage!"; break; default: //GarageCreateMenu.ErrorMessage = "Numbers from the list please!"; //tempgarageinfo.Clear(); break; } } for (int i = 0; i < tempgarageinfo.Length; i++) { tempgarageinfo[i] = ""; } }