Thinking about the future
with Windows 8
SILVERLIGHTSHOW.NET WEBINARS SERIES
GILL CLEEREN, 29th November 2011
www.snowball...
About myself...
• Gill Cleeren
• .NET Architect @Ordina (www.ordina.be)
• Microsoft Regional Director
• Silverlight MVP
• ...
Warning!
I have a cold...
Luckily for you, this is not contagious
over a webinar 
Some practical stuff
• Ask questions through Q&A window
– We’ll answer them after the session or by personal
mail
• A link...
XAML: a 4-day Training in London, UK
• Master XAML, Silverlight, WPF, WP7 and Windows
8!
• February 20th  24th,
London, U...
Agenda
• What did we see at BUILD?
– Hello Windows 8
• What is WinRT?
– How do we write Metro apps
• Leveraging tomorrow w...
CHRISTMAS EVE IN SEPTEMBER
What did we get at BUILD?
Before BUILD...
We had...
– Desktop apps with .NET
• WPF
– Web apps with .NET
• ASP.NET/ASP.NET MVC
• Silverlight
At BUILD, we got...
• Steven Sinofsky annoucing hardware
– Including Windows 8 running on ARM
At BUILD, some got...
It’s possible to buy this device now with Windows 7,
costs around $1200
Donations welcome on paypal:...
At BUILD, we got...
• Windows 8
– And everyone can get it from dev.windows.com
At BUILD, we also got...
• “Metro apps”
• Windows Runtime (aka WinRT)
• Visual Studio Express 2011
– Only for building Met...
DEMO
Hello future
aka “The demo of Windows 8”
WINDOWS RUNTIME (WINRT)
Opening Windows to managed developers
The Windows Runtime is the solid, efficient
foundation
for building great Metro style apps,
giving you access to Windows t...
Windows 8
Windows Kernel Services
JavaScript
(Chakra)
C/C++ C#, VB
Metro style Apps
Communication
& Data
Application Model...
Devices
SensorsGeolocation Portable NFC
Communications & Data
Contracts
XML
Web
SMSNetworking
Notifications
Local & Cloud ...
Windows Runtime Architecture
Windows
Metadata &
Namespace
Language Projection
Windows Core
Windows Runtime Core
XAML Stora...
Why WinRT was born...
• We had Win32 APIs for a long time
• It wasn’t a good idea to just give these to
developers to buil...
So WinRT is...
• A huge improvements in the developer experience for
the Windows developer
– IntelliSense, debugging...
• ...
DEMO
Hello World in WinRT in Visual Studio 2011 Express using HTML
Windows Runtime Architecture
Windows
Metadata &
Namespace
Language Projection
Windows Core
Windows Runtime Core
XAML Stora...
All new: Windows Metadata
• We all know assembly metadata
– ILDASM can open it for you
– Use extensively in CLR to know wh...
Windows Metadata
• Concise, complete description of the Windows
Runtime
• Generated natively from C++ or C#/VB Compiler
• ...
The Windows Namespace
• Windows.* Runtime objects are in a
simple, unified, hierarchical namespace
• Great IntelliSense an...
The WinRT API
• Windows.ApplicationModel
• Windows.Data
• Windows.Devices
• Windows.Foundation
• Windows.Globalization
• W...
DEMO
Same app but now using C#
Windows Runtime Architecture
Windows
Metadata &
Namespace
Language Projection
Windows Core
Windows Runtime Core
XAML Stora...
Language Projections
• C++
• .NET
• JavaScript
Windows Tailored Profile
• System.Collections
• System.ComponentModel
• System.Diagnostics
• System.Dynamic
• System.Globa...
What’s missing in the Windows
Tailored Profile
• Enterprise Development
– ASP.NET
– Console
– DirectoryServices
– Windows ...
.NET for Metro style apps
.NET for
Metro style
apps
.NET 4.5 Windows Phone 7
# of assemblies 15* 120 22
# of namespaces 60...
LEVERAGING TOMORROW WHAT WE
KNOW TODAY
C# for Metro style apps
Windows has always provided compelling
capabilities for developers to build upon
Windows has not always made it
straightfo...
DllImport "avicap32.dll"
"capCreateCaptureWindow"
static extern int
string int
int int int int
int int
DllImport "avicap32...
Traditional
Windows API
Your
Managed
Code
Manually
Generated
Interop Code
There’s a hole somewhere...
On Windows 8, this will now be…
using Windows.Media.Capture;
var new CameraCaptureUI
new Size
var await
CameraCaptureUIMod...
Traditional
Windows API
Your
Managed
Code
Windows
Runtime
The hole is gone 
We already have the skills to build Metro
style applications using C#
(and VB as well)
C# and Visual Basic influenced
the Windows Runtime
Windows Runtime is designed
to be used from object-oriented languages
like C# and Visual Basic
Windows Runtime metadata files use an
updated version of .NET’s metadata format
DEMO
Using ILDASM for Windows Metadata files
Windows Runtime includes a XAML based
framework for Metro style apps
(we’ll see that in more detail further)
Many of the Windows Runtime design
guidelines
came from the .NET design guidelines
Windows Runtime was expressly designed
to work well with C# and Visual Basic
Using the Windows Runtime feels natural
and familiar
from C# and Visual Basic
DEMO
Using the Windows Runtime from C#
Most WinRT types map directly to
C#/VB
var new CameraCaptureUI
new Size
var await
CameraCaptureUIMode
if
var new BitmapIma...
Almost everything maps directly between the
Windows Runtime and .NET
• Primitives
(strings, numbers, etc)
• Interfaces
• E...
Most differences between Windows
Runtime and
.NET are hidden from the managed
developer
Exceptions from HRESULTs
try
var new CameraCaptureUI
new
catch Exception
//Exception handling code
ComException
Accessing a WinRT Collection from C#
var new FileOpenPicker
var await
foreach StorageFile in
System.Collections.Generic.IR...
LEVERAGING TOMORROW WHAT WE
KNOW TODAY
XAML for Metro style apps
Focusing now on…
Windows Kernel Services
JavaScript
(Chakra)
C/C++ C#, VB
Metro style Apps
Communication
& Data
Applicatio...
Moving from current XAML to WinRT
• It’s all XAML
– What you know, remains valid
• You as a Silverlight/WPF/WP7 developer ...
Concepts that carry forward
• Same control model as we have today in Silverlight and
WPF
– Many controls can just be copie...
DEMO
Silverlight app to Metro app
What do you get as extra?
• WinRT (duh)
– APIs are aimed at building Metro style apps only
• Metro style, look and feel
• ...
Input is now touch-driven
• Things will still work with a mouse though
DEMO
Metro-style UI
Running an application
Tile -> Splash Screen -> App (App UI)
Controls for Metro-style apps
ListView and GridView
are the new kids
• Windows 8 “list controls”
• Optimized for touch input
• Support Windows 8 selecti...
DEMO
Using a GridView
And more new controls…
• MediaPlayer
• ToggleSwitch
• ProgressRing
• FlipView
• JumpViewer
– Semantic Zoom Control
– Suppo...
DEMO
Using a FlipView
The ApplicationBar,
another new control
• Used to place commands
– “Inherited” from Windows Phone 7
• Persistent, light di...
DEMO
Using the ApplicationBar
SOME MORE CONCEPTS
Screen resolution and orientation
• Screen resolution:
– Current Resolution:
• Window.Current.Bounds
– Event:
• Window.Cur...
Detecting Layout
• An application should support more than just
the default view
• Can detect when the view changes to rea...
DEMO
Using Snapped View
Integrating with Windows
• An application can integrated with
Windows and other applications
through the “charms”
– Search...
The “share” charm
• A source app will share something
• Target app will get the shared data
• Between the two, some common...
Specifying capabilities
• Just like Windows Phone 7, an application
needs to specify what it needs in the
Application Mani...
The lifetime of a Metro app
• Only the foreground app is Active
• All other background apps are Suspended
– They get a not...
Summary
• A new world is opening up
• As a developer now
– We need to learn some new things
– Most of our current knowledg...
Q&A
THANKS!
Thinking about the future
with Windows 8
SILVERLIGHTSHOW.NET WEBINARS SERIES
GILL CLEEREN, 29th November 2011
www.snowball...
Upcoming SlideShare
Loading in...5
×

