Example #1
0
 static void Main(string[] args)
 {
     for (int i = 0; i < 20; ++i)
     {
         Cirlce circle = (Cirlce)ShapeFactory.GetCirlce(getRandomColor());
         circle.x      = i * i;
         circle.y      = i + i;
         circle.radius = 10;
         circle.Draw();
     }
 }
Example #2
0
        public static IShape GetCirlce(string color)
        {
            IShape shape   = null;
            bool   isExist = dictionary.TryGetValue(color, out shape);

            if (!isExist)
            {
                Cirlce circle = new Cirlce(color);
                dictionary.Add(color, (IShape)circle);
                Console.WriteLine("Create cirle with color: " + color);
            }

            return((Cirlce)shape);
        }