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 7497971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:17:29+00:00 2026-05-29T19:17:29+00:00

So, I am making an app for wp7. To keep it simple, these are

  • 0

So, I am making an app for wp7.
To keep it simple, these are my files:

  • LoginPage.xaml (the starup page)
  • MainPage.xaml
  • MainViewModel.cs
  • ItemViewModel.cs

In MainViewModel.cs I included the folowing function:

private void DownloadItems()
    {
        string key = this.User.Key;
        WebClient wc = new WebClient();
        wc.DownloadStringCompleted += callback;
        wc.DownloadStringAsync(new Uri("http://localhost/items?key=" + key)); //JSON
    }

and the callback function:

private void callback(object sender, DownloadStringCompletedEventArgs e)
    {
        if (e.Error == null)
        {
            List<ItemViewModel> col = Deserialize_ItemViewModel(e.Result); // deserialize JSON to List<ItemViewModel>
            this.Items = new ObservableCollection<ItemViewModel>(col);
            ItemDB.Sponsors.InsertAllOnSubmit(col);
            ItemDB.SubmitChanges();
            this.IsDataLoaded = true;
            // ???
        }
    }

When the user logs in the login will be processed and when everything is ok DownloadItems will be called which is using the freshly set User.Key.

What I need is to show a ProgressIndicator while the download is occuring and when the download is completed and processed I want to navigate to MainPage.xaml, which will be ready by that time.

I hope anyone can help me, thanks in advance!

  • 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-29T19:17:30+00:00Added an answer on May 29, 2026 at 7:17 pm

    I think I would try to solve it differently. Let your LoginPage only handle the login, then you re-direct to your main page.

    In your view model, for the main page, you create a bool property called something like Loading, which you can set to true during your async call. Bind this to the visible property of the progress bar so it shows when Loading is true, use a converter to handle bool -> visible. When the data is loaded you just set the Loading to false which will result in the progress bar disappearing. At the same time you bind the visible property of the control/view to Loading as well, but this will use a different converter that is the inverted value of the converter for the progress bar.

    Hope that will help.

    UPDATE: I missed that you already have a IsDataLoaded, is that on your view model? The converter should look something like:

    public class VisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, 
                   CultureInfo culture)
        {
            if (value != null && value is bool && parameter != null)
            {
                var bValue = (bool) value;
                var visibility = (Visibility)Enum.Parse(
                typeof (Visibility), parameter.ToString(),true);
                if (bValue) return visibility;
                return visibility == 
                Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
            }
    
            return null;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter,
                       CultureInfo culture)
        {
             throw new NotImplementedException();
        }
    }
    

    Then use it like:

    Visibility="{Binding IsDownloading, Converter={StaticResource VisibilityConverter}, ConverterParameter=Visible}"
    

    Example code is taken from: http://dotnetbyexample.blogspot.com/2010/11/converter-for-showinghiding-silverlight.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an App for WP7 and I'm looking for a way to rotate
I am making an WP7 app that connects to SQL DB through WCF. But
I am making a WP7 app that, when a user taps an image, randomly
I'm making a wp7 app that uses RestSharp to download some data. I noticed
m making an app which requires to play recorded audio files. For that m
I am getting this weird error when making a WP7 app, and I can
I am making app that takes a screenshot of a URL requested by the
I am making app about google documents. but I don't know How to save
I'm making another app's window topmost to ensure that a click in my app
I am making an app that scrolls information on the desktop. The window is

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.