Ria框架DomainDataSource MoveToNextPage、MoveToPage、MoveToFirstPage不移动页面

发布于 2024-11-03 10:57:41 字数 913 浏览 4 评论 0原文

我正在尝试将保存结果扩展写入 DomainDatasourceView。 我可以成功写入当前结果页的内容,但是当我尝试调用 MoveToNextPage() 时,PageIndex 保持当前状态。有关此问题的 MSDN 文档没有提供任何详细信息,除了 MoveToNextPage 返回 bool 是否成功移动到下一页之外。

以下示例代码会导致无限循环,并且当前页面永远不会更改。

private void WriteResults(DomainDataSourceView resultsview)
{
    StringBuilder csvdata = new StringBuilder();
    ... Do Work on current page ...
    if(resultsview.CanChangePage && resultsview.MoveToNextPage())
    {
        csvdata.Append(WriteResults(resultsview));
    }
}

我是否需要监听 PageChanged 事件才能继续保存结果?

我需要为每个页面调用 DomainDataSource 上的 Load 吗?

MSDN 文档关于 DomainDataSourceView 没有详细介绍这个主题。

[编辑] 经过更多尝试后,我能够确定 Move...Page 命令确实调用了 DomainDataSource Load 操作,但是它是另一个异步调用,因此应该处理需要在加载的页面上完成的任何连续工作因此。

I'm attempting to write a save results extension to the DomainDatasourceView.
I can successfully write the contents of the current page of results but when I attempt to call MoveToNextPage(), the PageIndex stays current. MSDN docs regarding this don't provide any details other than MoveToNextPage returns a bool is it successfully moves to the next page.

The following sample code results in an infinite loop, and the Current page is never changed.

private void WriteResults(DomainDataSourceView resultsview)
{
    StringBuilder csvdata = new StringBuilder();
    ... Do Work on current page ...
    if(resultsview.CanChangePage && resultsview.MoveToNextPage())
    {
        csvdata.Append(WriteResults(resultsview));
    }
}

Do I need to listen for the PageChanged Event to continue Saving Results?

Do I need to call Load on the DomainDataSource for each page?

The MSDN Docs on DomainDataSourceView doesn't go into too much details on this subject.

[Edit]
After playing around some more, I was able to determine that the Move...Page commands do call the the DomainDataSource Load operation, however its another Async call, so any consecutive work that needs to be done on the loaded pages, should be handled accordingly.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文