//property for mobile sync agent public MobileCacheSyncAgent SyncMaster { get; set; } //snippet which initializes the sync agents for download SyncMaster.SyncAgents.Clear(); SetupSyncAgents(); SyncMaster.BeginDownloadExtent(mobileCache1.GetInitialExtent(), 0, 0, DownloadExtent, Guid.NewGuid()); //procedure to setup the sync agents for downloads private void SetupSyncAgents() { foreach (Layer l in this.mobileCache1.Layers) { if (l is FeatureLayer) { var fl = (FeatureLayer)l; FeatureLayerSyncAgent agent = new FeatureLayerSyncAgent(fl); agent.MapDocumentConnection = this.mobileServiceConnection1; agent.SynchronizationDirection = SyncDirection.DownloadOnly; SyncMaster.SyncAgents.Add(agent); } if (l is RasterLayer) { var rl = (RasterLayer)l; RasterLayerSyncAgent agent = new RasterLayerSyncAgent(rl); agent.Extent = this.map1.GetExtent(); agent.MapDocumentConnection = this.mobileServiceConnection1; SyncMaster.SyncAgents.Add(agent); } } }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.