Exemplo n.º 1
0
        public static void CollectInput(Farm farm)
        {
            do
            {
                UpdateFacilities(farm);
                if (_facilities.Count == 0)
                {
                    Program.ShowMessage("No available facilities to process.");
                    return;
                }

                // Select a field
                ICompostProducing selectedField = SelectField(farm);

                // Select a resource type

                var groups = selectedField.CreateCompostList();

                IGrouping <string, IComposting> selectedGroup = SelectResourceType(groups);

                // Select quantity of resources to process
                int quantity = SelectQuantity(farm.Composter.Capacity, selectedGroup);

                // Add selected resources to hopper
                selectedField.SendToComposter(quantity, selectedGroup.Key, farm);
            } while (AddMore(farm.Composter.Capacity));

            farm.Composter.Process();
        }