//Create a graphic lasso element with simple line and fill styles.
//Construct on the worker thread
await QueuedTask.Run(() =>
{
//Build geometry
List<Coordinate2D> plyCoords = new List<Coordinate2D>();
plyCoords.Add(new Coordinate2D(1, 1));
plyCoords.Add(new Coordinate2D(1.25, 2));
plyCoords.Add(new Coordinate2D(1.5, 1.1));
plyCoords.Add(new Coordinate2D(1.75, 2));
plyCoords.Add(new Coordinate2D(2, 1.1));
plyCoords.Add(new Coordinate2D(2.25, 2));
plyCoords.Add(new Coordinate2D(2.5, 1.1));
plyCoords.Add(new Coordinate2D(2.75, 2));
plyCoords.Add(new Coordinate2D(3, 1));
Polygon poly = PolygonBuilder.CreatePolygon(plyCoords);
//Set symbolology, create and add element to layout
CIMStroke outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid);
CIMPolygonSymbol polySym = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB, SimpleFillStyle.ForwardDiagonal, outline);
GraphicElement polyElm = LayoutElementFactory.Instance.CreatePolygonGraphicElement(layout, poly, polySym);
polyElm.SetName("New Lasso");
});