WPF ProgressBar to call Webservice

Is it possible to show ProgressBar to show the progress of a Webservice call? I am using a web service that calls a SQL database and returns a list of requested data when requested.

Webservice code

    public List<LocationUpdate> GetAllLocationsByUserID(int UserID)
    {
        MainframeConnectionDataContext db = new MainframeConnectionDataContext();
        var validLocations = from query in db.LocationUpdates select query;
        return validLocations.ToList();
    }

      

Client code

    void Window1_Loaded(object sender, RoutedEventArgs e)
    {
        dg_sql_data.ItemsSource = CMainFrameConnection.GetAllLocationsByUserID(0);
    }

      

It currently takes about 5-10 seconds to load the data.

Any ideas?

  • Rayt
+1


a source to share


1 answer


The progress bar may not be acceptable as you apparently cannot tell how far this operation is running. It might be more appropriate to display a "loading" animation.

eg. some examples of animations you could use here http://www.ajaxload.info/



EDIT: As Dreas points out, setting IsIndeterminate is a good way to handle this.

+4


a source







All Articles