SlideShare a Scribd company logo
Busy Developer's Guide
     to Windows 8 HTML/JavaScript Apps


                 Ted Neward
             Neward & Associates
http://www.tedneward.com | ted@tedneward.com
Credentials

Who is this guy?
   – Architectural Consultant, Neudesic Software
   – Principal, Architect, Consultant and Mentor
      ask me how I can help your project or your team
   – Microsoft MVP (F#, C#, Architect)
   – JSR 175, 277 Expert Group Member
   – Author
      Professional F# 2.0 (w/Erickson, et al; Wrox, 2010)
      Effective Enterprise Java (Addison-Wesley, 2004)
      C# In a Nutshell (w/Drayton, et all; OReilly, 2003)
      SSCLI Essentials (w/Stutz, et al; OReilly, 2003)
      Server-Based Java Programming (Manning, 2000)
   – Blog: http://blogs.tedneward.com
   – Papers: http://www.tedneward.com/writings
Objectives

Our goals...
    – to understand how to build a Windows 8 app in
      HTML/JavaScript
    – to understand why you want to do this
    – to understand why Microsoft wants you to do this
    – to understand where this fits in relation to .NET/C++/Web
    – to begin the path of deeper understanding
Disclaimer

Note that...
    – attending this talk will NOT make you an expert
    – I am also NOT an expert
    – Windows 8 hasn't shipped yet (technically)
This talk will get you started, try to debunk some of
   the popular conspiracy theories, and put some
   strategic overview on the whole thing
       that's it
Getting Started

Writing an app for Windows 8 in HTML/JavaScript
  requires
   – Windows 8 (seriously)
   – Visual Studio 2012 (either Express or full-blown)
      http://msdn.microsoft.com/en-us/windows/apps/br229516
   – Optionally, Microsoft samples and/or hands-on labs (HOL)
   – There are no (known) command-line tools to do this
Hello World

Once Win 8 and VS 2012 are installed
   – fire up the Hello World of Win8HTMLJS apps
   – File->New Project->JavaScript->Windows Store->Blank App
      •creates a single-page Metro HTML/JS App
      •first time, a "Developer License" dialog pops up; this is to
      obtain a crypto key for signing the app
   – hit "F5" and it will build and run on the local box
     (LocalMachine)
      you can also run it in the Simulator, which simulates tablets if
      you're not on one
Concepts


'Big picture' kinds of things
Concepts

What just happened?
   – VS built a project out of HTML and CSS and JavaScript
   – the app was bundled up into a "package" (a zip file)
   – the app contains a "package.appxmanifest" file that
     contains app metadata
   – the app was signed with a crypto key and deployed to the
     local machine
      C:Program FilesWindowsApps (which is protected up the
      wazoo!)
Concepts

What just happened?
   – when executed, a host process (WWAHost.exe) fired up
   – the IE 10 "Trident" HTML/CSS engine displayed the HTML
   – the IE 10 "Chakra" JS engine executed the JS
   – the application runs in a sandbox with no user privileges
Concepts

Your "executable" application essentially isn't
    – it's a Web app running entirely on the local machine
    – it's a native app with access to the underlying machine
    – it's Frankenstein's monster!
       maybe we should call it "Ballmerstein's Monster"?
Concepts

Metro apps aren't quite like traditional desktop apps
    – think more of a "fusion" of web and desktop
    – with some mobile ideas thrown in
As a result, UI approaches will need/want to be
   different
    – "Tiles" (shortcuts into your app's data or tasks)
    – "Live tiles" (representations of data easily seen)
    – "Chromelessness" (absence of window decorations)
    – "Charms" (toolbar off to the right of the screen)
    – "App Bars" (sort of like toolbars, but simpler/cleaner)
Concepts

WinRT
   – Windows Runtime API
        not to be confused with "Windows RT" (Windows on ARM)
   – essentially an API layer on top of the Windows kernel
   – provides O-O metadata similar to JVM/CLR runtimes
   – provides "projections" into different languages
        C#, VB, C++, and JavaScript (WinJS)
Concepts

Contracts
   – this is the new COM (sort of)
      programs advertise and consume contracts
   – essentially an IPC declaration mechanism
   – used for Search, drag and drop, app targets, and so on
Code


Show me the code!
Code

UI elements are defined in HTML
   – or can be added/manipulated later by DOM magic
   – all "basic" HTML controls are supported
       button, checkbox, drop-down list, email, file upload,
      hyperlink, listbox, text, password, progress, radiobutton, rich
      text, slider, uri, ...
   – WinJS also offers a few "custom" controls unique to Metro
      DatePicker, TimePicker, Rating, ToggleSwitch, Tooltip
Code

<body>
• <h1 class="headerClass">Hello, world!</h1>
• <div class="mainContent">
•     <p>What's your name?</p>
•     <input id="nameInput" type="text" />
•     <button id="helloButton">Say "Hello"</button>
•     <div id="greetingOutput"></div>
•     <label for="ratingControlDiv">
•        Rate this greeting:
•     </label>
•     <div id="ratingControlDiv" data-win-
control="WinJS.UI.Rating"></div>
•     <div id="ratingOutput"></div>
• </div>
•</body>
Code

UI styles are defined in CSS
    – Metro defines two parallel stylesheets for your use
       ui-light.css and ui-dark.css
    – of course, custom styling is always possible
       but until Metro gains widespread acceptance, resist
Much of the intent is to do styling and UI theming in
  Blend
    – ... and frankly, that's not a programmer tool
Code

body {
•}
•
•.headerClass {
• margin-top: 45px;
• margin-left: 120px;
•}
•
•.mainContent {
• margin-top: 31px;
• margin-left: 120px;
• margin-bottom: 50px;
•}
•
•#greetingOutput {
• height: 20px;
• margin-bottom: 40px;
•}
Code

UI events are handled in JavaScript
    – just as with Web, register a JS function with the event in
      question
       typically do this on app startup
    – and, of course, events can be registered/unregistered
      dynamically
Code

(function () {
• "use strict";
•
• // ...
•
• function buttonClickHandler(eventInfo) {
• var userName = document.getElementById("nameInput").value;
• var greetingString = "Hello, " + userName + "!";
• document.getElementById("greetingOutput").innerText =
greetingString;
• }
• function ratingChanged(eventInfo) {
• var ratingOutput = document.getElementById("ratingOutput");
• ratingOutput.innerText = eventInfo.detail.tentativeRating;
• }
•}
Code

(function () {
• "use strict";
•
• // ...
•
• app.onactivated = function (args) {
• if (args.detail.kind === activation.ActivationKind.launch) {
•     // ...
•     args.setPromise(WinJS.UI.processAll().then(function
completed() {
•        var ratingControlDiv =
document.getElementById("ratingControlDiv");
•        var ratingControl = ratingControlDiv.winControl;
•        ratingControl.addEventListener("change", ratingChanged,
false);
•        var helloButton = document.getElementById("helloButton");
•        helloButton.addEventListener("click", buttonClickHandler,
false);
•     }));
• }
• };
•
• // ...
•}
Analysis


Why did they do this?
Analysis

Web applications have dominated the industry for a
  decade
   – HTML/CSS/Javascript skills are ubiquitous
   – Web concepts are emerging into desktop applications
   – some users can't tell the difference between the two
   – more and more data is living in "the cloud"
      Dropbox, SkyDrive, Evernote, iTunes, Amazon, ...
Analysis

Conspiracies! Everywhere!
   – Is this Microsoft's attempt to kill the Web?
   – Is this Microsoft's attempt to kill HTML 5?
   – Is this Microsoft trying to "embrace, extend, extinguish"?
   – Is this the beginning of the end of the world as we know it?
Analysis

Microsoft wants people to write apps for their
   platform
   – this is hardly surprising, new, or unacceptable
   – part of this means making the platform easy to program
     for
   – part of this means making it "easy" for people to port code
      frankly I don't see this as being a big play
Microsoft wants people to buy apps on their
   platform
   – this means reducing the barrier to entry (AppStore)
   – this means making them easier to obtain (Internet)
   – this means putting some "borders" around apps (security,
     safety, etc), and this is easier with interpreted code than
Summary

Windows 8 apps are interesting to a certain crowd
   – this doesn't mean everybody will want to build one
   – in fact, if you're not a historic Microsoft developer, you
     probably won't
   – the concept of using HTML+Javascript to build a "native"
     app is interesting

More Related Content

What's hot (20)

PDF
JavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SK
David Wesst
 
PDF
Introduction to html5 game programming with ImpactJs
Luca Galli
 
PDF
jQuery: The World's Most Popular JavaScript Library Comes to XPages
Teamstudio
 
PPTX
Appcelerator Titanium - An Introduction to the Titanium Ecosystem
Boydlee Pollentine
 
PDF
May 2014-webinar
Howard Greenberg
 
PPTX
Tech days faridabad
Ankur Mishra
 
PPTX
Introduction to Keyboard Navigation and Accessibility
Matthew Deeprose
 
PDF
The Next Generation of Flash User Experience
Kevin Suttle
 
PDF
jQuery Comes to XPages
Teamstudio
 
PDF
Web Accessibility - A feature you can build
Monika Piotrowicz
 
PDF
Learning from the Best jQuery Plugins
Marc Grabanski
 
PDF
Develop an app for Windows 8 using HTML5
Soumow Dollon
 
PDF
Lastest Trends in Web Development
Doris Chen
 
PDF
10 Simple Rules for Making My Site Accessible
Helena Zubkow
 
PDF
Building Web Sites that Work Everywhere
Doris Chen
 
PPTX
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
David Wesst
 
PDF
Fewd week4 slides
William Myers
 
PPTX
Learning to be IDE Free (PrDC 2015)
David Wesst
 
ZIP
The 5 Layers of Web Accessibility
Dirk Ginader
 
KEY
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
Philipp Bosch
 
JavaScript Revolution - 5/Nov/13 - PrDC Saskatoon, SK
David Wesst
 
Introduction to html5 game programming with ImpactJs
Luca Galli
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
Teamstudio
 
Appcelerator Titanium - An Introduction to the Titanium Ecosystem
Boydlee Pollentine
 
May 2014-webinar
Howard Greenberg
 
Tech days faridabad
Ankur Mishra
 
Introduction to Keyboard Navigation and Accessibility
Matthew Deeprose
 
The Next Generation of Flash User Experience
Kevin Suttle
 
jQuery Comes to XPages
Teamstudio
 
Web Accessibility - A feature you can build
Monika Piotrowicz
 
Learning from the Best jQuery Plugins
Marc Grabanski
 
Develop an app for Windows 8 using HTML5
Soumow Dollon
 
Lastest Trends in Web Development
Doris Chen
 
10 Simple Rules for Making My Site Accessible
Helena Zubkow
 
Building Web Sites that Work Everywhere
Doris Chen
 
5 Reasons Why Your Website Is[n’t] a Native App (PrDC 2015)
David Wesst
 
Fewd week4 slides
William Myers
 
Learning to be IDE Free (PrDC 2015)
David Wesst
 
The 5 Layers of Web Accessibility
Dirk Ginader
 
jQTouch – Mobile Web Apps with HTML, CSS and JavaScript
Philipp Bosch
 

Viewers also liked (18)

PPTX
Quick guide to using Samsung S8003 for Ko
John Young
 
PDF
Объекты, выставленные на торги по программе Доктор рядом
tendermosru
 
PPTX
Magazine Projectfinal final
Shay Woods BA Hons
 
PDF
Beyond Copywriting (PresenTHINK 2015)
Teodora Petkova
 
DOCX
nhận làm video quảng cáo 3d
theo757
 
DOCX
Curriculum vitae
mahmoud talaat
 
PDF
Wind energy 2012 poland
FRACTAL GROUP
 
PDF
DB Systems Transmitter Deck
Kurt Ludwig
 
PDF
0514 matthew 1019 do not worry about what power point church sermon
PowerPoint_Sermons
 
PDF
Roof Coatings Presentation
Paul Hannam
 
PDF
Startups + Crowdfunding
Romagna Tech
 
PDF
2012 Budget Day Presentation
EmpowerLA
 
PDF
Yee San Su - Food Chain Reaction: A Global Food Security Game
SeriousGamesAssoc
 
PPT
Chuong 5a
Hoạt Hà Văn
 
DOC
Toan van diem moi luat doanh nghiep 2014
Hung Nguyen
 
PPTX
Questionnaire
Alex McKiernan
 
PPT
Org. molecules pres.
rksteel
 
PDF
haftalik dusunce ozgurlugu bulteni_13.05.31_22
Düşünce Suçu!?na Karşı Girişim / Freedom for Freedom Of Expression
 
Quick guide to using Samsung S8003 for Ko
John Young
 
Объекты, выставленные на торги по программе Доктор рядом
tendermosru
 
Magazine Projectfinal final
Shay Woods BA Hons
 
Beyond Copywriting (PresenTHINK 2015)
Teodora Petkova
 
nhận làm video quảng cáo 3d
theo757
 
Curriculum vitae
mahmoud talaat
 
Wind energy 2012 poland
FRACTAL GROUP
 
DB Systems Transmitter Deck
Kurt Ludwig
 
0514 matthew 1019 do not worry about what power point church sermon
PowerPoint_Sermons
 
Roof Coatings Presentation
Paul Hannam
 
Startups + Crowdfunding
Romagna Tech
 
2012 Budget Day Presentation
EmpowerLA
 
Yee San Su - Food Chain Reaction: A Global Food Security Game
SeriousGamesAssoc
 
Chuong 5a
Hoạt Hà Văn
 
Toan van diem moi luat doanh nghiep 2014
Hung Nguyen
 
Questionnaire
Alex McKiernan
 
Org. molecules pres.
rksteel
 
haftalik dusunce ozgurlugu bulteni_13.05.31_22
Düşünce Suçu!?na Karşı Girişim / Freedom for Freedom Of Expression
 
Ad

Similar to Busy Developer's Guide to Windows 8 HTML/JavaScript Apps (20)

PDF
HTML5 Can't Do That
Nathan Smith
 
PDF
Win j svsphonegap-damyan-petev-mihail-mateev
Mihail Mateev
 
PDF
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Heiko Behrens
 
PDF
openMIC barcamp 11.02.2010
Patrick Lauke
 
PDF
Thug: a new low-interaction honeyclient
Angelo Dell'Aera
 
PPTX
Windows Phone and Windows 8 application development
Christos Matskas
 
PPTX
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
St. Petersburg College
 
PPT
Intro to Android Programming
Peter van der Linden
 
KEY
webOS App by Example: Sorting Thoughts
Hendrik Ebel
 
PPT
1_Intro_toHTML.ppt
benjaminonum1
 
PDF
Empowering the "mobile web"
Chris Mills
 
PDF
Empowering the Mobile Web - Mills
Codemotion
 
PDF
Empowering the “Mobile Web” with Chris Mills
FITC
 
PPTX
Getting started with titanium
Naga Harish M
 
PDF
Enjoying the full stack - Frontend 2010
Christian Heilmann
 
PPTX
Claim Academy Intro to Programming
Alex Pearson
 
PDF
Lesson learned from 3 years with hybrid apps
Patrik Malmquist
 
PPT
Titanium Overview (Mobile March 2011)
Kevin Whinnery
 
PPTX
Front End Development | Introduction
JohnTaieb
 
PPTX
Getting started with Appcelerator Titanium
Techday7
 
HTML5 Can't Do That
Nathan Smith
 
Win j svsphonegap-damyan-petev-mihail-mateev
Mihail Mateev
 
Plattformübergreifende App-Entwicklung (ein Vergleich) - MobileTechCon 2010
Heiko Behrens
 
openMIC barcamp 11.02.2010
Patrick Lauke
 
Thug: a new low-interaction honeyclient
Angelo Dell'Aera
 
Windows Phone and Windows 8 application development
Christos Matskas
 
Building a Simple Mobile-optimized Web App Using the jQuery Mobile Framework
St. Petersburg College
 
Intro to Android Programming
Peter van der Linden
 
webOS App by Example: Sorting Thoughts
Hendrik Ebel
 
1_Intro_toHTML.ppt
benjaminonum1
 
Empowering the "mobile web"
Chris Mills
 
Empowering the Mobile Web - Mills
Codemotion
 
Empowering the “Mobile Web” with Chris Mills
FITC
 
Getting started with titanium
Naga Harish M
 
Enjoying the full stack - Frontend 2010
Christian Heilmann
 
Claim Academy Intro to Programming
Alex Pearson
 
Lesson learned from 3 years with hybrid apps
Patrik Malmquist
 
Titanium Overview (Mobile March 2011)
Kevin Whinnery
 
Front End Development | Introduction
JohnTaieb
 
Getting started with Appcelerator Titanium
Techday7
 
Ad

More from JAX London (20)

PDF
Everything I know about software in spaghetti bolognese: managing complexity
JAX London
 
PDF
Devops with the S for Sharing - Patrick Debois
JAX London
 
PDF
It's code but not as we know: Infrastructure as Code - Patrick Debois
JAX London
 
KEY
Locks? We Don't Need No Stinkin' Locks - Michael Barker
JAX London
 
PDF
Worse is better, for better or for worse - Kevlin Henney
JAX London
 
PDF
Java performance: What's the big deal? - Trisha Gee
JAX London
 
PDF
Clojure made-simple - John Stevenson
JAX London
 
PDF
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
JAX London
 
PDF
Play framework 2 : Peter Hilton
JAX London
 
PDF
Complexity theory and software development : Tim Berglund
JAX London
 
PDF
Why FLOSS is a Java developer's best friend: Dave Gruber
JAX London
 
PDF
Akka in Action: Heiko Seeburger
JAX London
 
PDF
NoSQL Smackdown 2012 : Tim Berglund
JAX London
 
PDF
Closures, the next "Big Thing" in Java: Russel Winder
JAX London
 
KEY
Java and the machine - Martijn Verburg and Kirk Pepperdine
JAX London
 
PDF
Mongo DB on the JVM - Brendan McAdams
JAX London
 
PDF
New opportunities for connected data - Ian Robinson
JAX London
 
PDF
HTML5 Websockets and Java - Arun Gupta
JAX London
 
PDF
The Big Data Con: Why Big Data is a Problem, not a Solution - Ian Plosker
JAX London
 
KEY
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
JAX London
 
Everything I know about software in spaghetti bolognese: managing complexity
JAX London
 
Devops with the S for Sharing - Patrick Debois
JAX London
 
It's code but not as we know: Infrastructure as Code - Patrick Debois
JAX London
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
JAX London
 
Worse is better, for better or for worse - Kevlin Henney
JAX London
 
Java performance: What's the big deal? - Trisha Gee
JAX London
 
Clojure made-simple - John Stevenson
JAX London
 
HTML alchemy: the secrets of mixing JavaScript and Java EE - Matthias Wessendorf
JAX London
 
Play framework 2 : Peter Hilton
JAX London
 
Complexity theory and software development : Tim Berglund
JAX London
 
Why FLOSS is a Java developer's best friend: Dave Gruber
JAX London
 
Akka in Action: Heiko Seeburger
JAX London
 
NoSQL Smackdown 2012 : Tim Berglund
JAX London
 
Closures, the next "Big Thing" in Java: Russel Winder
JAX London
 
Java and the machine - Martijn Verburg and Kirk Pepperdine
JAX London
 
Mongo DB on the JVM - Brendan McAdams
JAX London
 
New opportunities for connected data - Ian Robinson
JAX London
 
HTML5 Websockets and Java - Arun Gupta
JAX London
 
The Big Data Con: Why Big Data is a Problem, not a Solution - Ian Plosker
JAX London
 
Bluffers guide to elitist jargon - Martijn Verburg, Richard Warburton, James ...
JAX London
 

Busy Developer's Guide to Windows 8 HTML/JavaScript Apps

  • 1. Busy Developer's Guide to Windows 8 HTML/JavaScript Apps Ted Neward Neward & Associates http://www.tedneward.com | [email protected]
  • 2. Credentials Who is this guy? – Architectural Consultant, Neudesic Software – Principal, Architect, Consultant and Mentor ask me how I can help your project or your team – Microsoft MVP (F#, C#, Architect) – JSR 175, 277 Expert Group Member – Author Professional F# 2.0 (w/Erickson, et al; Wrox, 2010) Effective Enterprise Java (Addison-Wesley, 2004) C# In a Nutshell (w/Drayton, et all; OReilly, 2003) SSCLI Essentials (w/Stutz, et al; OReilly, 2003) Server-Based Java Programming (Manning, 2000) – Blog: http://blogs.tedneward.com – Papers: http://www.tedneward.com/writings
  • 3. Objectives Our goals... – to understand how to build a Windows 8 app in HTML/JavaScript – to understand why you want to do this – to understand why Microsoft wants you to do this – to understand where this fits in relation to .NET/C++/Web – to begin the path of deeper understanding
  • 4. Disclaimer Note that... – attending this talk will NOT make you an expert – I am also NOT an expert – Windows 8 hasn't shipped yet (technically) This talk will get you started, try to debunk some of the popular conspiracy theories, and put some strategic overview on the whole thing that's it
  • 5. Getting Started Writing an app for Windows 8 in HTML/JavaScript requires – Windows 8 (seriously) – Visual Studio 2012 (either Express or full-blown) http://msdn.microsoft.com/en-us/windows/apps/br229516 – Optionally, Microsoft samples and/or hands-on labs (HOL) – There are no (known) command-line tools to do this
  • 6. Hello World Once Win 8 and VS 2012 are installed – fire up the Hello World of Win8HTMLJS apps – File->New Project->JavaScript->Windows Store->Blank App •creates a single-page Metro HTML/JS App •first time, a "Developer License" dialog pops up; this is to obtain a crypto key for signing the app – hit "F5" and it will build and run on the local box (LocalMachine) you can also run it in the Simulator, which simulates tablets if you're not on one
  • 8. Concepts What just happened? – VS built a project out of HTML and CSS and JavaScript – the app was bundled up into a "package" (a zip file) – the app contains a "package.appxmanifest" file that contains app metadata – the app was signed with a crypto key and deployed to the local machine C:Program FilesWindowsApps (which is protected up the wazoo!)
  • 9. Concepts What just happened? – when executed, a host process (WWAHost.exe) fired up – the IE 10 "Trident" HTML/CSS engine displayed the HTML – the IE 10 "Chakra" JS engine executed the JS – the application runs in a sandbox with no user privileges
  • 10. Concepts Your "executable" application essentially isn't – it's a Web app running entirely on the local machine – it's a native app with access to the underlying machine – it's Frankenstein's monster! maybe we should call it "Ballmerstein's Monster"?
  • 11. Concepts Metro apps aren't quite like traditional desktop apps – think more of a "fusion" of web and desktop – with some mobile ideas thrown in As a result, UI approaches will need/want to be different – "Tiles" (shortcuts into your app's data or tasks) – "Live tiles" (representations of data easily seen) – "Chromelessness" (absence of window decorations) – "Charms" (toolbar off to the right of the screen) – "App Bars" (sort of like toolbars, but simpler/cleaner)
  • 12. Concepts WinRT – Windows Runtime API not to be confused with "Windows RT" (Windows on ARM) – essentially an API layer on top of the Windows kernel – provides O-O metadata similar to JVM/CLR runtimes – provides "projections" into different languages C#, VB, C++, and JavaScript (WinJS)
  • 13. Concepts Contracts – this is the new COM (sort of) programs advertise and consume contracts – essentially an IPC declaration mechanism – used for Search, drag and drop, app targets, and so on
  • 15. Code UI elements are defined in HTML – or can be added/manipulated later by DOM magic – all "basic" HTML controls are supported button, checkbox, drop-down list, email, file upload, hyperlink, listbox, text, password, progress, radiobutton, rich text, slider, uri, ... – WinJS also offers a few "custom" controls unique to Metro DatePicker, TimePicker, Rating, ToggleSwitch, Tooltip
  • 16. Code <body> • <h1 class="headerClass">Hello, world!</h1> • <div class="mainContent"> • <p>What's your name?</p> • <input id="nameInput" type="text" /> • <button id="helloButton">Say "Hello"</button> • <div id="greetingOutput"></div> • <label for="ratingControlDiv"> • Rate this greeting: • </label> • <div id="ratingControlDiv" data-win- control="WinJS.UI.Rating"></div> • <div id="ratingOutput"></div> • </div> •</body>
  • 17. Code UI styles are defined in CSS – Metro defines two parallel stylesheets for your use ui-light.css and ui-dark.css – of course, custom styling is always possible but until Metro gains widespread acceptance, resist Much of the intent is to do styling and UI theming in Blend – ... and frankly, that's not a programmer tool
  • 18. Code body { •} • •.headerClass { • margin-top: 45px; • margin-left: 120px; •} • •.mainContent { • margin-top: 31px; • margin-left: 120px; • margin-bottom: 50px; •} • •#greetingOutput { • height: 20px; • margin-bottom: 40px; •}
  • 19. Code UI events are handled in JavaScript – just as with Web, register a JS function with the event in question typically do this on app startup – and, of course, events can be registered/unregistered dynamically
  • 20. Code (function () { • "use strict"; • • // ... • • function buttonClickHandler(eventInfo) { • var userName = document.getElementById("nameInput").value; • var greetingString = "Hello, " + userName + "!"; • document.getElementById("greetingOutput").innerText = greetingString; • } • function ratingChanged(eventInfo) { • var ratingOutput = document.getElementById("ratingOutput"); • ratingOutput.innerText = eventInfo.detail.tentativeRating; • } •}
  • 21. Code (function () { • "use strict"; • • // ... • • app.onactivated = function (args) { • if (args.detail.kind === activation.ActivationKind.launch) { • // ... • args.setPromise(WinJS.UI.processAll().then(function completed() { • var ratingControlDiv = document.getElementById("ratingControlDiv"); • var ratingControl = ratingControlDiv.winControl; • ratingControl.addEventListener("change", ratingChanged, false); • var helloButton = document.getElementById("helloButton"); • helloButton.addEventListener("click", buttonClickHandler, false); • })); • } • }; • • // ... •}
  • 23. Analysis Web applications have dominated the industry for a decade – HTML/CSS/Javascript skills are ubiquitous – Web concepts are emerging into desktop applications – some users can't tell the difference between the two – more and more data is living in "the cloud" Dropbox, SkyDrive, Evernote, iTunes, Amazon, ...
  • 24. Analysis Conspiracies! Everywhere! – Is this Microsoft's attempt to kill the Web? – Is this Microsoft's attempt to kill HTML 5? – Is this Microsoft trying to "embrace, extend, extinguish"? – Is this the beginning of the end of the world as we know it?
  • 25. Analysis Microsoft wants people to write apps for their platform – this is hardly surprising, new, or unacceptable – part of this means making the platform easy to program for – part of this means making it "easy" for people to port code frankly I don't see this as being a big play Microsoft wants people to buy apps on their platform – this means reducing the barrier to entry (AppStore) – this means making them easier to obtain (Internet) – this means putting some "borders" around apps (security, safety, etc), and this is easier with interpreted code than
  • 26. Summary Windows 8 apps are interesting to a certain crowd – this doesn't mean everybody will want to build one – in fact, if you're not a historic Microsoft developer, you probably won't – the concept of using HTML+Javascript to build a "native" app is interesting