private void UseSymbol(string symbolJson)
{
try
{
Symbol symbol = Symbol.FromJson(symbolJson);
GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
foreach (Graphic g in graphicsLayer.Graphics)
{
if ((g.Geometry is Polygon || g.Geometry is Envelope) && symbol is FillSymbol)
g.Symbol = symbol;
else if (g.Geometry is Polyline && symbol is LineSymbol)
g.Symbol = symbol;
else if (g.Geometry is MapPoint && symbol is MarkerSymbol)
g.Symbol = symbol;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Deserializing JSON failed", MessageBoxButton.OK);
}
}