Exemplo n.º 1
0
 private async void InsertTodoItem(TodoItem todoItem)
 {
     // This code inserts a new TodoItem into the database. When the operation completes
     // and Mobile Services has assigned an Id, the item is added to the CollectionView
     await todoTable.InsertAsync(todoItem);
     //items.Add(todoItem);                        
 }
Exemplo n.º 2
0
 private async void UpdateCheckedTodoItem(TodoItem item)
 {
     // This code takes a freshly completed TodoItem and updates the database. When the MobileService 
     // responds, the item is removed from the list 
     await todoTable.UpdateAsync(item);
     items.Remove(item);
 }
Exemplo n.º 3
0
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            TodoItem todoItem = null;

            //NH: changed
            if (ApplicationView.Value.ToString() == "Snapped")                        
                todoItem = new TodoItem { Text = TextInput1.Text };
            else
                todoItem = new TodoItem { Text = TextInput.Text };

            InsertTodoItem(todoItem);
        }
Exemplo n.º 4
0
 void PrimaryChannel_PushNotificationReceived(PushNotificationChannel sender, PushNotificationReceivedEventArgs args)
 {
     if (args.NotificationType == PushNotificationType.Raw)
     {                
         var json = Windows.Data.Json.JsonObject.Parse(args.RawNotification.Content);
         var todoItem = new TodoItem()
         {
             Id = (int)json.GetNamedNumber("id"),
             Complete = json.GetNamedBoolean("complete"),
             Text = json.GetNamedString("text")
         };
         
         items.Insert(0, todoItem);
     }
 }