我在 Silverlight 中显示图像时遇到了奇怪的错误。显示在 xml 文件中配置的图像列表以及通过 WebClient 类型从服务器下载的该 xml 的问题。
WebClient client = new WebClient();
client.AllowReadStreamBuffering = true;
client.OpenReadAsync(new Uri(path, UriKind.Relative), new GalleryUserState() {Gallery=gallery, PathToXml = path });
client.OpenReadCompleted += new OpenReadCompletedEventHandler(request_for_Gallery_Completed);
下载 xml 并从 xml 检索图像后,我有一个奇怪的错误:
我动态地将图像添加到堆栈面板。但图像并不总是显示!有时图像加载失败:
curImage.ImageFailed += new EventHandler<ExceptionRoutedEventArgs>(curImage_ImageFailed);
void curImage_ImageFailed(object sender, ExceptionRoutedEventArgs e)
{
}
例外:
ErrorException = {System.Exception: AG_E_NETWORK_ERROR}
当浏览器刷新其他图像加载失败(图像列表相同!)。与我在程序集(xap)中配置的图像相同的列表总是可以正常工作。
它看起来像 WebClient 或类似的问题。那可以是什么???