public void ListFruit() { ConzapTools.ClearScreen(); ConzapTools.PrintObjects(Fruits) .Configure(ObjectPrinterOptions.UseOnlyCustomFields) .ItemHeadingFactory(f => f.Type) .Print(); }
public void CreateFruit() { ConzapTools.ClearScreen(); ConzapTools.PrintLine("CREATE NEW FRUIT"); var fruit = new Fruit(); fruit.Type = ConzapTools.ChooseString("Type: "); fruit.Description = ConzapTools.ChooseString("Description: "); fruit.Quantity = ConzapTools.ChooseInt("Amount: ", 0, 100); Fruits.Add(fruit); }
public void Run(string heading = null) { heading = heading ?? Heading; while (true) { var listItems = MenuItems.Select(ami => ami.Title).ToList(); ConzapToolHelpers.ClearAndPrintHeading(heading); var input = ConzapTools.ChooseFromList(listItems.ToArray()) - 1; ConzapTools.ClearScreen(); var chosenMenuItem = MenuItems[input]; var value = chosenMenuItem.Value; if (value == "quit") { break; } MenuItems[input].Callback(); } }
// 1. Pass type but no field information private static void ObjectPrinting1() { ConzapTools.ClearScreen(); ConzapTools.PrintObjects(fruit).Print(); }