async public Task <bool> Open(IServiceRequestContext context) { if (_class == null) { _class = new GeoServicesClass(this); } _class.Themes.Clear(); _themes = new List <IWebServiceTheme>(); string serviceUrl = ServiceUrl(); string user = ConfigTextStream.ExtractValue(ConnectionString, "user"); string pwd = ConfigTextStream.ExtractValue(ConnectionString, "pwd"); var jsonMapService = await TryPostAsync <JsonMapService>($"{serviceUrl}?f=json"); var jsonLayers = await TryPostAsync <JsonLayers>($"{serviceUrl}/layers?f=json"); if (jsonMapService != null) { _class.Name = jsonMapService.MapName; if (jsonMapService.FullExtent != null) { _class.Envelope = new Envelope( jsonMapService.FullExtent.XMin, jsonMapService.FullExtent.YMin, jsonMapService.FullExtent.XMax, jsonMapService.FullExtent.YMax); } if (jsonMapService.SpatialReferenceInstance != null && jsonMapService.SpatialReferenceInstance.Wkid > 0) { var sRef = gView.Framework.Geometry.SpatialReference.FromID("epsg:" + jsonMapService.SpatialReferenceInstance.Wkid); this.SetSpatialReference(sRef); _class.SpatialReference = sRef; } if (jsonLayers?.Layers != null) { foreach (var jsonLayer in jsonLayers.Layers) { IClass themeClass = null; IWebServiceTheme theme = null; if (jsonLayer.Type.ToLower() == "feature layer") { themeClass = await GeoServicesFeatureClass.CreateAsync(this, jsonLayer); theme = LayerFactory.Create(themeClass, _class as IWebServiceClass) as IWebServiceTheme; if (theme == null) { continue; } } // ToDo Raster classes if (themeClass == null) { continue; } theme.Visible = true; //false; _class.Themes.Add(theme); } } } return(true); }