我有使用Windows Phone 8的经验,并且正在使用WCF数据服务。我能够成功地通过以下代码更新我的记录:
public void UpdateJob1(EquipBooking equipBooking)
{
this._context.UpdateObject(equipBooking);
this._context.BeginSaveChanges(OnChangesSaved, this._context);
}
private void OnChangesSaved(IAsyncResult result)
{
bool errorFound = false;
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
this._context = result.AsyncState as THA001_devEntities;
try
{
// Complete the save changes operation.
this._context.EndSaveChanges(result);
}
catch (DataServiceRequestException ex)
{
errorFound = true;
MessageBox.Show("Error, While Updating Record");
}
if (!errorFound)
{
MessageBox.Show("Record Successfully Updated");
}
}
);
}
但是当我在Windows Store应用程序中编写相同的代码时,我遇到了问题。 我无法更新记录,我在这里得到了问题:Deployment.Current.Dispatcher.BeginInvoke
有人可以指导我或重写我的代码吗?
谢谢