-
Notifications
You must be signed in to change notification settings - Fork 4
Understanding the data classes
Bishoymly edited this page Aug 9, 2012
·
3 revisions
- Each app has a container class (usually named AppData and inherits from LinkDev.Windows8.Data.AppDataBase).
- AppData has a list of Feeds that fills a list (or multiple) of application data.
- Any objects that are added to the AppData class will get serlizalized/cached in the user local storage. And will be loaded on app start. So any such types should be serializable and should be added to SerializedTypes in AppData static constructor (this allows the automatic serialization to happen without errors).
- Feeds inherit from FeedBase and override GetFeedAsync to get data from external sources and fills it into the AppData container.
- An example is RSSFeed that implements a generic RSS feed reader class that fills a set of news items inside a category. An app can contain multiple feeds (to set different news categories) from different sources and in different formats.
- The NewApp project contains a single SampleFeed that fills AppData with a static list of sample data.
- A developer may create a new feed class (that inherits from FeedBase like SampleFeed) but gets data from http get with different format or from a web service.
- In the NewApp project, the AppData class has a collection named ItemGroups that represents different news category.
- The type DataGroup represents a category of items and should be used or derived for any category/list of items in your app. It has a collection of Items and another one for ItemsSummary. ItemsSummary are the first few items that should be displayed in a home page.
- The type DataItem represent a single content item and should be used or derived for any app content. It can be shared and searched, among other features provided for items. Typically if an app requires more fields to be stored in the item it should be added in a new class derived from DataItem.