Exemplo n.º 1
0
 /// <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);
     }
 }
Exemplo n.º 2
0
        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);
                }
            );
        }