步骤就这么简单,所以我想这里还有其他事情发生,问题是我刚刚返回 4004,任何地方都没有异常等等,这使得调试很烦人,我从 ie 错误窗口得到这个
Microsoft JScript 运行时错误:Silverlight 应用程序代码中的未处理错误:4004
类别:ManagedRuntimeError
消息:System.Windows.Ria.DomainOperationException:提交操作失败。更新条目时出错。有关详细信息,请参阅内部异常。在 System.Windows.Ria.OperationBase.Complete(Exception error) 在 System.Windows.Ria.DomainContext.CompleteSubmitChanges(IAsyncResult asyncResult) 在 System.Windows.Ria.DomainContext 在 System.Windows.Ria.SubmitOperation.Complete(Exception error) .<>c__DisplayClassd.b__5(对象)
public void TurnPage(bool forward)
{
TurnPageForward = forward;
// If the pages are already turning then don't try and skip days, just run the animation function so it inreases the speed
if (!workBook.IsTransitioning && !IsWaitingForData)
{
IsWaitingForData = true;
workBook.SnapshotPages();
NoteCtx.SubmitChanges().Completed += (s, a) =>
{
workBook.ClearPageContents();
CurrentDate = CurrentDate.AddDays(forward ? 1 : -1);
PullNotes(CurrentDate);
};
}
else
{
workBook.BeginTurnPages(TurnPageForward);
}
}
public void PullNotes(DateTime? noteTime)
{
NoteCtx.NoteItems.Clear();
var loadOp = NoteCtx.Load(NoteCtx.GetNoteItemsForDayQuery(CurrentDate));
loadOp.Completed += new EventHandler(NotesReady);
}