Exemple #1
0
        private void RunButton_Click(object sender, RoutedEventArgs e)
        {
            Clear();

            while (true)
            {
                var shapeFlyweight = _shapePool.GetAShapeFlyweight();
                if (shapeFlyweight == null)
                {
                    return;
                }

                var shape = shapeFlyweight.Transform(top: _randomizer.Next(500),
                                                     left: _randomizer.Next(500),
                                                     brush: PickBrush(),
                                                     opacity: 0.9);

                canvas.Children.Add(shape);
            }
        }