An introduction to windows 8 development

550

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
550
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

An introduction to windows 8 development

  1. 1. Thinking about the future with Windows 8 SILVERLIGHTSHOW.NET WEBINARS SERIES GILL CLEEREN, 29th November 2011 www.snowball.be - gill.cleeren@ordina.be - @gillcleeren
  2. 2. About myself... • Gill Cleeren • .NET Architect @Ordina (www.ordina.be) • Microsoft Regional Director • Silverlight MVP • Speaker (TechDays, TechEd, DevReach, DevDays, NDC Norway, Telerik Usergroup tour Sweden, UK and Scotland...) • Visug user group lead (www.visug.be) • Author (Silverlight 4 Data and services cookbook, 15 MVPs book), SilverlightShow articles – And finishing Silverlight 5 cookbook now! • Blog: www.snowball.be • Email: gill@snowball.be • Twitter: @gillcleeren
  3. 3. Warning! I have a cold... Luckily for you, this is not contagious over a webinar 
  4. 4. Some practical stuff • Ask questions through Q&A window – We’ll answer them after the session or by personal mail • A link to the video recording will be sent to you
  5. 5. XAML: a 4-day Training in London, UK • Master XAML, Silverlight, WPF, WP7 and Windows 8! • February 20th  24th, London, UK • Organized by CompletIT and Ordina • More info via trainings@completit.com www.silverlightshow.net/trainings/training_london0212.aspx
  6. 6. Agenda • What did we see at BUILD? – Hello Windows 8 • What is WinRT? – How do we write Metro apps • Leveraging tomorrow what we know today – C# and .NET in Metro-style apps – XAML for Metro-style apps
  7. 7. CHRISTMAS EVE IN SEPTEMBER What did we get at BUILD?
  8. 8. Before BUILD... We had... – Desktop apps with .NET • WPF – Web apps with .NET • ASP.NET/ASP.NET MVC • Silverlight
  9. 9. At BUILD, we got... • Steven Sinofsky annoucing hardware – Including Windows 8 running on ARM
  10. 10. At BUILD, some got... It’s possible to buy this device now with Windows 7, costs around $1200 Donations welcome on paypal: gill@snowball.be ;-)
  11. 11. At BUILD, we got... • Windows 8 – And everyone can get it from dev.windows.com
  12. 12. At BUILD, we also got... • “Metro apps” • Windows Runtime (aka WinRT) • Visual Studio Express 2011 – Only for building Metro-style apps • .NET 4.5 • Visual Studio 11 Developer Preview – That’s “The Big One” • And more sessions than you can shake a stick at!
  13. 13. DEMO Hello future aka “The demo of Windows 8”
  14. 14. WINDOWS RUNTIME (WINRT) Opening Windows to managed developers
  15. 15. The Windows Runtime is the solid, efficient foundation for building great Metro style apps, giving you access to Windows the language of your choice
  16. 16. Windows 8 Windows Kernel Services JavaScript (Chakra) C/C++ C#, VB Metro style Apps Communication & Data Application Model Devices & Printing Windows Runtime APIs Graphics & Media XAML HTML / CSS HTML JavaScript C C++ C# VB Desktop Apps Win32 .NET SL Internet Explorer
  17. 17. Devices SensorsGeolocation Portable NFC Communications & Data Contracts XML Web SMSNetworking Notifications Local & Cloud Storage Streams Background Transfer User Interface HTML5/CSS XAML DirectX Controls Input Accessibility Printing Data Binding TilesSVG Fundamentals Application Services Authentication Cryptography Globalization Memory Management Threading/Timers Media Visual Effects Playback PlayToCapture
  18. 18. Windows Runtime Architecture Windows Metadata & Namespace Language Projection Windows Core Windows Runtime Core XAML Storage …Network UI Pickers MediaControls Metro style app Runtime Broker Language Support (CLR, WinJS, CRT ) Web Host (HTML, CSS, JavaScript)
  19. 19. Why WinRT was born... • We had Win32 APIs for a long time • It wasn’t a good idea to just give these to developers to build Windows 8 apps – Developers want IntelliSense, debugging... – Developers want to use the language of their choice  Microsoft doesn’t force the developer in using a certain technology or language
  20. 20. So WinRT is... • A huge improvements in the developer experience for the Windows developer – IntelliSense, debugging... • Fast and fluid (aka responsive) – Async is the new buzzword – No synchronous IO calls • Natural and familiar – New APIs – Language of choice • Based on apps – Apps can “communicate” through defined app-to-app contracts – Apps should keep running no matter what the OS version
  21. 21. DEMO Hello World in WinRT in Visual Studio 2011 Express using HTML
  22. 22. Windows Runtime Architecture Windows Metadata & Namespace Language Projection Windows Core Windows Runtime Core XAML Storage …Network UI Pickers MediaControls Metro style app Runtime Broker Language Support (CLR, WinJS, CRT) Web Host (HTML, CSS, Java Script)
  23. 23. All new: Windows Metadata • We all know assembly metadata – ILDASM can open it for you – Use extensively in CLR to know what an assembly can do for you • Windows Metadata is the same concept but native
  24. 24. Windows Metadata • Concise, complete description of the Windows Runtime • Generated natively from C++ or C#/VB Compiler • Efficient binary format derived CLI Metadata – Same structures, different meanings • Rich enough to allow multi-language projection generation • Full IntelliSense on statically known information – Same experience for managed developers as we have today
  25. 25. The Windows Namespace • Windows.* Runtime objects are in a simple, unified, hierarchical namespace • Great IntelliSense and browsing in Visual Studio • One clear type for each function
  26. 26. The WinRT API • Windows.ApplicationModel • Windows.Data • Windows.Devices • Windows.Foundation • Windows.Globalization • Windows.Graphics • Windows.Management • Windows.Media • Windows.Networking • Windows.Security • Windows.Storage • Windows.System • Windows.UI[.Xaml] • Windows.Web * Top level namespaces only
  27. 27. DEMO Same app but now using C#
  28. 28. Windows Runtime Architecture Windows Metadata & Namespace Language Projection Windows Core Windows Runtime Core XAML Storage …Network UI Pickers MediaControls Metro style app Runtime Broker Language Support (CLR, WinJS, CRT) Web Host (HTML, CSS, JavaScript)
  29. 29. Language Projections • C++ • .NET • JavaScript
  30. 30. Windows Tailored Profile • System.Collections • System.ComponentModel • System.Diagnostics • System.Dynamic • System.Globalization • System.IO • System.Linq • System.Net • System.Numerics • System.Reflection • System.Resources • System.Runtime • System.Security • System.ServiceModel • System.Text • System.Threading • System.Xml
  31. 31. What’s missing in the Windows Tailored Profile • Enterprise Development – ASP.NET – Console – DirectoryServices – Windows Forms – WPF – WF • Dangerous, obsolete, legacy • Removed duplicates • Removed badly designed APIs
  32. 32. .NET for Metro style apps .NET for Metro style apps .NET 4.5 Windows Phone 7 # of assemblies 15* 120 22 # of namespaces 60 400 88 # of types ~1K ~14K ~2K # of members ~10K ~110K ~14K * Refers to implementation assemblies, not reference assemblies.
  33. 33. LEVERAGING TOMORROW WHAT WE KNOW TODAY C# for Metro style apps
  34. 34. Windows has always provided compelling capabilities for developers to build upon Windows has not always made it straightforward for you to use these capabilities from C# or VB
  35. 35. DllImport "avicap32.dll" "capCreateCaptureWindow" static extern int string int int int int int int int DllImport "avicap32.dll" static extern bool int MarshalAs UnmanagedType ref string int MarshalAs UnmanagedType ref string int // more and more of the same A small, easy sample of Win32 code 
  36. 36. Traditional Windows API Your Managed Code Manually Generated Interop Code There’s a hole somewhere...
  37. 37. On Windows 8, this will now be… using Windows.Media.Capture; var new CameraCaptureUI new Size var await CameraCaptureUIMode if var new BitmapImage await FileAccessMode
  38. 38. Traditional Windows API Your Managed Code Windows Runtime The hole is gone 
  39. 39. We already have the skills to build Metro style applications using C# (and VB as well)
  40. 40. C# and Visual Basic influenced the Windows Runtime
  41. 41. Windows Runtime is designed to be used from object-oriented languages like C# and Visual Basic
  42. 42. Windows Runtime metadata files use an updated version of .NET’s metadata format
  43. 43. DEMO Using ILDASM for Windows Metadata files
  44. 44. Windows Runtime includes a XAML based framework for Metro style apps (we’ll see that in more detail further)
  45. 45. Many of the Windows Runtime design guidelines came from the .NET design guidelines
  46. 46. Windows Runtime was expressly designed to work well with C# and Visual Basic
  47. 47. Using the Windows Runtime feels natural and familiar from C# and Visual Basic
  48. 48. DEMO Using the Windows Runtime from C#
  49. 49. Most WinRT types map directly to C#/VB var new CameraCaptureUI new Size var await CameraCaptureUIMode if var new BitmapImage await FileAccessMode
  50. 50. Almost everything maps directly between the Windows Runtime and .NET • Primitives (strings, numbers, etc) • Interfaces • Enums • Structs • Delegates • Delegates • Constructors • Static Members • Properties • Events • Methods
  51. 51. Most differences between Windows Runtime and .NET are hidden from the managed developer
  52. 52. Exceptions from HRESULTs try var new CameraCaptureUI new catch Exception //Exception handling code ComException
  53. 53. Accessing a WinRT Collection from C# var new FileOpenPicker var await foreach StorageFile in System.Collections.Generic.IReadOnlyList <Windows.Storage.StorageFile> Windows.Foundation.Collections.IVectorView <Windows.Storage.StorageFile>
  54. 54. LEVERAGING TOMORROW WHAT WE KNOW TODAY XAML for Metro style apps
  55. 55. Focusing now on… Windows Kernel Services JavaScript (Chakra) C/C++ C#, VB Metro style Apps Communication & Data Application Model Devices & Printing Windows Runtime APIs Graphics & Media XAML HTML / CSS HTML JavaScript C C++ C# VB Desktop Apps Win32 .NET SL Internet Explorer
  56. 56. Moving from current XAML to WinRT • It’s all XAML – What you know, remains valid • You as a Silverlight/WPF/WP7 developer can now add Windows 8 developer to your business card! • If you know C++, you can now integrate that with XAML as well
  57. 57. Concepts that carry forward • Same control model as we have today in Silverlight and WPF – Many controls can just be copied to WinRT – Same thing, but now native • Concepts: – Data binding, change notification – Styling – Animations – Visual State Manager – Already seen: C#, VB.NET and C++ • Some things may not be natively supported though • XAML is now exposed as a WinRT API – No wrappers!
  58. 58. DEMO Silverlight app to Metro app
  59. 59. What do you get as extra? • WinRT (duh) – APIs are aimed at building Metro style apps only • Metro style, look and feel • Touch is now fully supported, next to mouse input – Unified under “PointerXXX” • Metro style controls • New base namespace – Windows.UI.Xaml • Windows Store
  60. 60. Input is now touch-driven • Things will still work with a mouse though
  61. 61. DEMO Metro-style UI
  62. 62. Running an application Tile -> Splash Screen -> App (App UI)
  63. 63. Controls for Metro-style apps
  64. 64. ListView and GridView are the new kids • Windows 8 “list controls” • Optimized for touch input • Support Windows 8 selection models • UI and Data Virtualization • Built in grouping
  65. 65. DEMO Using a GridView
  66. 66. And more new controls… • MediaPlayer • ToggleSwitch • ProgressRing • FlipView • JumpViewer – Semantic Zoom Control – Supports 2 Levels
  67. 67. DEMO Using a FlipView
  68. 68. The ApplicationBar, another new control • Used to place commands – “Inherited” from Windows Phone 7 • Persistent, light dismiss or time dismiss • Swipe in from top/bottom to display
  69. 69. DEMO Using the ApplicationBar
  70. 70. SOME MORE CONCEPTS
  71. 71. Screen resolution and orientation • Screen resolution: – Current Resolution: • Window.Current.Bounds – Event: • Window.Current.SizeChanged • Orientation – Current (Namespace: Windows.Graphics.Display) • DisplayProperties.CurrentOrientation – Event: • DisplayProperties.OrientationChanged
  72. 72. Detecting Layout • An application should support more than just the default view • Can detect when the view changes to react by showing another view – ApplicationLayout.GetForCurrentView().LayoutChanged
  73. 73. DEMO Using Snapped View
  74. 74. Integrating with Windows • An application can integrated with Windows and other applications through the “charms” – Search – Share – Devices – Settings – Picker • A charm is like a contract, a way of letting applications talk without knowing each other
  75. 75. The “share” charm • A source app will share something • Target app will get the shared data • Between the two, some common formats are provided for data interchange • Should your app share? – Yes, most apps that create something should be sharing data • Should an app be a target? – If your app does things like publishing, storing or transforming data, then yes. – IM, translator, uploader...
  76. 76. Specifying capabilities • Just like Windows Phone 7, an application needs to specify what it needs in the Application Manifest – Declare the intent towards system resources
  77. 77. The lifetime of a Metro app • Only the foreground app is Active • All other background apps are Suspended – They get a notification about it • While suspended, apps may be Terminated – They won’t be notified about this
  78. 78. Summary • A new world is opening up • As a developer now – We need to learn some new things – Most of our current knowledge is carried over – Our investments are safe (Silverlight, HTML, C++...)
  79. 79. Q&A
  80. 80. THANKS!
  81. 81. Thinking about the future with Windows 8 SILVERLIGHTSHOW.NET WEBINARS SERIES GILL CLEEREN, 29th November 2011 www.snowball.be - gill.cleeren@ordina.be - @gillcleeren
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×