public static IAsyncOperation <bool> HasSmartStore(Account account)
        {
            var accountJson = JsonConvert.SerializeObject(account);
            var sdkAccount  = JsonConvert.DeserializeObject <SDK.Auth.Account>(accountJson);

            return(SDK.SmartStore.Store.SmartStore.HasSmartStore(sdkAccount).AsAsyncOperation());
        }
 public static IAsyncOperation<Account> RefreshAuthToken(Account account)
 {
     return Task.Run(async () =>
     {
         var response =
             await SDK.Auth.OAuth2.RefreshAuthTokenAsync(account.ConvertToSDKAccount());
         return Account.FromJson(SDK.Auth.Account.ToJson(response));
     }).AsAsyncOperation<Account>();
 }
        public static SyncManager GetInstance(Account account, string communityId, SmartStore.SmartStore smartStore)
        {
            var nativeAccount = JsonConvert.SerializeObject(account);
            var nativeSmartStore = JsonConvert.SerializeObject(smartStore);
            var nativeSyncManager = SDK.SmartSync.Manager.SyncManager.GetInstance(
                JsonConvert.DeserializeObject<SDK.Auth.Account>(nativeAccount), communityId, JsonConvert.DeserializeObject<SDK.SmartStore.Store.SmartStore>(nativeSmartStore));

            var nativeJson = JsonConvert.SerializeObject(nativeSyncManager);
            return JsonConvert.DeserializeObject<SyncManager>(nativeJson);
        }
 public static IAsyncOperation<bool> HasSmartStore(Account account)
 {
     var accountJson = JsonConvert.SerializeObject(account);
     var sdkAccount = JsonConvert.DeserializeObject<SDK.Auth.Account>(accountJson);
     return SDK.SmartStore.Store.SmartStore.HasSmartStore(sdkAccount).AsAsyncOperation();
 }
 public static string GenerateDatabasePath(Account account)
 {
     DBOpenHelper open = DBOpenHelper.GetOpenHelper(HybridAccountManager.GetAccount());
     return Path.Combine(ApplicationData.Current.LocalFolder.Path, open.DatabaseFile);
 }
 public static SmartStore GetSmartStore(Account account)
 {
     return new SmartStore(account);
 }
 public SmartStore(Account account)
 {
     _account = JsonConvert.DeserializeObject<SDK.Auth.Account>(Account.ToJson(account));
     _cursors = new Dictionary<int, StoreCursor>();
 }
        public static string GenerateDatabasePath(Account account)
        {
            DBOpenHelper open = DBOpenHelper.GetOpenHelper(HybridAccountManager.GetAccount());

            return(Path.Combine(ApplicationData.Current.LocalFolder.Path, open.DatabaseFile));
        }
 public static SmartStore GetSmartStore(Account account)
 {
     return(new SmartStore(account));
 }
 public SmartStore(Account account)
 {
     _account = JsonConvert.DeserializeObject <SDK.Auth.Account>(Account.ToJson(account));
     _cursors = new Dictionary <int, StoreCursor>();
 }
 public static DBOpenHelper GetOpenHelper(string dbNamePrefix, Account account, string communityId)
 {
     var nativeAccountJson = JsonConvert.SerializeObject(account);
     var nativeDbOpenHelper = JsonConvert.SerializeObject(SDK.SmartStore.Store.DBOpenHelper.GetOpenHelper(dbNamePrefix, JsonConvert.DeserializeObject<SDK.Auth.Account>(nativeAccountJson), communityId));
     return JsonConvert.DeserializeObject<DBOpenHelper>(nativeDbOpenHelper);
 }
 public static DBOpenHelper GetOpenHelper(Account account)
 {
     var nativeAccountJson = JsonConvert.SerializeObject(account);
     var nativeDbOpenHelper = JsonConvert.SerializeObject(SDK.SmartStore.Store.DBOpenHelper.GetOpenHelper(JsonConvert.DeserializeObject<SDK.Auth.Account>(nativeAccountJson)));
     return JsonConvert.DeserializeObject<DBOpenHelper>(nativeDbOpenHelper);
 }
 public static SyncManager GetInstance(Account account, string communityId)
 {
     return GetInstance(account, communityId, null);
 }
 /// <summary>
 ///     Serialize Account object as a JSON string
 /// </summary>
 /// <param name="account"></param>
 /// <returns></returns>
 public static string ToJson(Account account)
 {
     return JsonConvert.SerializeObject(account);
 }