jQuery with WinJS in Windows Store Application

As we all know, we can design Windows store applications using HTML, CSS and JavaScript. We can use jQuery along with the WinJS as well.

Let’s open up the Visual Studio and create a new navigation project under JavaScript with a name called jqTest.
Now we will get the project created and opened with the default.html page.SolutionExplorer


Let’s get download the jQuery¬†and place that in js folder in Solution Explorer. Continue reading

Behavior of WinJS.Promise.Join during Exceptions


Promise is an object, which promises the user to get back the values or do some task after performing the promised activity without hampering the main UI. The execution of the other activities will work as normal. So in single word we can say, it is asynchronous.

The JOIN method of the Promise works like a waiter in the restaurant, waiting for the whole order from a table from each person. We can club separate promise objects and join them together. Join ensures to perform a task after all the promise objects finished their execution.

Queries encountered on the above

On all the above, I encountered the query,

  • what will happen when any of the Promise gets an error ?
  • Will it able to club the output and wait for the promises ? OR it will quite the execution ? Etc. etc.

After some of the homework and trials below are my findings. Continue reading

MVVM Command Binding in Windows Phone using Custom Delegates

Binding commands in MVVM is a bit tricky, but if understood correctly then of a great use.
A simple command can be bound using a Delegate and the Icommand Interface to handle the function that is to be executed.

First of all we need to know what a Delegate is?
A Delegate is a reference to a function. A Delegate is much useful in an event execution. Although this example deals with a custom Delegate we can use a predefined delegates present in the System Namespace.

Secondly and most importantly, ICommand interface and its implementation. ICommand can be found in System.Windows.Input namespace. ICommand interface provides all the method signatures that are used to execute a command in MVVM. Continue reading

Selecting phone book contacts in Windows Phone using MVVM

Windows phone API allows us to access the phone book contact list using the code. Contacts are fetched in an observable list with details like Display Name, Company, Phone Number etc bundled in the Contacts object. These contacts can then be displayed in a list box with required details.
Following examples demonstrates the same.

We will use the Contacts class to fetch the details of phone book contacts.
To start with windows phone Contacts class first and foremost requirement is that of adding a capability of ID_CAP_CONTACTS in the WMAppManifest.xml file.
To add a capability either edit the XML or select the Capabilities tab from WMAppManifest.xml file and select the ID_CAP_CONTACTS check box located in the left part of the screen. Continue reading