private long TrySyncDown(SyncState.MergeModeOptions mergeMode) { // Ids clause String idsClause = "('" + String.Join("', '", _idToNames.Keys) + "')"; // Create sync SyncDownTarget target = new SoqlSyncDownTarget("SELECT Id, Name, " + Constants.LastModifiedDate + " FROM Account WHERE Id IN " + idsClause); SyncOptions options = SyncOptions.OptionsForSyncDown(mergeMode); SyncState sync = SyncState.CreateSyncDown(_smartStore, target, AccountsSoup, options); long syncId = sync.Id; CheckStatus(sync, SyncState.SyncTypes.SyncDown, syncId, SyncState.SyncStatusTypes.New, 0, -1); // Run sync _syncCheck = 0; _syncManager.RunSync(sync, HandleSyncDownCheck); DateTime end = DateTime.Now.AddSeconds(60); while (_syncCheck < 3) { if (DateTime.Now > end) { Assert.Fail("Sync timed out"); } } return(syncId); }
/// <summary> /// Create and run a sync down. /// </summary> /// <param name="target"></param> /// <param name="soupName"></param> /// <param name="callback"></param> /// <param name="options"></param> /// <returns></returns> public SyncState SyncDown(SyncDownTarget target, string soupName, Action <SyncState> callback, SyncOptions options = null) { SyncState sync = SyncState.CreateSyncDown(_smartStore, target, soupName, options); RunSync(sync, callback); return(sync); }
/// <summary> /// Create and run a sync down. /// </summary> /// <param name="target"></param> /// <param name="soupName"></param> /// <param name="callback"></param> /// <param name="options"></param> /// <returns></returns> public async Task <SyncState> SyncDown(SyncDownTarget target, string soupName, Action <SyncState> callback, SyncOptions options = null, CancellationToken token = default(CancellationToken)) { SyncState sync = SyncState.CreateSyncDown(_smartStore, target, soupName, options); await RunSync(sync, callback, token); return(sync); }