microsoft pt techrefresh html win8.1

61
Creating your Windows 8.1 App with HTML/JS Alexandre Marreiros

Upload: alexandre-marreiros

Post on 18-Jan-2015

1.392 views

Category:

Technology


1 download

DESCRIPTION

A presentation that take place in a Microsoft Portugal Event, The main propouse of this session was to show the development model of Windows 8.1 store apps in HTML for the ones who already know Windows 8 HTML dev and for the one who never had developed a HTML based Windows store app.

TRANSCRIPT

Page 1: Microsoft PT TechRefresh html win8.1

Creating your Windows 8.1 App with HTML/JSAlexandre Marreiros

Page 2: Microsoft PT TechRefresh html win8.1

About

What i do:

CTO @ Innovagency

Technical Trainer, Speaker & Consultant as Self Employee

Teacher @ EDIT

Software Developer & Architect as Consultant

Tech Writer and Revier as Self Employee

Digital business & UX ConsultantContacts:[email protected] / [email protected]@alexmarreiroshttp://www.linkedin.com/pub/alexandre-marreiros/8/4b8/a21www.digitalmindignition.com

Alexandre Marreiros

Page 3: Microsoft PT TechRefresh html win8.1

Agenda

• Windows Store APPS that use HTMLShowCase

• Basic Principles

• Development tools

• Development Model

• WinJS

• WinJS 2.0

Putting the hands on demos

Page 4: Microsoft PT TechRefresh html win8.1

HTML Based Windows Store Showcase(NATIVE and Portuguese Market)

Page 5: Microsoft PT TechRefresh html win8.1

• Calendar• People• Store• Reaing List• Mail• Finance• Sports• Weather• News• Travel• Skype• And More

Native Microsoft APPS

DEMO

Page 6: Microsoft PT TechRefresh html win8.1

• Caixa Directa

• A Bola

• ANA aeorportos

• Eat o

• Vodafone Quiosque

• MyAuto

• And More

Local Portuguese Store APPS

DEMO

Page 7: Microsoft PT TechRefresh html win8.1

Basic Principles (Lap around HTML 5 Windows Support)

Page 8: Microsoft PT TechRefresh html win8.1

Runtime Recap

Page 9: Microsoft PT TechRefresh html win8.1

Some Popular CSS 3 Features

2D & 3D transforms

Transforms Animations

Transitions

MotionGrid

Flexbox

LayoutGradients

Filter Effects

Text-shadow

GraphicsMulti-column, hyphenation

Pagination

Position float

Content flow

Page 10: Microsoft PT TechRefresh html win8.1

Some Popular HTML 5 Features

Web Sockets Web Workers IndexedDB

Ecmascript 5 File API & Blobs Geolocation

Audio tag Video tag

Touch & keyboard/Mouse SupportPointer events

Zoom regions

Snap Points

Forms

Validation

Input types

Spell checking

Drag & Drop

Page 11: Microsoft PT TechRefresh html win8.1

Web vs APP development

Feature Local context Web context

Windows Run-time Yes No

Windows Library for Javascript Yes No

External script references No Yes

Cross-domain XHR requests Yes No

Automatic filtering for script injection on DOM

Yes No

Page 12: Microsoft PT TechRefresh html win8.1

• Styling changes

• Windows Runtime access

• Single page model

• App sizes and orientations

Web vs APP development

• Security context and innerHTML

• Local and web context

• IE11 DOCMODE

• Network connectivity and offline experience

Page 13: Microsoft PT TechRefresh html win8.1

HTML development Review

WinJS HTML5

Windows app

WinRT

Page 14: Microsoft PT TechRefresh html win8.1

HTML development Review

Windows app

IE rendering engine “Trident”

WinRT

Windows

WinJS

HTML/CSS/JS

Page 15: Microsoft PT TechRefresh html win8.1

The new WINJS

WinJS 1.0

Windows 8 app

WinJS 2.0

Windows 8.1 app

Page 16: Microsoft PT TechRefresh html win8.1

Development Tools

Page 17: Microsoft PT TechRefresh html win8.1

Tools

Page 18: Microsoft PT TechRefresh html win8.1

Visual Studio Templates

Page 19: Microsoft PT TechRefresh html win8.1

Visual Studio Templates

A single Page APP with the struture of a Windows Store APP, no Controls or Layout predefined

Page 20: Microsoft PT TechRefresh html win8.1

Visual Studio Templates

A project with items grouped in a grid and the details of each item.

Page 21: Microsoft PT TechRefresh html win8.1

Visual Studio Templates

A project to navigate between Grouped Items and get the detail from each item in a group

Page 22: Microsoft PT TechRefresh html win8.1

Visual Studio Templates

