Esempio n. 1
0
 public void addLayer(string token, string serviceUrl)
 {
     //Uncomment the workaround line to see the workaround work.
     //Workaround(serviceUrl, token);
     var table = new Esri.ArcGISRuntime.Data.ServiceFeatureTable();
     table.Token = token;
     table.ServiceUri = serviceUrl + "0";
     table.Where = "1=1";
     Esri.ArcGISRuntime.Layers.FeatureLayer myFeatureLayer = new Esri.ArcGISRuntime.Layers.FeatureLayer();
     myFeatureLayer.FeatureTable = table;
     MyView.Map.Layers.Add(myFeatureLayer);
     myFeatureLayer.InitializeAsync();
     Esri.ArcGISRuntime.ArcGISServices.FeatureServiceLayerInfo myFeatureServiceLayerInfo = table.ServiceInfo;
 }
Esempio n. 2
0
        private void logonButton_Click(object sender, RoutedEventArgs e)
        {
            string username = Username.Text;
            string password = Password.Text;

            AGOL agol = new AGOL(username, password);
            Console.WriteLine(agol.Token);
            int i;
            i = 0;
            foreach(var service in agol.orgServices.services)
            {
                CheckBox box = new CheckBox();
                box.Name = "A"+i.ToString();
                box.Content = service.name;
                box.Checked += async(s,ev) =>
                    {
                        agol.FirstVisit(service.url);
                        //Having trouble with the token
                        var table = new Esri.ArcGISRuntime.Data.ServiceFeatureTable();
                        table.Token = agol.Token.ToString();
                        //MessageBox.Show(agol.Token);
                        table.ServiceUri = service.url+"/0";
                        table.Where = "1=1";
                        Esri.ArcGISRuntime.Layers.FeatureLayer myFeatureLayer = new Esri.ArcGISRuntime.Layers.FeatureLayer();
                        myFeatureLayer.FeatureTable = table;
                        MyView.Map.Layers.Add(myFeatureLayer);
                        await myFeatureLayer.InitializeAsync();
                        Esri.ArcGISRuntime.ArcGISServices.FeatureServiceLayerInfo myFeatureServiceLayerInfo = table.ServiceInfo;
                        //var gdbFeatureSvcTable = await Esri.ArcGISRuntime.Data.ServiceFeatureTable.OpenAsync(
                        //    new Uri(service.url));
                        //gdbFeatureSvcTable.Mode = Esri.ArcGISRuntime.Data.QueryMode.OnDemand;
                        //gdbFeatureSvcTable.Where = "1=1";
                        //gdbFeatureSvcTable.Token = agol.Token;
                        //var featureLayer = new Esri.ArcGISRuntime.Layers.FeatureLayer(gdbFeatureSvcTable);
                        //featureLayer.ID = box.Name;
                        //MyView.Map.Layers.Add(featureLayer);
                        //var dynUri = new Uri(service.url + agol.Token);
                        //var agsDynLayer = new Esri.ArcGISRuntime.Layers.ArcGISDynamicMapServiceLayer(dynUri);
                        //MyView.Map.Layers.Add(agsDynLayer);
                    };
                box.Unchecked += (s, ev) =>
                {
                    MessageBox.Show("SOMETHING");
                };
                servicesBox.Items.Add(box);
                i++;
            }
        }