//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); } } }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.