A project for a Windows Store APP that implements the HUB navigation Pattern

Page 23: Microsoft PT TechRefresh html win8.1

Visual Studio Templates

A project for a Windows Store APP that have a predefined Navigation controls

Page 24: Microsoft PT TechRefresh html win8.1

Windows StoreHTML project Structure Explained

WINRT library instaciated directly by the app

Page 25: Microsoft PT TechRefresh html win8.1

Windows StoreHTML project Structure Explained

CSS Libraries for the Windows store app

Windows Store App Images

JavaScript

Page 26: Microsoft PT TechRefresh html win8.1

Windows StoreHTML project Structure Explained

App certify

App Manifest

Page 27: Microsoft PT TechRefresh html win8.1

Demo HML/CSS3

Page 28: Microsoft PT TechRefresh html win8.1

• Style sheets

• Core (promises, class, namespace, etc.)

• App model

• Data binding

WIN JS

• Controls

• Animations

• Utilities

A collection of toolkits to make building Windows Store apps fast and easy

Page 29: Microsoft PT TechRefresh html win8.1

WIN JS

Page 30: Microsoft PT TechRefresh html win8.1

WIN JS Basic Demo

Page 31: Microsoft PT TechRefresh html win8.1

• Show how to use WinJS Controls in a declarative manner and a imperative manner

Review Demo

<div id="calendar" data-win-control="WinJS.UI.DatePicker"></div> Declarative Way

WinJS controls are divs with atributtes that are processed when the processall method runs.

Page 32: Microsoft PT TechRefresh html win8.1

• Show how to use WinJS Controls in a declarative manner and a imperative manner

Review Demo

Imperative Way

In the HTML File<div id="calendarDiv" ></div>

In th JS filevar calendarDiv = document.getElementById("calendar");var calendarctrl = new WinJS.UI.DatePicker(calendarDiv);

Page 33: Microsoft PT TechRefresh html win8.1

WIN JS in Detail

Page 34: Microsoft PT TechRefresh html win8.1

What’s new on WinJS 2.0

Improved Controls

• List view

• App bar

New Controls

• Hub

• Navigation bar

• Search box

• Back button

Infrastructure

• Scheduler

• Dispose model

• Async debugging

Building Blocks

• Binding template

• Repeater

• Item Container

Page 35: Microsoft PT TechRefresh html win8.1

• Native layout performance

• Highly flexible presentation

• Improved keyboarding

• Drag-n-drop

List View

Page 36: Microsoft PT TechRefresh html win8.1

• New Buil-in Layouts

List View Highly flexible presentation

Page 37: Microsoft PT TechRefresh html win8.1

<div id=“myListView“

data-win-control="WinJS.UI.ListView"

data-win-options="{ itemDataSource: myData.dataSource ,

itemTemplate: myTemplate ,

layout: { type: WinJS.UI.GridLayout ,

orientation: WinJS.UI.Orientation.horizontal } }”

itemsDraggable: true } “

</div>

List View

Page 38: Microsoft PT TechRefresh html win8.1

• Scaling to Window Size

• Keyboarding

• Custom Content

APP Bar

Page 39: Microsoft PT TechRefresh html win8.1

<div data-win-control="WinJS.UI.AppBar">

<button data-win-control="WinJS.UI.AppBarCommand" data-win-options="{…}"></button>

<button data-win-control="WinJS.UI.AppBarCommand" data-win-options="{…}"></button>

<div data-win-control="WinJS.UI.AppBarCommand“

data-win-options="{type: 'content'}">

<!– YOUR CONTENT HERE -->

</div>

</div>

APP Bar

Page 40: Microsoft PT TechRefresh html win8.1

HUB

Section

Header

Section

Header

Section

Header

Section

Header

Page 41: Microsoft PT TechRefresh html win8.1

HUB

<div data-win-control="WinJS.UI.Hub">

<div data-win-control="WinJS.UI.HubSection" data-win-options="{header: ‘Foo'}">

<!-- YOUR CONTENT HERE -->

</div>

<div data-win-control="WinJS.UI.HubSection" data-win-options="{header: ‘Bar'}">

<!-- YOUR CONTENT HERE -->

</div>

</div>

Page 42: Microsoft PT TechRefresh html win8.1

Navigation Bar

Place 1 Place 2 Place 3 Place 4 Place 5

Page 43: Microsoft PT TechRefresh html win8.1

<div data-win-control="WinJS.UI.NavBar">

<div data-win-control="WinJS.UI.NavBarContainer">

<div data-win-control="WinJS.UI.NavBarCommand"

data-win-options="{ label: ‘Foo', icon: 'url(foo.png)' }"></div>

<div data-win-control="WinJS.UI.NavBarCommand"

