Prefetch content for Windows Store apps
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
To make your Windows Store app more responsive, you can request Windows to preload some web content, such as web pages or images, into the app's WinINetWinINetcache. This functionality is called prefetching. It’s especially effective for content that's used at startup but you can prefetch other frequently used content, too. The methods of the Windows.Networking.BackgroundTransfer.ContentPrefetcher class let you specify the URIs of the content that you want to preload. See the Windows SDK Content prefetch sample for examples of how to add ContentPrefetcher functionality to your app.
Windows uses heuristics to determine when and if prefetching should occur and which resources will be downloaded. The heuristics take into account system network and power conditions, user app usage history, and the results of prior prefetch attempts. In Visual Studio, you can use the Trigger Windows Store App Prefetch command to force Windows to ignore the ContentPrefetcher heuristics and preload all of the specified web content. This can be useful if you want test the app's behavior or performance with the content to prefetch in a known state (either loaded or not loaded).
This procedure assumes that you have already set up the ContentPrefetcher functionality and specified the content URIs to preload in your app project. To force a preloading of content when the specified resources are new or modified, you have to start and stop the app before you choose the Trigger Windows Store App Prefetch command. You run the app first to register the URIs. Trigger Windows Store App Prefetch command then forces the ContentPrefetcher to download the content and add it the cache. In subsequent runs of the app, you can assume that the content is preloaded.
Start the app to register the prefetch content URIs with the app. On the Debug menu, choose Start Debugging (Keyboard shortcut: F5).
On the Debug menu, choose Stop Debugging (Keyboard shortcut: Shift + F5).
On the Debug menu, choose Other Debug Targets and then choose Trigger Windows Store App Prefetch.
You can now debug, test, or analyze your app with the prefetched web resources.
Repeat these steps whenever you add or modify the specified web content.