Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        public Models.SyncState SyncDown(SyncEvent syncEvent, string target, string soupName, Models.SyncOptions options)
        {
            var            soqlsyncDownTarget = JObject.Parse(target);
            var            soqlsyncDown       = new SoqlSyncDownTarget(soqlsyncDownTarget);
            SyncDownTarget syncDown           = soqlsyncDown;
            var            syncOptions        = options != null?SyncOptions.FromJson(JObject.Parse(JsonConvert.SerializeObject(options))) : null;

            var state = _syncManager.SyncDown(syncDown, soupName, syncEvent.OnSyncEventRaised, syncOptions);

            return(Models.SyncState.FromJson(state.AsJson().ToString()));
        }
Ejemplo n.º 4
0
        public Models.SyncState SyncDown(string target, string soupName, string callback,
                                         Models.SyncOptions options)
        {
            var            soqlsyncDownTarget = JObject.Parse(target);
            var            soqlsyncDown       = new SoqlSyncDownTarget(soqlsyncDownTarget);
            SyncDownTarget syncDown           = soqlsyncDown;
            var            action             = JsonConvert.DeserializeObject <Action <SyncState> >(callback);
            var            syncOptions        = JsonConvert.SerializeObject(options);
            var            state     = _syncManager.SyncDown(syncDown, soupName, action, SyncOptions.FromJson(JObject.Parse(syncOptions)));
            var            syncState = JsonConvert.SerializeObject(state);

            return(JsonConvert.DeserializeObject <Models.SyncState>(syncState));
        }