Web services 如何在WindowsPhone7中从多个web服务获取数据?
我不熟悉WindowsPhone7 我有3个web服务。我从3个web服务中获取数据并存储到本地数据库中 iam在应用程序中放置一个进度条,显示从这3个web服务获取数据的进度 我不知道如何用从服务获取的数据更新progressbar 请帮帮我Web services 如何在WindowsPhone7中从多个web服务获取数据?,web-services,windows-phone-7,callback,Web Services,Windows Phone 7,Callback,我不熟悉WindowsPhone7 我有3个web服务。我从3个web服务中获取数据并存储到本地数据库中 iam在应用程序中放置一个进度条,显示从这3个web服务获取数据的进度 我不知道如何用从服务获取的数据更新progressbar 请帮帮我 谢谢如何加载此数据 您是使用WebClient还是包含WebReference 编辑: 为所有3个WebClient注册事件,并执行类似操作: // proptery to bind to the progress bar public int Prog
谢谢如何加载此数据 您是使用WebClient还是包含WebReference 编辑: 为所有3个WebClient注册事件,并执行类似操作:
// proptery to bind to the progress bar
public int ProgressBarPercentage
{
get {
return (_request1Percentage + _request2Percentage + request3Percentage)/3
}
}
private int _request1Percentage;
private int _request2Percentage;
private int _request3Percentage;
在事件处理程序中,您只需设置此处理程序的字段,如果您使用的是VM,则为ProgressBarPercentage激发NotifyPropertyChanged。我已经获取了一个全局静态变量
public static int progress = 0;
我有三种web方法
所以我有三个下载字符串
在我编写的每个下载字符串complted evnt函数中
progress++;
在constructor中,我用一个计时器每秒钟检查一次进度状态
DispatcherTimer timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += delegate(object s, EventArgs args) { if (progress == 3) { NavigationService.Navigate(new Uri("/Home.xaml", UriKind.Relative)); timer.Stop(); } };
timer.Start();
所以下载完所有内容后,我转到下一页
谢谢网络客户端有一个名为DownloadProgressChanged的活动。这应该会有所帮助;嗯,我有三个web服务,不要挣扎,我找到了一个解决方案,我也实现了,它对我来说很好,我会在几分钟后发布它,谢谢,所以你只是想显示一个加载栏而不显示百分比?对不起,我似乎误解了你的问题=/