protected override void OnDownloadConfigXMLCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            string xmlConfig = e.Result;

            widgetConfig = (LocatorConfig)LocatorConfig.Deserialize(xmlConfig, typeof(LocatorConfig));

            if (widgetConfig.EnableLocator == ServiceSource.BING)
            {
                if (string.IsNullOrEmpty(widgetConfig.BingLocator.Token))
                {
                    widgetConfig.BingLocator.Token      = CurrentApp.GetAppParamValue(MapApp.BING_TOKEN);
                    widgetConfig.BingLocator.ServerType = (ServerType)Enum.Parse(typeof(ServerType), CurrentApp.GetAppParamValue(MapApp.BING_SERVER), true);
                }
            }

            geocodeTool              = new GeocodeTool(widgetConfig, this.AppConfig.GeometryService, this.MapSRWKID);
            geocodeTool.ResultReady += new GeocodeTool.GeocodeResultReady(GeocodeUtil_ResultReady);
        }
Exemple #2
0
        /// <summary>
        /// Initialize Base Map
        /// </summary>
        private void InitializeBaseMap(MapConfig mapConfig)
        {
            if (mapConfig == null || mapConfig.BaseMap == null)
            {
                return;
            }

            BaseMapConfig baseMapConfig = mapConfig.BaseMap;

            if (baseMapConfig.EnableBase == ServiceSource.ArcGIS)
            {
                foreach (ArcGISBaseMapLayer layerConfig in baseMapConfig.ArcGISBaseMap.Layers)
                {
                    CreateArcGISMapLayer(layerConfig, 1.0);
                }

                if (baseMapConfig.ArcGISBaseMap.LabelLayer != null)
                {
                    CreateArcGISMapLayer(baseMapConfig.ArcGISBaseMap.LabelLayer, 1.0);
                }
            }
            else if (baseMapConfig.EnableBase == ServiceSource.BING)
            {
                string     token      = baseMapConfig.BingBaseMap.Token;
                ServerType serverType = baseMapConfig.BingBaseMap.ServerType;

                if (string.IsNullOrEmpty(token))
                {
                    token      = CurrentApp.GetAppParamValue(MapApp.BING_TOKEN);
                    serverType = (ServerType)Enum.Parse(typeof(ServerType), CurrentApp.GetAppParamValue(MapApp.BING_SERVER), true);
                }

                foreach (BingBaseMapLayer layerConfig in baseMapConfig.BingBaseMap.Layers)
                {
                    TileLayer bingLayer = new TileLayer()
                    {
                        ID         = layerConfig.ID,
                        ServerType = serverType,
                        Visible    = layerConfig.VisibleInitial,
                        Opacity    = 1.0,
                        Token      = token
                    };

                    switch (layerConfig.LayerType)
                    {
                    case BingLayerType.Road:
                        bingLayer.LayerStyle = ESRI.ArcGIS.Client.Bing.TileLayer.LayerType.Road; break;

                    case BingLayerType.Aerial:
                        bingLayer.LayerStyle = ESRI.ArcGIS.Client.Bing.TileLayer.LayerType.Aerial; break;

                    case BingLayerType.AerialWithLabels:
                        bingLayer.LayerStyle = ESRI.ArcGIS.Client.Bing.TileLayer.LayerType.AerialWithLabels; break;
                    }

                    bingLayer.Initialized          += new EventHandler <EventArgs>(MapLayer_Initialized);
                    bingLayer.InitializationFailed += new EventHandler <EventArgs>(MapLayer_InitializationFailed);
                    myMap.Layers.Add(bingLayer);
                }
            }
        }