Example #1
0
        // Sets the currently selected symbol
        private void SymbolListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count != 1)
            {
                return;
            }

            _selectedSymbol = e.AddedItems[0] as SymbolViewModel;

            Dictionary <string, string> values = (Dictionary <string, string>)_selectedSymbol.Model.Values;
            string    geometryControlType      = values["GeometryType"];
            DrawShape requestedShape           = DrawShape.Point;

            switch (geometryControlType)
            {
            case "Point":
                requestedShape = DrawShape.Point;
                break;

            case "Line":
                requestedShape = DrawShape.Polyline;
                break;

            case "Polygon":
                requestedShape = DrawShape.Polygon;
                break;

            case "Circle":
                requestedShape = DrawShape.Circle;
                break;

            case "Rectangular":
                requestedShape = DrawShape.Rectangle;
                break;

            default:
                var _x = new MessageDialog("Selected symbol is not supported in this sample", "Symbol Dictionary Search Sample").ShowAsync();
                return;
            }

            // Enable adding symbols to the map
            var addSymbolAsync = AddSymbolAsync(requestedShape);
        }
        // Sets the currently selected symbol
        private void SymbolListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count != 1)
                return;

            _selectedSymbol = e.AddedItems[0] as SymbolViewModel;

            Dictionary<string, string> values = (Dictionary<string, string>)_selectedSymbol.Model.Values;
            string geometryControlType = values["GeometryType"];
            DrawShape requestedShape = DrawShape.Point;

            switch (geometryControlType)
            {
                case "Point":
                    requestedShape = DrawShape.Point;
                    break;
                case "Line":
                    requestedShape = DrawShape.Polyline;
                    break;
                case "Polygon":
                    requestedShape = DrawShape.Polygon;
                    break;
                case "Circle":
                    requestedShape = DrawShape.Circle;
                    break;
                case "Rectangular":
                    requestedShape = DrawShape.Rectangle;
                    break;
                default:
                    var _x = new MessageDialog("Selected symbol is not supported in this sample", "Symbol Dictionary Search Sample").ShowAsync();
                    return;
            }

            // Enable adding symbols to the map
            var addSymbolAsync = AddSymbolAsync(requestedShape);
        }