you will need a global flag to track the status of the data fetch and store results in a global cache. use locks to make thread safe. your code should detect if a fetch is in progress and not start a new one. the fetch could also support events, to supply notification on competition.
Question about running async methods in Maui
I have an app which I can show information from a view on a ContentPage quickly. I have another thing I want to do but to get the data required takes about 5 seconds. What I want to do is on the load of the page start an Async method which while the user is looking at the easily accessable data is getting the harder to get data.
To get the data is not the problem and to start the method is also not a problem.
Now usually when I execute a method with Async I use await. But in this case I just want to start the method and let it do its thing. What I need to know is the following 2 things.
- When the user goes to the tab within the view that will display the hard to get data how will it know that the data is available.
- If the user descides to go to a different ContentPage within the app what happens to the method.