Answered by:
how to develop online-offline application.

Question
-
Hi,
I am developing one RSS feed reader application.which read online XMLs / download images to local state. it supports offline mode as well. in offline mode it ll display local cache.
next time when I will start app, it will first display local data then request to webservice for new updated data.
I am using Task for this task. bt it slows down application on startup.
there are almost 13 to 15 XMLs and 140-150 images to download.
I am requesting for XMLs and images by using following code.
Uri source = new Uri ( Url );
StorageFile destinationFile;
try
{
destinationFile = await ApplicationData.Current.LocalFolder.CreateFileAsync (
FileName, CreationCollisionOption.ReplaceExisting );
}
catch ( FileNotFoundException ex )
{
return;
}
BackgroundDownloader downloader = new BackgroundDownloader ( );
DownloadOperation download = downloader.CreateDownload ( source, destinationFile );
await download.StartAsync ( );
in for loop for image download it takes long time.
can you pl suggest way to reduce start time ? how can i achieve this ?
just like bing news app or the new york times.Friday, April 26, 2013 1:58 PM
Answers
-
Have a look at the Q42 WinRT library (Google it), it's designed for exactly this type of scenario...
- Proposed as answer by Jernej Kavka Sunday, April 28, 2013 9:09 PM
- Marked as answer by Weblineindia Thursday, May 2, 2013 6:37 AM
Friday, April 26, 2013 8:39 PM -
Just see this sample Thread pool sample to run code asynchronously and see if you can use it in your scenarioThanks,SachinMy Samples | Personal Website
- Marked as answer by Matt SmallMicrosoft employee, Moderator Monday, April 29, 2013 3:08 PM
- Unmarked as answer by Weblineindia Thursday, May 2, 2013 6:36 AM
- Marked as answer by Weblineindia Thursday, May 2, 2013 6:36 AM
Saturday, April 27, 2013 5:56 PM
All replies
-
I think it would be better to load the content on demand rather than on every start up. Will your app work in this manner?
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.Friday, April 26, 2013 4:04 PMModerator -
Have a look at the Q42 WinRT library (Google it), it's designed for exactly this type of scenario...
- Proposed as answer by Jernej Kavka Sunday, April 28, 2013 9:09 PM
- Marked as answer by Weblineindia Thursday, May 2, 2013 6:37 AM
Friday, April 26, 2013 8:39 PM -
thanks for fast reply.
NO, it will update content data everytime on start up.
Saturday, April 27, 2013 3:51 AM -
You can call them asynchronously and show some animation or progress ring while your application completes these tasks. As soon as async calls complete (listen for asynchronous completed event), you can complete the animation or hide progress ring. You can see extended screen which can be used to prepare an app during start up. Relevant text from article-
Display a splash screen for more time by creating and displaying an extended splash screen. This extended screen imitates the splash screen that is displayed by Windows. You may want to display an extended splash screen to show real-time loading information to users, or simply because your app needs more time to prepare its initial UI.
Thanks,SachinMy Samples | Personal Website
- Edited by Sachin S Saturday, April 27, 2013 4:29 AM
Saturday, April 27, 2013 4:29 AM -
I tried that too. but it takes long time to download. 12-15 XMLs files and 130-140 images to download. so it takes 20-25 seconds to download. so I think extended splash screen not a good option. I need to use some background thread just like Bing news app.Saturday, April 27, 2013 6:30 AM
-
Just see this sample Thread pool sample to run code asynchronously and see if you can use it in your scenarioThanks,SachinMy Samples | Personal Website
- Marked as answer by Matt SmallMicrosoft employee, Moderator Monday, April 29, 2013 3:08 PM
- Unmarked as answer by Weblineindia Thursday, May 2, 2013 6:36 AM
- Marked as answer by Weblineindia Thursday, May 2, 2013 6:36 AM
Saturday, April 27, 2013 5:56 PM -
yes, it works fine now.
thanks.
- Edited by Weblineindia Thursday, May 2, 2013 6:36 AM
Wednesday, May 1, 2013 9:10 AM -
yes, it solve my problem for downloading images in background.
thanks
Thursday, May 2, 2013 6:37 AM