private long TrySyncUp(int numberOfChanges,
                               SyncState.MergeModeOptions mergeMode = SyncState.MergeModeOptions.Overwrite)
        {
            // Create sync
            SyncOptions options = SyncOptions.OptionsForSyncUp(new List <string>(new[] { Constants.Name }), mergeMode);
            var         target  = new SyncUpTarget();
            SyncState   sync    = SyncState.CreateSyncUp(_smartStore, target, options, AccountsSoup);
            long        syncId  = sync.Id;

            CheckStatus(sync, SyncState.SyncTypes.SyncUp, syncId, SyncState.SyncStatusTypes.New, 0, -1);

            // run sync

            _syncCheck       = 0;
            _numberOfChanges = numberOfChanges;
            DateTime end = DateTime.Now.AddSeconds(60);

            _syncManager.RunSync(sync, HandleSyncUpCheck);
            while (_syncCheck < 1)
            {
                if (DateTime.Now > end)
                {
                    Assert.Fail("Sync timed out");
                }
            }
            return(syncId);
        }
예제 #2
0
        /// <summary>
        ///     Create and run a sync up.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="options"></param>
        /// <param name="soupName"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public SyncState SyncUp(SyncUpTarget target, SyncOptions options, string soupName, Action <SyncState> callback)
        {
            SyncState sync = SyncState.CreateSyncUp(_smartStore, target, options, soupName);

            RunSync(sync, callback);
            return(sync);
        }
예제 #3
0
        /// <summary>
        ///     Create and run a sync up.
        /// </summary>
        /// <param name="target"></param>
        /// <param name="options"></param>
        /// <param name="soupName"></param>
        /// <param name="callback"></param>
        /// <returns></returns>
        public async Task <SyncState> SyncUp(SyncUpTarget target, SyncOptions options, string soupName, Action <SyncState> callback, CancellationToken token = default(CancellationToken), Action <string, string> idChangeHandler = default(Action <string, string>))
        {
            SyncState sync = SyncState.CreateSyncUp(_smartStore, target, options, soupName);

            await RunSync(sync, callback, token, idChangeHandler);

            return(sync);
        }