다음을 통해 공유


Definition of the configuration JSON file format

[This post is a part of a series of post about the Social Media Dashboard Sample. This post was written by Peter Bryntesson. For an introductory blog post, click here]

The Social Media Dashboard sample is based on JSON configuration file that determines what content the app should be filled with. This blog entry will detail the format and capabilities of this configuration file. After reading this article you will be able change the configuration file to get the content you are interested in.

The configuration file consists of two parts; a header and an array of modules the defines the different hub of items that is displayed. Here is the definition of the header part of the configuration file:

appname Used to display as the application name inside the application.
livetilemodule Index into modules designating the module that will update the live tile.
abouttext The text shown in the about flyout page accessed from Settings.
privacypolicy The text shown in the privacy policy flyout page accessed from Settings.
privacypolicylink The uri link displayed in the privacy policy flyout page accessed from Settings.

The definition for the module entry is as follows:

title The title used for this group of items.
type The type of data. The supported types are detailed below.
parameter Type-specific parameter, see detailed list below.
parameter2 Type-specific parameter, see detailed list below.
feeds If the type is blogfeed-multi, this is an array of RSS blog uris to collate.

There is no limitation on the number of modules you can have, or any dependencies on the order of modules. The group of items will appear from left to right in the panorama in the same order as listed in the configuration file. Here is a description of the different types of modules Social Media Dashboard supports, and how each is configured.

youtube-channel This module will display the YouTube videos from a specific channel by specifying the channel in the parameter property. You can limit the result by adding a query into parameter2.
youtube-query This module will display YouTube videos from a Query specified in parameter. You can further filter the result by excluding a specific YouTube user in parameter2.
blog-feed This module will read blog entries from the RSS feed specified in parameter.
twitter-query This module will display tweets based on the query in parameter.
twitter-user This module will display tweets for a specific twitter user specified in parameter.
flickr-query This module will display pictures from Flickr base on the query in parameter. You need to supply a Flickr api key in parameter2 as well.
blogfeed-multi This will present blog entries from multiple RSS blog feeds as specified in the feeds array.
customfeed-multi This will create a custom feed module and fill it’s contents from the custom JSon configuration file specified in parameter. See description below for details.

The file format for defining a custom feed is as follows:

title The title of the custom feed.
image Uri to the image shown for the custom feed.
description The description displayed for the custom feed.
url Optional url that is navigated to when tapping the custom feed.

Now let’s look at the concrete example from the sample. Here is config.json and windowsphone.json from the source files:

{
    "appname" : "Windows Phone Developer News",
    "abouttext" : "This app shows information about Windows Phone development, including blogs, tutorial videos and tweets.",
    "privacypolicy" : "<TODO: insert your privacy policy here>",
    "privacypolicylink" : "<TODO: insert link to your privacy policy here>",
    "livetilemodule" : 3,
    "modules" : [
        { "type" : "customfeed-multi", "parameter": "Assets\\CustomFeeds\\windowsphone.json", "title": "" },
        { "type" : "blog-feed", "parameter": "https://blogs.windows.com/windows_phone/b/wpdev/rss.aspx", "title": "Windows Phone Developer blog" },
        { "type" : "youtube-query", "parameter": "windows phone development tutorial", "parameter2" : "", "title" : "Tutorial Videos" },
        { "type" : "flickr-query", "parameter": "lumia", "parameter2": "<TODO enter your Flickr api key here>", "title": "Images" },
        { "type" : "twitter-query", "parameter": "wpdev", "title": "Tweets" },
    ],
}

{
    "items" : [
        { "image" : "/Assets/CustomFeeds/windowsphone.jpg", "title": "Windows Phone Development", "description" : "Here is information about Windows Phone Development" },
    ],
}

There you have it, the definition of the configuration files for the Social Media Dashboard sample! Play around with it and change the content to suit your interests. Have fun!

 

For more information about Windows 8 app development, go here.

For more information about Windows Phone development, go here.

Comments

  • Anonymous
    June 11, 2013
    also, can I add facebook feed info?

  • Anonymous
    June 11, 2013
    How can I add an image to the blog feed instead of the date?