Pages

Wednesday, 22 August 2012

Windows 8 and HTML Part 6: Displaying Data with WinJS ListView

Windows 8 and HTML Part 5: Fetch Data with WinJS

Windows 8 and HTML Part 1: Simple Example

Finally, we will start to get some data and begin building our application.  Based on Part 4, the logical place to start will be in home.js.  In the ready function for the page, we will use WinJS.xhr() to make an Http request to Twitter, and parse the results.  Making a call using WinJS.xhr() is straightforward in this case. 

WinJS.xhr({ url: "http://search.twitter.com/search.json?q=%23windows8&rpp=100" })

As you can see, we pass on object with the url property set to the Twitter search service.  We will search on the #Windows8 hash tag and request 100 tweets.  If we left this code as shown, our app would make a request to Twitter, but we would never get the results returned.  Why?  WinJS.xhr() is an async operation and will execute on a different thread than the UI thread that called it.  This is accomplished by using a Promise.  If you look at the xhr() return value, you will see that it actually returns a Promise.

To get the results when the Promise completes is async op, we need to call it’s then() or done() function.  You can chain multiple then() functions, because then() returns a promise. You cannot chain more than one done() method, because it returns undefined.  Since we want to parse the results of our search, we would write

WinJS.xhr({ url: "http://search.twitter.com/search.json?q=%23windows8&rpp=100" }).then(
   function(response) {},
   function (error) {},
   function (progress) {}
);

Read full article here

Windows 8 and HTML Part 4: First Taste of WinJS

Windows 8 and HTML Part 1: Simple Example

Let’s switch back to a WinJS application and take a look at what happens when a page is loaded.  Open package.appxmanifest and switch the Start Page back to default.html.

If you remember from Part 1, we created this application as a single-page style application.  This means that default.html gets loaded once, and different pieces of HTML content are then loaded “into” default.html for rendering and execution.  If we look at default.html, we see two important things.

Windows 8 and HTML Part 4: First Taste of WinJS First, we see that default.html loads the core script files for the WinJS framework and then the default.js script file (where we put our code), and also navigator.js, which helps navigate from page to page (with page really being HTML content being loaded into default.html).  The second thing to notice is that default.html contains a single div that is marked as aPageControlNavigator control.  It is this div that serves as the content host for the rest of the content.

Read full article here

Creating A RadCartesianChart – Line Graph


Creating A RadCartesianChart – Line Graph In this post, I will explore creating a line chart using the RadCartesianChart from the Telerik Windows 8 UI Controls.  You can Download Telerik Widows 8 Controls here.

Figure 1 shows the chart we wish to build. This is a linear chart built with a RadCartesianChart. It represents revenue for the last six months of 2012.

Read full article here

Web Informer Button