Exemple #1
0
        public SyncState ReSync(long syncId, Action <SyncState> callback)
        {
            SyncState sync = SyncState.ById(_smartStore, syncId);

            if (sync == null)
            {
                throw new SmartStoreException("Cannot run ReSync:" + syncId + ": no sync found");
            }
            if (sync.Type != SyncState.SyncTypes.SyncDown)
            {
                throw new SmartStoreException("Cannot run ReSync:" + syncId + ": wrong type: " + sync.Type);
            }
            var target = (SyncDownTarget)sync.Target;

            if (target.QueryType != SyncDownTarget.QueryTypes.Soql)
            {
                throw new SmartStoreException("Cannot run ReSync:" + syncId + ": wrong query type: " +
                                              target.QueryType);
            }
            if (sync.Status != SyncState.SyncStatusTypes.Done)
            {
                throw new SmartStoreException("Cannot run ReSync:" + syncId + ": not done: " + sync.Status);
            }
            RunSync(sync, callback);
            return(sync);
        }
Exemple #2
0
 /// <summary>
 ///     Get details of a sync state.
 /// </summary>
 /// <param name="syncId"></param>
 /// <returns></returns>
 public SyncState GetSyncStatus(long syncId)
 {
     return(SyncState.ById(_smartStore, syncId));
 }