示例#1
0
        //=======================================================================
        // If extra continents need to be added please add another if(statement)
        //=======================================================================
        public void update(string selectedContinent)
        {
            listBox.Items.Clear();

            // Set the animalFactory to default null
            animalFactory = null;

            // Different factory for each continent
            if (selectedContinent.Contains(NORTH_AMERICA))
                animalFactory = new FactroyHierarchy.NorthAmericanAnimalFactory();
            if (selectedContinent.Contains(AUSTRALIA))
                animalFactory = new FactroyHierarchy.AustralianAnimalFactory();
            if (selectedContinent.Contains(AFRICA))
                animalFactory = new FactroyHierarchy.AfricanAnimalFactory();
        }
示例#2
0
        //=======================================================================
        // If extra continents need to be added please add another if(statement)
        //=======================================================================
        public void update(string selectedContinent)
        {
            listBox.Items.Clear();

            // Set the animalFactory to default null
            animalFactory = null;

            // Different factory for each continent
            if (selectedContinent.Contains(NORTH_AMERICA))
            {
                animalFactory = new FactroyHierarchy.NorthAmericanAnimalFactory();
            }
            if (selectedContinent.Contains(AUSTRALIA))
            {
                animalFactory = new FactroyHierarchy.AustralianAnimalFactory();
            }
            if (selectedContinent.Contains(AFRICA))
            {
                animalFactory = new FactroyHierarchy.AfricanAnimalFactory();
            }
        }