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,
After some of the homework and trials below are my findings. Continue reading
Windows Phone comes with a number of controls for display. Among them the Panorama Control is one the new controls for user interaction and display.
Panorama Control spans beyond the screen and helps user to chose from a number of panorama items. Each panorama item can consists of Grids, Stack Panels and other Phone controls. Image applied to Panorama as background spans across all the panorama items. Only one panorama item is visible at a time and user can make selection from it. A swipe gesture gives the next or previous Panorama item. Continue reading
Animations are key features to make an app interactive and lively. It can occur between Opacity, change in X & Y coordinates, Bounce effect, Size changes etc. Storyboards are the most effective way to implement an animation.
In this example we will go through an animation, which would make a rectangular box move from left to right with position and time span being specified.
To make such kind of animation first of all it is required to animate the Canvas.Left property of an element using the DoubleAnimation class. This class makes use of the Duration specified in the format “hour:minute:second” and animates the Canvas.Left property of the element according to the time period specified. Other property includes AutoReverse, which reverses the animation (the same animation in opposite manner)and RepeatBehavior, which specifies how many times the animation can be repeated. Continue reading
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
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
Start and Stop methods of WinJS.Application object explaining their functionality as by the names suggested.
These methods are responsible for the starting and stopping of the application, since we usually see them added to the default templates.
My experiment :
default.html file Content
<body> <span id="deSpan" style="font-size:70px;"></span> </body>
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.
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
Navigation to different pages is an important part of any application. In Windows Store App it is handled by the Frame class.
A Windows Store app consist of a Parent frame and pages inside it. This frame provides a method named Navigate() that handles all the navigation between the pages. Navigate method takes the type of Page to navigate as parameters, additionally we can also specify the data to pass to the next page. The Navigate method triggers an event named OnNavigatedFrom inside the page when navigating away from the page and OnNavigatedTo in the page to which we are navigating. The data passed during navigation is caught in the NavigationEventArgs object of the Events above.
The parameter passed from the Previous page is stored in the Parameter property of the NavigationEventArgs that is received while navigating. Continue reading