Load data from API once and use it throught multiple pages, where to store List with data

rozman50rozman50 Member ✭✭

When users opens app, FirstPage is loaded, where there is a list of news and some other non-related data is loaded. Then I have a separated page (NewsPage) where same news are loaded (I get data for both pages from one URL).
I want to optimize this, so app doesn't go out to get the same data twice, and when news are loaded on FirstPage, I want to store them somewhere and then access it from NewsPage.

From pageVM I call NewsService, which returns List. Do I set public List here?

What's the best approach to do this? Where do I store List so both Pages can access, read and modify this list (I'm using MVVM pattern with no frameworks).

Best Answers

  • rozman50rozman50 ✭✭
    Accepted Answer

    Since I have static class ApplicationSettings, where I keep some stuff about application. There I created public static List and saved it in there.
    I hope this doesn't break MVVM too much.

Answers

  • rozman50rozman50 Member ✭✭
    Accepted Answer

    Since I have static class ApplicationSettings, where I keep some stuff about application. There I created public static List and saved it in there.
    I hope this doesn't break MVVM too much.

Sign In or Register to comment.