public void AddShapeToGroup(int shapeId, int groupId) { IShape shapeToAdd = GetShapeById(shapeId); if (shapeToAdd != null) { GroupShapes group = (GroupShapes)GetShapeById(groupId); group.AddToGroup(shapeToAdd); shapesOnCanvas.Remove(shapeToAdd); } }
public void AddAction(object sender, object contextObject) { GroupShapes group = (GroupShapes)contextObject; Console.WriteLine("Id of the group: "); group.Identifier = Int32.Parse(Console.ReadLine()); Console.WriteLine("Insert the id of shape: "); int id = Int32.Parse(Console.ReadLine()); canvas.AddShapeToGroup(id, group.Identifier); }
public void GroupAction(object sender, object contextObject) { //GroupShapes group = (GroupShapes)contextObject; GroupShapes group = new GroupShapes(); Console.WriteLine("Group name:"); group.GroupName = Console.ReadLine(); canvas.AddShape(group); Console.WriteLine("Shapes on canvas:"); canvas.DrawShapes(); Console.ReadKey(); }