public async Task Initialize() { if (isInitialized) { return; } var handler = new AuthenticationRefreshHandler(); MobileService = new MobileServiceClient("https://yammerlyappfixed.azurewebsites.net", null) { SerializerSettings = new MobileServiceJsonSerializerSettings { CamelCasePropertyNames = true } }; handler.Client = MobileService; MobileService.CurrentUser = new MobileServiceUser(Settings.UserId); MobileService.CurrentUser.MobileServiceAuthenticationToken = Settings.AuthToken; var store = new MobileServiceSQLiteStore("app.db"); store.DefineTable <Employee>(); store.DefineTable <TimelineItem>(); await MobileService.SyncContext.InitializeAsync(store, new SyncHandler(MobileService)); isInitialized = true; }
public async Task Initialize() { if (isInitialized) { return; } // MobileServiceClient handles communication with our backend, auth, and more for us. var handler = new AuthenticationRefreshHandler(); MobileService = new MobileServiceClient("https://azuretrainingrunthrough.azurewebsites.net", null) { // Saves us from having to name things camel-case, or use custom JsonProperty attributes. SerializerSettings = new MobileServiceJsonSerializerSettings { CamelCasePropertyNames = true } }; handler.Client = MobileService; MobileService.CurrentUser = new MobileServiceUser(Settings.UserId); MobileService.CurrentUser.MobileServiceAuthenticationToken = Settings.AuthToken; // Configure online/offline sync. var store = new MobileServiceSQLiteStore("app.db"); store.DefineTable <Employee>(); store.DefineTable <TimelineItem>(); await MobileService.SyncContext.InitializeAsync(store); isInitialized = true; }
public async Task Initialize() { if (isInitialized) { return; } var authenticationHandler = new AuthenticationRefreshHandler(); MobileService = new MobileServiceClient("https://yammerlyproduction.azurewebsites.net", authenticationHandler) { // Saves us from having to name things camel-case, or use custom JsonProperty attributes. SerializerSettings = new MobileServiceJsonSerializerSettings { CamelCasePropertyNames = true } }; authenticationHandler.Client = MobileService; MobileService.CurrentUser = new MobileServiceUser(Settings.UserId); MobileService.CurrentUser.MobileServiceAuthenticationToken = Settings.AuthToken; var store = new MobileServiceSQLiteStore("app.db"); store.DefineTable <Employee>(); store.DefineTable <TimelineItem>(); await MobileService.SyncContext.InitializeAsync(store); isInitialized = true; }