Display an image while async method is executing

  • 21 August 2014
  • 2 replies
  • 1 view

Badge +10

Hi All,

 

I have a list view which is tied to a GetList method.

In the view initialise I call the GetList method but I'm doing this Asynchronously.

The GetList will take about 11 sec to return.

I want to display an image while this method returns and once the method returns remove the image.

How can I do this, and is it possible?

 

Any ideas would be welcomed.

 

Thank you,

JohanL


2 replies

Badge +7

Hi John,

 

What i understand is you need to display the image for 11 second once the getlist method returns the data, image should vanishes ! is this something you are trying to acheive it?

Badge +10

Yes that is correct.

 

What I've done for now is the following.

I added the image to the list view header and set it to be invisible by default.

I then added all the rules to load the list view into my refresh button on the form.

I also added a data label which does a count on the list.

This button will call the GetList method Asynchronously, and show the image.

I then have an OnChange on the label doing the count of the list.

As soon as the count label changes I check a condition to see if the count is >= 0 and then I hide the image.

The problem is that when the form initially loads the image is only displayed for a brief interval because at that time the count value is 0.

Unfortunately I will have the situation where the list can contain no entries so I need to cater for this as well.

After the initial load, if you click the refresh button, the image is displayed until all the items load.

 

If I can only get the first initial load to  work then this would be a perfect solution.

If anyone has some more ideas on how to get it to work I would love to hear them.

 

Regards,

JohanL

Reply