コード例 #1
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);
 }
コード例 #2
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);
 }
コード例 #3
0
        public async void OnAdd(object sender, EventArgs e)
        {
            var todo = new TodoItem { Name = newItemName.Text };
            await AddItem(todo);

            newItemName.Text = string.Empty;
            newItemName.Unfocus();
        }
コード例 #4
0
 private async Task 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);
     ListItems.Focus(Windows.UI.Xaml.FocusState.Unfocused);
 }
コード例 #5
0
        private async Task InsertTodoItem(TodoItem todoItem)
        {
            // This code inserts a new TodoItem into the database. After the operation completes
            // and the mobile app backend has assigned an id, the item is added to the CollectionView.
            await todoTable.InsertAsync(todoItem);
            items.Add(todoItem);

            //await App.MobileService.SyncContext.PushAsync(); // offline sync
        }
コード例 #6
0
        private async Task InsertTodoItem(TodoItem todoItem)
        {
            // This code inserts a new TodoItem into the database. When the operation completes
            // and Mobile App backend has assigned an Id, the item is added to the CollectionView.
            await todoTable.InsertAsync(todoItem);
            items.Add(todoItem);

            //await SyncAsync(); // offline sync
        }
コード例 #7
0
        private async Task UpdateCheckedTodoItem(TodoItem item)
        {
            // This code takes a freshly completed TodoItem and updates the database. 
			// After the MobileService client responds, the item is removed from the list.
            await todoTable.UpdateAsync(item);
            items.Remove(item);
            ListItems.Focus(Windows.UI.Xaml.FocusState.Unfocused);

            //await App.MobileService.SyncContext.PushAsync(); // offline sync
        }
コード例 #8
0
		public async Task SaveTaskAsync(TodoItem item)
		{
			if (item.ID == null)
			{
				await todoTable.InsertAsync(item);
				//TodoViewModel.TodoItems.Add(item);
			}
			else
				await todoTable.UpdateAsync(item);
		}
コード例 #9
0
		public async Task DeleteTaskAsync(TodoItem item)
		{
			try
			{
				//TodoViewModel.TodoItems.Remove(item);
				await todoTable.DeleteAsync(item);
			}
			catch (MobileServiceInvalidOperationException msioe)
			{
				Debug.WriteLine(@"INVALID {0}", msioe.Message);
			}
			catch (Exception e)
			{
				Debug.WriteLine(@"ERROR {0}", e.Message);
			}
		}
コード例 #10
0
 private void ButtonSave_Click(object sender, RoutedEventArgs e)
 {
     var todoItem = new TodoItem { Text = TodoInput.Text };
     InsertTodoItem(todoItem);
 }
コード例 #11
0
 async Task CompleteItem(TodoItem item)
 {
     item.Done = true;
     await manager.SaveTaskAsync(item);
     todoList.ItemsSource = await manager.GetTodoItemsAsync();
 }
コード例 #12
0
 // Data methods
 async Task AddItem(TodoItem item)
 {
     await manager.SaveTaskAsync(item);
     todoList.ItemsSource = await manager.GetTodoItemsAsync();
 }
コード例 #13
0
 private async void ButtonSave_Click(object sender, RoutedEventArgs e)
 {
     var todoItem = new TodoItem { Text = TextInput.Text };
     TextInput.Text = "";
     await InsertTodoItem(todoItem);
 }
コード例 #14
0
        // Data methods
        async Task AddItem(TodoItem item)
        {
            await manager.SaveTaskAsync(item);

            todoList.ItemsSource = await manager.GetTodoItemsAsync();
        }
コード例 #15
0
		async Task DeleteItem (TodoItem item) {
			await manager.DeleteTaskAsync(item);
			todoList.ItemsSource = await manager.GetTodoItemsAsync ();
		}