Example #1
0
        public async Task CheckItem(ToDoItem item)
        {
            if (client == null)
            {
                return;
            }

            // Set the item as completed and update it in the table
            item.Complete = true;
            try
            {
                // Update the new item in the local store.
                await todoTable.UpdateAsync(item);

#if OFFLINE_SYNC_ENABLED
                // Send changes to the mobile app backend.
                await SyncAsync();
#endif

                if (item.Complete)
                {
                    adapter.Remove(item);
                }
            }
            catch (Exception e)
            {
                CreateAndShowDialog(e, "Error");
            }
        }
        public async Task CheckItem(ToDoItem item)
        {
            if (client == null)
            {
                return;
            }

            // Set the item as completed and update it in the table
            item.Complete = true;
            try {
                await toDoTable.UpdateAsync(item); // update the new item in the local database
                await SyncAsync();                 // send changes to the mobile service

                if (item.Complete)
                {
                    adapter.Remove(item);
                }
            } catch (Exception e) {
                CreateAndShowDialog(e, "Error");
            }
        }