加载页面后逐页加载图像 [英] Load Image on page after page is loaded

查看:85
本文介绍了加载页面后逐页加载图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在创建一个包含很多页面的应用程序.每页上都有一张图像.将图像加载到事件受保护的覆盖无效void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)"中.

I'm creating an app with a lot of pages. On every page there's one image. The image is loaded in the event "protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)" .

当我在两页之间导航时,由于图像正在加载,屏幕会变黑一秒钟.

When I navigate between two pages the screen turns black for a second because the image is loading.

我想知道应该使用线程还是异步事件?

I'm wondering if I should use a thread or an async event?

这是我加载图像的方式.

This is the the way I load the image.

 protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
                IsolatedStorageFileStream stream = new IsolatedStorageFileStream("AppData\\" + url, FileMode.Open, file);
                image.Source =  _image.SetSource(stream); 
                stream.Close();                                                 
}

有没有一种方法可以首先快速加载没有图像的页面.准备好图像后,应该可以平滑地看到它.

Is there a way to first load the page fast without the image. When the image is ready it should be smoothly be visible.

谢谢大家.



推荐答案

不确定您的应用程序如何工作,但是在导航到页面之前是否可以预加载下一张图像?如果不从硬盘驱动器加载,它将更快.  当然,请确保图像尺寸较小.  
Not sure how you application works but is there a way to pre-load the next image before you navigate to the page? It will be quicker if it is not loading from the hard drive.   Of course make sure the image size is small.  


这篇关于加载页面后逐页加载图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