/// <summary> /// Draw the features on map using a temporary GraphicsLayer /// </summary> private void AddFeaturesToMap() { if (FieldHeadersInfo == null || Features == null || Features.Count == 0) return; //note: we will use the first map widget in the view //developers can update the logic to pick another map widget to display the layer MapWidget mapWidget = OperationsDashboard.Instance.Widgets.FirstOrDefault(w => w.GetType() == typeof(MapWidget)) as MapWidget; if (mapWidget == null || mapWidget.Map == null || !mapWidget.Map.IsInitialized) return; //Get the lat field, long field and display field to help us create the graphics FieldInfo latField = FieldHeadersInfo.SelectedLatField; FieldInfo longField = FieldHeadersInfo.SelectedLongField; FieldInfo displayField = FieldHeadersInfo.SelectedDisplayField; //Create a Graphics object which will contain the graphics representing the records Graphics graphics = new Graphics(); graphics.ConvertFeaturesToGraphics(Features, latField, longField, displayField); //Create a GraphicsLayer which point the GraphicsSource to the graphics object graphicsLayers = new client.GraphicsLayer(); graphicsLayers.ID = "tempGraphicsLyr" + System.Guid.NewGuid(); graphicsLayers.GraphicsSource = graphics; graphicsLayers.Visible = true; //Add the GraphicsLayer to the map mapWidget.Map.Layers.Add(graphicsLayers); }