Пример #1
0
 public void ListFruit()
 {
     ConzapTools.ClearScreen();
     ConzapTools.PrintObjects(Fruits)
     .Configure(ObjectPrinterOptions.UseOnlyCustomFields)
     .ItemHeadingFactory(f => f.Type)
     .Print();
 }
Пример #2
0
        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);
        }
Пример #3
0
        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();
            }
        }
Пример #4
0
 // 1. Pass type but no field information
 private static void ObjectPrinting1()
 {
     ConzapTools.ClearScreen();
     ConzapTools.PrintObjects(fruit).Print();
 }