示例#1
0
		public async void AddActivity(CaAPA.Data.Activities activity)
		{
			if (client == null)
			{
				return;
			}

			try
			{
				await activityTable.InsertAsync(activity); // insert the new item into the local database
				await SyncAsync(); // send changes to the mobile service

				if (!activity.Complete)
				{
					activityadapter.Add(activity);
				}
			}
			catch (Exception e)
			{
				CreateAndShowDialog(e, "Error");
			}

		}
示例#2
0
		public async Task CheckActivity(CaAPA.Data.Activities activity)
		{
			if (client == null)
			{
				return;
			}

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

				if (activity.Complete)
					activityadapter.Remove(activity);

			}
			catch (Exception e)
			{
				CreateAndShowDialog(e, "Error");
			}
		}