private async void Initialize()
        {
            // Show dark gray canvas basemap.
            _myMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the WMS Service.
            WmsService service = new WmsService(_wmsUrl);

            // Load the WMS Service.
            await service.LoadAsync();

            // Get the service info (metadata) from the service.
            WmsServiceInfo info = service.ServiceInfo;

            List <LayerDisplayVM> viewModelList = new List <LayerDisplayVM>();

            // Get the list of layer infos.
            foreach (var layerInfo in info.LayerInfos)
            {
                LayerDisplayVM.BuildLayerInfoList(new LayerDisplayVM(layerInfo, null), viewModelList);
            }

            // Construct the layer list source.
            _layerListSource = new LayerListSource(viewModelList, this);

            // Set the source for the table view (layer list).
            _myDisplayList.Source = _layerListSource;

            // Force an update of the list display.
            _myDisplayList.ReloadData();
        }
예제 #2
0
        private async void Initialize()
        {
            // Show dark gray canvas basemap.
            _myMapView.Map = new Map(Basemap.CreateDarkGrayCanvasVector());

            // Create the WMS Service.
            WmsService service = new WmsService(_wmsUrl);

            // Load the WMS Service.
            await service.LoadAsync();

            // Get the service info (metadata) from the service.
            WmsServiceInfo info = service.ServiceInfo;

            // Get the list of layer infos.
            IReadOnlyList <WmsLayerInfo> topLevelLayers = info.LayerInfos;

            // Recursively build up a list of all the layers in the service and get their IDs as a flat list.
            List <WmsLayerInfo> expandedList = new List <WmsLayerInfo>();

            BuildLayerInfoList(topLevelLayers, expandedList);

            List <LayerDisplayVm> displayList = new List <LayerDisplayVm>();

            // Build the ViewModel from the expanded list of layer infos.
            foreach (WmsLayerInfo layerInfo in expandedList)
            {
                // LayerDisplayVM is a custom type made for this sample to serve as the ViewModel; it is not a part of the ArcGIS Runtime.
                displayList.Add(new LayerDisplayVm(layerInfo));
            }

            // Construct the layer list source.
            _layerListSource = new LayerListSource(displayList, this);

            // Set the source for the table view (layer list).
            _myDisplayList.Source = _layerListSource;

            // Force an update of the list display.
            _myDisplayList.ReloadData();
        }
        private async void Initialize()
        {
            // Show dark gray canvas basemap.
            _myMapView.Map = new Map(BasemapStyle.ArcGISDarkGray);

            // Create the WMS Service.
            WmsService service = new WmsService(_wmsUrl);

            try
            {
                // Load the WMS Service.
                await service.LoadAsync();

                // Get the service info (metadata) from the service.
                WmsServiceInfo info = service.ServiceInfo;

                List <LayerDisplayVM> viewModelList = new List <LayerDisplayVM>();

                // Get the list of layer infos.
                foreach (var layerInfo in info.LayerInfos)
                {
                    LayerDisplayVM.BuildLayerInfoList(new LayerDisplayVM(layerInfo, null), viewModelList);
                }

                // Construct the layer list source.
                _layerListSource = new LayerListSource(viewModelList, this);

                // Set the source for the table view (layer list).
                _layerList.Source = _layerListSource;

                // Force an update of the list display.
                _layerList.ReloadData();
            }
            catch (Exception e)
            {
                new UIAlertView("Error", e.ToString(), (IUIAlertViewDelegate)null, "OK", null).Show();
            }
        }