Ejemplo n.º 1
0
        // Sets the currently selected symbol
        private async 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["GeometryConversionType"];
            DrawShape requestedShape           = DrawShape.Point;

            // Note that not all Geometry types are handled here
            switch (geometryControlType)
            {
            case "Point":
                requestedShape = DrawShape.Point;
                break;

            case "Polyline":
            case "PolylineWithTail":
            case "TripleArrow":
            case "ArrowWithOffset":
            case "ParallelLinesMidline":
            case "UOrTShape":
            case "T":
                requestedShape = DrawShape.Polyline;
                break;

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

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

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

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

            // Enable adding symbols to the map
            await AddSymbolAsync(requestedShape);
        }
		// Sets the currently selected symbol
		private async 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["GeometryConversionType"];
			DrawShape requestedShape = DrawShape.Point;

			// Note that not all Geometry types are handled here
			switch (geometryControlType)
			{
				case "Point":
					requestedShape = DrawShape.Point;
					break;
				case "Polyline":
				case "PolylineWithTail":
				case "TripleArrow":
				case "ArrowWithOffset":
				case "ParallelLinesMidline":
				case "UOrTShape":
				case "T":
					requestedShape = DrawShape.Polyline;
					break;
				case "Polygon":
					requestedShape = DrawShape.Polygon;
					break;
				case "Circle":
					requestedShape = DrawShape.Circle;
					break;
				case "Rectangular":
					requestedShape = DrawShape.Rectangle;
					break;
				default:
					await new MessageDialog("Selected symbol is not supported in this sample", "Symbol Dictionary Search Sample").ShowAsync();
					return;
			}

			// Enable adding symbols to the map
			await AddSymbolAsync(requestedShape);
		}