data-win-options="{ label: 'Bar', icon: 'url(bar.png)‘ }"></div>

</div>

</div>

Navigation Bar

Page 44: Microsoft PT TechRefresh html win8.1

SearchBox

Page 45: Microsoft PT TechRefresh html win8.1

<div id=“mySearchBox" data-win-control="WinJS.UI.SearchBox“></div>

mySearchBox.addEventListener("suggestionsrequested", suggestionsRequestedHandler);

mySearchBox.addEventListener("querysubmitted", querySubmittedHandler);

SearchBar

Page 46: Microsoft PT TechRefresh html win8.1

Scheduler

Task

Task

Task

Task

Task

Task

Task

AppCode

WinJSCode

SystemCode

?

Page 47: Microsoft PT TechRefresh html win8.1

Scheduler

Task

Task

Task

Task

Task

Task

Task

Task

AppCode

WinJSCode

SystemCode

schedule(func, pri);

schedule(func, pri);

schedule(func, pri);

Page 48: Microsoft PT TechRefresh html win8.1

Scheduler

setImmediate(foo);var S = WinJS.Utilities.Scheduler;S.schedule(foo, S.Priority.normal);orS.schedule(foo, S.Priority.high);orS.schedule(foo, S.Priority.idle);

Page 49: Microsoft PT TechRefresh html win8.1

<div data-win-control="WinJS.Binding.Template">

<img src="#" data-win-bind="src: imageUrl; alt: tile" />

<div data-win-bind="innerText: tile"></div>

<div data-win-bind="innerText: text"></div>

</div>

Binding Template

Page 50: Microsoft PT TechRefresh html win8.1

Repeater

HTML UI

Binding.List

{color:”red”,size:2}

{color:”green”,size:1}

{color:”orange”,size:2}

{color:”red”,size:3}

Page 51: Microsoft PT TechRefresh html win8.1

var myBindingList = new WinJS.Binding.List(…);

<div data-win-control="WinJS.UI.Repeater" data-win-options="{data: myBindingList}">

<label data-win-bind="textContent: description"></label>

<progress data-win-bind="value: value" max="100"></progress>

</div>

Repeater

Page 52: Microsoft PT TechRefresh html win8.1

WinJS Demo

Page 53: Microsoft PT TechRefresh html win8.1

• Create a HUB based application that use Bind to get the rss feed values, show the network client, the DataBinding Power and the interaction with the APP Bar

http://code.msdn.microsoft.com/windowsapps/Hub-template-sample-with-4b70002d

The base sample for the demo is

• Show Blend being used to costumize HTML Windows Store APPS, another interesting sample would be

http://www.codeproject.com/Articles/615819/Hub-Control-in-Blend

Code for the demo in http://digitalmindignition/source/hubExample

Review Demo

Page 54: Microsoft PT TechRefresh html win8.1

Recap

Page 55: Microsoft PT TechRefresh html win8.1

• Styling changes

• Windows Runtime access

• Single page model

• App sizes and orientations

Web vs APP development

• Security context and innerHTML

• Local and web context

• IE11 DOCMODE

• Network connectivity and offline experience

Page 56: Microsoft PT TechRefresh html win8.1

HTML development Review

WinJS HTML5

Windows app

WinRT

Page 57: Microsoft PT TechRefresh html win8.1

• Style sheets

• Core (promises, class, namespace, etc.)

• App model

• Data binding

WIN JS

• Controls

• Animations

• Utilities

A collection of toolkits to make building Windows Store apps fast and easy

Page 58: Microsoft PT TechRefresh html win8.1

Time to build your Windows apps

Page 59: Microsoft PT TechRefresh html win8.1

• Windows 8.1• http://windows.microsoft.com/en-us/windows-8/preview• http://msdn.microsoft.com/en-us/windows/apps/bg182409• http://channel9.msdn.com/Events/Build/2013/2-165• http://channel9.msdn.com/Events/Build/2013/2-081• http://channel9.msdn.com/Events/Build/2013/2-311• http://channel9.msdn.com/Events/Build/2013/3-156• http://msdn.microsoft.com/library/windows/apps/bg182410• http://code.msdn.microsoft.com/windowsapps/Windows-8-Modern-Style-App-Samples• http://www.app-me-up.com/

• Windows 8 & HTML • Programming Windows 8 Apps with HTML, CSS, and JavaScript

(http://go.microsoft.com/FWLink/?Linkid=254738)• Desenvolvimento em Windows 8, Luís Abreu, FCA• http://channel9.msdn.com/Series/HTML5-CSS3-Fundamentals-Development-for-Absolute-

Beginners

References

Page 61: Microsoft PT TechRefresh html win8.1

Thanks