Пример #1
0
        private void AddComponent(Flat c)
        {
            var component = Flat.GetComponentLieIn(c);
            var room      = component as Flat;

            if (room != null)
            {
                component.Add(new Room(new Rectangle()
                {
                    Location = c.Rectangle.Location,
                    Height   = c.Rectangle.Height,
                    Width    = c.Rectangle.Width
                }));
            }
            else if (component is Room)
            {
                component.Add(new Furniture(new Rectangle()
                {
                    Location = c.Rectangle.Location,
                    Height   = c.Rectangle.Height,
                    Width    = c.Rectangle.Width
                }));
            }
            else
            {
                errorLds.Text = "You can't add this shape";
            }
            Draw();
            PrintTree();
        }