Esempio n. 1
0
        private async Task UpdateCheckedTodoItem(TodoItem item)
        {
            item.Complete = true;

            await App.MobileService.InvokeApiAsync<TodoItem, TodoItem>(string.Format("tasks/{0}", item.Id), item, new HttpMethod("PATCH"), null);	

            items.Remove(item);
            ListItems.Focus(Windows.UI.Xaml.FocusState.Unfocused);
            await RefreshTodoItems();
        }
Esempio n. 2
0
        private async Task 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 App.MobileService.InvokeApiAsync<TodoItem, string>("tasks/", todoItem, HttpMethod.Post, null);
            
            items.Add(todoItem);

            TextInput.Text = "";
            TextInput.Focus(FocusState.Programmatic);
            await RefreshTodoItems();
        }
Esempio n. 3
0
 private async void ButtonSave_Click(object sender, RoutedEventArgs e)
 {
     var todoItem = new TodoItem { Description = TextInput.Text };
     await InsertTodoItem(todoItem);
 }