WinJS.Promise.Any – An example

WinJS.Promise.any gets invoked when any of a promise object finished its execution from a list of promise objects. We need to create an array of promise objects, which we are expecting to execute. On successful execution of any of the promise object from the array will invoke the “any” method to perform the tasks defined.

In this scenario, I need to execute a task on successful execution of a web services from a list of web services.

Solution: Continue reading

Using WinJS.Promise.Join-Executing a task after others finishes

WinJS.Promise.join is a method being exposed by the Promise object to deal with multiple promise objects execution.

This is a live scenario when I have received a task which will call a set of web services and perform certain action after the completion of all web services execution in an asynchronous mode.

HTML file content Continue reading

WinJS.Promise – My Experiment to create some delay using loop

WinJS.Promise is a class, which supports the asynchronous programming model. Upon the execution, program control executes the promise class and proceeds to the subsequent statement to execute. But it keeps track of the execution point to which control needs to get back after the promised function finished its execution.
A question was banging my head, whether I can create my own delay to the promise object and invoke Then/Done.

I tried 2 kind of exercises. But in both the exercise I had the HTML page common.

Exercise #1
Used the below code to create a delay by executing a long loop in an external method and returning a promise object from it. So that on completion, I can call Then method to do some task. Continue reading

Canvas In Action in Windows Store App

The slides contains a brief demonstration on the Canvas and its use in Windows Store app. Also a small intro to the Inking. Continue reading