//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); } } }
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.