Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6317835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:34:38+00:00 2026-05-24T15:34:38+00:00

I am new to WP7 coding. I am looking for sample code or guiding

  • 0

I am new to WP7 coding.
I am looking for sample code or guiding on the following task:

I had 3 html pages on remote server and I want to download the contents of each of the page and post it to 3 different panorama page (show as a textblock).

I had written 3 set of webclient to load the html page; it can be shown as where it suppose to be. My issue facing is, when/during the downloading, the UI thread is “freez” and unresponsive.

Can anyone guide me / show me the sample code that I can put the thread to background and once it finish, and shown in the UI?

This is the code that I use to download the HTML page.

private async void GetNewsIndex(string theN)
    {
        string newsURI = newsURL + theN;
        string fileName = theN + "-temp.html";
        string folderName = "news";

        prgBar01.Visibility = System.Windows.Visibility.Visible;

        try
        {
            Task<string> contentDataDownloaded = new WebClient().DownloadStringTaskAsync(new Uri(newsURI));

            string response = await contentDataDownloaded;

            WriteTempFile(theN, response.ToString());

            string contentData = ProcessDataToXMLNews(fileName, folderName);

            WritenewsIndexXMLFile(newsIndexURI, folderName, contentData);

            DisplayNewsIndex();

        }
        catch
        {
            //
        }
    }

I’d modified the above code as per suggestion by Sinh Pham, and it work perfectly as it expected. But, Since I need to run 3 instant of it to download the page from different souce at he same time; the code break. Any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T15:34:38+00:00Added an answer on May 24, 2026 at 3:34 pm

    Are you sure the UI freezes when downloading and not when processing the data? From your code it seems like you’re only doing

    WriteTempFile(theN, response.ToString());
    
    string contentData = ProcessDataToXMLNews(fileName, folderName);
    
    WritenewsIndexXMLFile(newsIndexURI, folderName, contentData);
    
    DisplayNewsIndex();
    

    on the UI thread. Try wrap them in a BackgroundWorker instead.

    Edit: something like this:

    Edit2: since your DisplayNewsIndex() function cause changes in the UI, it must be executed on the UI thread.

    var bw = new BackgroundWorker();
    bw.DoWork += delegate {
        WriteTempFile(theN, response.ToString());
        string contentData = ProcessDataToXMLNews(fileName, folderName);
        WritenewsIndexXMLFile(newsIndexURI, folderName, contentData);
        Deployment.Current.Dispatcher.BeginInvoke(() => {
            DisplayNewsIndex();
        });
    };
    bw.RunWorkerAsync();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to update the WP7 lock screen in code? I want to
New to xml. Looking for XPath to search a xml file with python ElementTree
In new C++ code, I tend to use the C++ iostream library instead of
This code works in a WPF app but throws a NetworkException (server not found)
i'm .Net developper and new to WP7 development.What I'm trying to do is to
I am new to both Silverlight and WP7. I have been attempting to hotlink
I have added a new XAML page to my WP7 app and I need
I am new to MVVMLight and have started to use it in my WP7
New class is a subclass of the original object It needs to be php4
New to javascript/jquery and having a hard time with using this or $(this) to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.