/// <summary> /// Adds a user to online database /// </summary> /// <param name="u">User to add to database</param> private async void AddItem(User u) { try { await App.MobileService.GetTable<User>().InsertAsync(u); } catch (MobileServiceInvalidOperationException e) { Debug.WriteLine(e.Message); } }
private void Button_Click(object sender, RoutedEventArgs e) { //create new test user User user = new User("nateyb93"); //add user to database on parallel thread IAsyncAction asyncAction = Windows.System.Threading.ThreadPool.RunAsync( (workItem) => { AddItem(user); } ); }