//FeatureService Connection using replicamanager string featServiceUrl = @"http://<myserver>/arcgis/rest/services/test3/FeatureServer"; FeatureServiceReplicaManager fsreplica = new FeatureServiceReplicaManager(); //MobileCache string cacheStoragePath = @C:\GIS\Project\Mobil\db(Cache)\cache; MobileCache mobileCache = new MobileCache(cacheStoragePath); //delete old cache if (mobileCache.CacheExists == true) mobileCache.DeleteCache(); //////////////////////////// //Create a token to access the service with valid username\password TokenCredential token = new TokenCredential("user", "pass"); //Set feature service properties fsreplica.TokenCredential = token; fsreplica.Url = featServiceUrl; fsreplica.Initialize(); fsreplica.MobileCache = mobileCache; //Get the data from the service to the local cache fsreplica.CreateReplica(); //Open the cache and add it to the maplayers mobileCache.Open(); if (!fsreplica.IsRegistered) fsreplica.RegisterReplica(); map1.MapLayers.Add(mobileCache);
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.