private static string GetBottomTextFromMapServiceInfo(MapServiceInfo mapServiceInfo)
        {
            if (string.IsNullOrEmpty(mapServiceInfo.ServiceDescription))
            {
                return mapServiceInfo.Service.RESTServiceUrl.ToString();
            }

            return mapServiceInfo.ServiceDescription;
        }
        private static IMetaData CreateMetaData(MapServiceInfo mapServiceInfo, Guid guid)
        {
            var topText = GetTopTextFromMapServiceInfo(mapServiceInfo);
            var bottomText = GetBottomTextFromMapServiceInfo(mapServiceInfo);
            var tooltipText = GetTooltipTextFromMapServiceInfo(mapServiceInfo);
            var serviveName = GetServiceNameFromMapServiceInfo(mapServiceInfo);

            return CreateMetaData(guid, mapServiceInfo.Service.SOAPServiceUrl, serviveName, topText, bottomText, tooltipText);
        }
Example #3
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        public MapServiceInfoWrap(MapServiceInfo settings,
                                  UserMapServiceInfo userSettings)
        {
            Debug.Assert(settings != null);
            Debug.Assert(userSettings != null);

            _settings     = settings;
            _userSettings = userSettings;
        }
 private static string GetTooltipTextFromMapServiceInfo(MapServiceInfo mapServiceInfo)
 {
     try
     {
         var stringBuilder = new StringBuilder();
         stringBuilder.Append(string.Format("Service Name: {0}{1}", mapServiceInfo.Service.Name, Environment.NewLine));
         stringBuilder.Append(string.Format("Server: {0}{1}", mapServiceInfo.Service.RESTServerUrl.Host, Environment.NewLine));
         stringBuilder.Append(string.Format("Service Type: {0}{1}", mapServiceInfo.Service.Type, Environment.NewLine));
         if (null != mapServiceInfo.DocumentInfo)
         {
             stringBuilder.Append(string.Format("Author: {0}{1}", mapServiceInfo.DocumentInfo.Author, Environment.NewLine));
             stringBuilder.Append(string.Format("Category: {0}", mapServiceInfo.DocumentInfo.Category));
         }
         return stringBuilder.ToString();
     }
     catch
     {
         return "Keine gültigen Serviceinformationen gefunden.";
     }
 }
 private static string GetServiceNameFromMapServiceInfo(MapServiceInfo mapServiceInfo)
 {
     return mapServiceInfo.Service.Name;
 }
        private static string GetTopTextFromMapServiceInfo(MapServiceInfo mapServiceInfo)
        {
            if (null == mapServiceInfo.Service || string.IsNullOrEmpty(mapServiceInfo.Service.Name))
            {
                return "Karten-Service";
            }

            return mapServiceInfo.Service.Name;
        }
        private void processPre10LayerInfoResult(ArcGISWebClient.DownloadStringCompletedEventArgs e)
        {
            #region Parse layer ids from json
            if (e.Cancelled)
            {
                return;
            }
            if (e.Error != null)
            {
                onLayerInfosCompleted(new LayerInfosEventArgs()
                {
                    LayerInfos = null, UserState = e
                });
                return;
            }
            string json = null;
            try
            {
                json = e.Result;
            }
            catch (Exception exception)
            {
                if (exception != null)
                {
                    onLayerInfosCompleted(new LayerInfosEventArgs()
                    {
                        LayerInfos = null, UserState = e
                    });
                    return;
                }
            }
            Exception ex = ESRI.ArcGIS.Mapping.DataSources.Utils.CheckJsonForException(json);
            if (ex != null)
            {
                onLayerInfosCompleted(new LayerInfosEventArgs()
                {
                    LayerInfos = null, UserState = e
                });
                return;
            }

            MapServiceInfo mapServiceInfo = JsonSerializer.Deserialize <MapServiceInfo>(json);
            if (mapServiceInfo == null || mapServiceInfo.Layers == null)
            {
                onLayerInfosCompleted(new LayerInfosEventArgs()
                {
                    LayerInfos = null, UserState = e
                });
                return;
            }
            singleRequestLayerIds = new List <int>();
            foreach (MapServiceLayerInfo layer in mapServiceInfo.Layers)
            {
                LayerInformation info = new LayerInformation()
                {
                    ID            = layer.ID,
                    Name          = layer.Name,
                    PopUpsEnabled = false
                };
                if (layer.SubLayerIds == null || layer.SubLayerIds.Length < 1)
                {
                    singleRequestLayerIds.Add(layer.ID);
                }
            }
            if (singleRequestLayerIds.Count < 1)
            {
                onLayerInfosCompleted(new LayerInfosEventArgs()
                {
                    LayerInfos = null, UserState = e
                });
            }
            else
            {
                singleRequestLayerInfos = new List <LayerInformation>();
                singleRequestWebClients = new List <ArcGISWebClient>();
                cancelSingleRequests    = false;
                pendingRequests         = singleRequestLayerIds.Count;
                foreach (int id in singleRequestLayerIds)
                {
                    getLayerInfo(id, e.UserState);
                }
            }
            #endregion
        }