Developing Windows 8 Style Application With HTML and JavaScript WWW.KAASHIVINFOTECH.COM
The big picture WWW.KAASHIVINFOTECH.COM
The tools are there! Visual Studio Expression Blend Code editor w/ Intellisense UI Designer Debuggers DOM Explorer Javascript Console Simulator Platform window Visual Studio Code Editor WYSIGYG designer Interactive mode Animation Smarter Properties Window Simulator Platform window Expression Blend WWW.KAASHIVINFOTECH.COM
Windows Library for JavaScript Matches the Windows 8 design style Controls for common user experiences Designed for touch as well as traditional input Scales across form factors Make your apps look and feel great Web technologies you’re already familiar with Modern patterns for responsive, reliable apps Use interactive design tools Build your apps fast and with high quality WWW.KAASHIVINFOTECH.COM
WinJS Helpers for Namespaces, Constructor Definition Data binding Controls Promises Animations App Model Templates Navigation Utilities Page & User controls Default CSS Styles WWW.KAASHIVINFOTECH.COM
Promises handle Async WWW.KAASHIVINFOTECH.COM
Promise Code // Object that is a promise for a later value WinJS.xhr({ url:"http://www.example.org/somedata.json" }).then(function (response) { updateDisplay( JSON.parse(response.responseText)); }, function (ex) { reportXhrError(ex); }); WWW.KAASHIVINFOTECH.COM
Host Enforcement Prevents potentially “bad” HTML from getting inserted Script blocks, iframes, event handlers, etc. Kicks in when setting strings innerHTML outerHTML setAdjacentHTML “data-” attributes in general not on the allowed list WinJS specific ones are ok WWW.KAASHIVINFOTECH.COM
Host Enforcement Escape Hatches Can work around when needed: toStaticHTML method Use DOM creation APIs Use WinJS.Utilities.setInnerHTMLUnsafe Use msWWA.execUnsafeLocalFunction WWW.KAASHIVINFOTECH.COM
Everyday Widgets WWW.KAASHIVINFOTECH.COM
Presenting Data List View (ListLayout) ListView (with GridLayout) Flip View WWW.KAASHIVINFOTECH.COM
Controls <!– Step1: declare control --> <div id=“list” data-win-control="WinJS.UI.ListView" data-win-options="{ selectionMode: 'none' }"></div> /* Step 2: Call WinJS.UI.processAll() */ WinJS.UI.processAll(); /* Step 3: Use the control */ document.getElementById(‘list’).winControl.addEventListener (‘selectionchanged’, onSelChanged ); WWW.KAASHIVINFOTECH.COM
DataBinding <!– Step1: declare template --> <div class="itemtemplate" data-win-control="WinJS.Binding.Template"> <div class="item"> <img class="item-image" src="#" data-win-bind="src: backgroundImage; alt: title"/> <div class="item-overlay"> <h4 class="item-title" data-win-bind="textContent: shortTitle"></h4> <div class="item-subtitle" data-win-control="WinJS.UI.Rating" data-win-options="{disabled: true}" data-win-bind="winControl.userRating: rating"></div> </div> /* step2: use the Data Template */ ui.setOptions(listView, { itemTemplate: element.querySelector(".itemtemplate"), oniteminvoked: this.itemInvoked }); WWW.KAASHIVINFOTECH.COM
Commanding Surfaces WWW.KAASHIVINFOTECH.COM
Windows 8 Animation Library Contains key Metro style app animations Has the same storyboard values, curves, and even the same API that Windows uses Aligns your app to the Windows 8 personality WWW.KAASHIVINFOTECH.COM
Animation Library Scenarios Navigation Content Reveal/Hide UI enterPage/exitPage enterContent/exitContent Expand/collapse Peek showEdgeUI/hideEdgeUI showPanel/hidePanel showPopup/hidePopup Collections Selection AddItemToList Delete item from list Pointer animations Swipe select/swipe deselect Swipe reveal WWW.KAASHIVINFOTECH.COM
Basic Tiles Overlays status on top of tile Supports square and wide tiles Number up to 99 or pre-defined glyph: Always legible on top of images Badge Badge WWW.KAASHIVINFOTECH.COM
WWW.KAASHIVINFOTECH.COM
Toast Notifications Toast notifications deliver transient messages outside the context of the app Use toast notifications to get user’s attention immediately User is in control and can permanently turn off toast notifications from your app Allows quick navigation to a contextually relevant location in your app Toast notifications are easy to invoke from your app or from the cloud WWW.KAASHIVINFOTECH.COM
Toast Templates Toast notifications use the same template architecture as Live Tiles Rich set of rendering options available WWW.KAASHIVINFOTECH.COM
Search Share Settings Play To App to App Picking Contracts WWW.KAASHIVINFOTECH.COM
Search Anatomy Search box is scoped to the main app on screen 1 Search box is scoped to the main app on screen Query suggestions provided by the main app on screen Autocompletes to terms for which the app has search results List of installed Metro style apps that have implemented the search contract 2 3 WWW.KAASHIVINFOTECH.COM
Search Anatomy 4 Result suggestions provided by the main app on screen Must include a thumbnail and title Indicates a strong or exact match result Takes users directly to the details of the result WWW.KAASHIVINFOTECH.COM
Implementing Search //Easiest is to Add -> New Item -> Search Contract in visual Studio // Step 1: Declare the capability in the manifest <Extensions> <Extension Category="windows.search" /> </Extensions> //Step 2 : Handle the events appModel.Search.SearchPane.getForCurrentView().onquerysubmitted = function (eventObject) { /*do work here*/ }; appModel.Search.SearchPane.getForCurrentView().onsuggestionsrequested = function (eventObject) { /* do work here */ }; WWW.KAASHIVINFOTECH.COM
Thank you! WWW.KAASHIVINFOTECH.COM