Esempio n. 1
0
        public Models.SyncState SyncUp(Models.SyncUpTarget target, Models.SyncOptions options, string soupName, string callback)
        {
            var syncUp      = JsonConvert.SerializeObject(target);
            var action      = JsonConvert.DeserializeObject <Action <SyncState> >(callback);
            var syncOptions = JsonConvert.SerializeObject(options);
            var state       = _syncManager.SyncUp(JsonConvert.DeserializeObject <SyncUpTarget>(syncUp), SyncOptions.FromJson(JObject.Parse(syncOptions)), soupName, action);
            var syncState   = JsonConvert.SerializeObject(state);

            return(JsonConvert.DeserializeObject <Models.SyncState>(syncState));
        }
Esempio n. 2
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));
        }
        public static SyncState CreateSyncUp(SmartStore.SmartStore store, SyncUpTarget target, SyncOptions options,
                                             string soupName)
        {
            var nativeStore   = JsonConvert.SerializeObject(store);
            var syncUpTarget  = JsonConvert.SerializeObject(target);
            var nativeOptions = JsonConvert.SerializeObject(options);
            var state         =
                SDK.SmartSync.Model.SyncState.CreateSyncUp(
                    JsonConvert.DeserializeObject <SDK.SmartStore.Store.SmartStore>(nativeStore),
                    JsonConvert.DeserializeObject <SDK.SmartSync.Model.SyncUpTarget>(syncUpTarget),
                    JsonConvert.DeserializeObject <SDK.SmartSync.Model.SyncOptions>(nativeOptions), soupName);
            var syncState = JsonConvert.SerializeObject(state);

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