Exemplo n.º 1
0
        private async void LoadService(string serviceUrl)
        {
            try
            {
                _loadingProgressBar.StartAnimating();
                _loadServiceButton.Enabled  = false;
                _chooseLayersButton.Enabled = false;

                // Create the OGC API - Features service using the landing URL.
                OgcFeatureService service = new OgcFeatureService(new Uri(serviceUrl));

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

                // Get the service metadata.
                _serviceInfo = service.ServiceInfo;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                new UIAlertView("Error loading service", ex.Message, (IUIAlertViewDelegate)null, "OK", null).Show();
            }
            finally
            {
                // Update the UI.
                _loadingProgressBar.StopAnimating();
                _loadServiceButton.Enabled  = true;
                _chooseLayersButton.Enabled = true;
            }
        }
        private async void LoadService(string serviceUrl)
        {
            try
            {
                _loadingProgressBar.Visibility = ViewStates.Visible;
                _loadLayerButton.Enabled       = false;
                _loadServiceButton.Enabled     = false;

                // Create the OGC API - Features service using the landing URL.
                OgcFeatureService service = new OgcFeatureService(new Uri(serviceUrl));

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

                // Get the service metadata.
                _serviceInfo = service.ServiceInfo;
            }
            catch (Exception ex)
            {
                new AlertDialog.Builder(this).SetMessage(ex.Message).SetTitle("Error loading service").Show();
            }
            finally
            {
                // Update the UI.
                _loadingProgressBar.Visibility = ViewStates.Gone;
                _loadLayerButton.Enabled       = true;
                _loadServiceButton.Enabled     = true;
            }
        }
Exemplo n.º 3
0
        private async void LoadService()
        {
            try
            {
                LoadingProgressBar.Visibility = Visibility.Visible;
                LoadLayersButton.IsEnabled    = false;
                LoadServiceButton.IsEnabled   = false;

                // Create the OGC API - Features service using the landing URL.
                OgcFeatureService service = new OgcFeatureService(new Uri(ServiceTextBox.Text));

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

                // Get the service metadata.
                OgcFeatureServiceInfo serviceInfo = service.ServiceInfo;

                // Get a list of available collections.
                IEnumerable <OgcFeatureCollectionInfo> layerListReversed = serviceInfo.FeatureCollectionInfos;

                // Show the layers in the UI.
                OgcFeatureCollectionList.ItemsSource = layerListReversed;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                await new MessageDialog(ex.Message, "Error loading service").ShowAsync();
            }
            finally
            {
                // Update the UI.
                LoadingProgressBar.Visibility = Visibility.Collapsed;
                LoadLayersButton.IsEnabled    = true;
                LoadServiceButton.IsEnabled   = true;
            }
        }