WP7创建加载动画

时间:2012-05-03 05:31:47

标签: windows-phone-7

我创建了一个带有进度叠加层的自定义用户控件,以获得像动画一样的加载屏幕。通过Progress.Show()和Progress.Hide()访问。当我从外部api获取数据时如何使用这些?

1 个答案:

答案 0 :(得分:0)

当您执行SomeWebClient.DownloadDataAsync()时,它有一个progress changed event,您可以这样使用:

private static void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e)
{
    // Displays the operation identifier, and the transfer progress.
    Console.WriteLine("{0}    downloaded {1} of {2} bytes. {3} % complete...", 
        (string)e.UserState, 
        e.BytesReceived, 
        e.TotalBytesToReceive,
        e.ProgressPercentage);
}