C#异步Web服务

时间:2013-03-04 12:16:50

标签: c# web-services asynchronous

有人能举例说明如何使用该方法开始向用户显示提示加载... 使用下面的代码我使用Completed事件放置查询,使用方法作为Begin?

service.EventosDoDiaCompleted += RecebeEventos;
service.EventosDoDiaAsync();

private void RecebeEventos(object sender, AsyncCompletedEventArgs e)
{
   Dataset ds = service.EventosDoDia();
}

1 个答案:

答案 0 :(得分:2)

只需放置简单的Textblock或类似的东西:

    service.EventosDoDiaCompleted += RecebeEventos;
    textblock.Text="Loading....";
    service.EventosDoDiaAsync();
    private void RecebeEventos(object sender, AsyncCompletedEventArgs e)
    {
        textblock.Text="Loaded";
        Dataset ds = service.EventosDoDia();
    }