Windows 8 for Existing .NET Developers
description
Transcript of Windows 8 for Existing .NET Developers
![Page 1: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/1.jpg)
Windows 8 for Existing.NET DevelopersTim HeuerProgram ManagerWindows Developer ExperienceMicrosoft Corporation
![Page 2: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/2.jpg)
Some UI platforms I’ve worked on…• Access/VBA• Delphi• VB3->6 (+ASP)• “Cool”• VB.NET• Palm UI• Windows Forms• WAP• ASP.NET (WebForms)• SharePoint (WebParts)
• WAP• Windows Forms• SharePoint (WebParts)• ASP.NET (WebForms)• Windows Presentation
Foundation (WPF)• Silverlight• Windows Phone• Windows 8
![Page 3: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/3.jpg)
The ones I liked…• Access/VBA• Delphi• VB3->6 (+ASP)• “Cool”• VB.NET• Palm UI• Windows Forms• WAP• ASP.NET (WebForms)• SharePoint (WebParts)
• WAP• Windows Forms• SharePoint (WebParts)• ASP.NET (WebForms)• Windows Presentation
Foundation (WPF)• Silverlight• Windows Phone• Windows 8
![Page 4: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/4.jpg)
.NET
![Page 5: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/5.jpg)
![Page 6: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/6.jpg)
Windows 8
![Page 7: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/7.jpg)
You already have the skills to build Windows 8 apps with C# and VB
![Page 8: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/8.jpg)
Using the Windows Runtime feels natural and familiar from C# and Visual Basic
![Page 9: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/9.jpg)
.NET Framework and WinRT .NET (and C# and Visual Basic) is alive and well Windows Runtime (Windows.*) native APIs projected
![Page 10: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/10.jpg)
[DllImport(“kernel32.dll”)]
![Page 11: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/11.jpg)
[DllImport("avicap32.dll", EntryPoint="capCreateCaptureWindow")]static extern int capCreateCaptureWindow( string lpszWindowName, int dwStyle, int X, int Y, int nWidth, int nHeight, int hwndParent, int nID);
[DllImport("avicap32.dll")] static extern bool capGetDriverDescription( int wDriverIndex, [MarshalAs(UnmanagedType.LPTStr)] ref string lpszName, int cbName, [MarshalAs(UnmanagedType.LPTStr)] ref string lpszVer, int cbVer);
// more and more of the same
The C# code you have to write today…
![Page 12: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/12.jpg)
The C# code you get to write on Windows 8
using Windows.Media.Capture;
var ui = new CameraCaptureUI();ui.PhotoSettings.CroppedAspectRatio = new Size(4, 3);
var file = await ui.CaptureFileAsync(CameraCaptureUIMode.Photo);
if (file != null) { var bitmap = new BitmapImage() ; bitmap.SetSource(await file.OpenAsync(FileAccessMode.Read)); Photo.Source = bitmap;}
![Page 13: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/13.jpg)
.NET Framework and WinRT .NET (and C# and Visual Basic) is alive and well Windows Runtime (Windows.*) native APIs projected Can use C#/VB to create WinRT components Async everywhere: await/async keywords are your friends
Reference assemblies for .NET Framework Core Surface area specific for targeting Windows Runtime apps Redundancy removed when matching WinRT API exists
Portable Class Library projects Shared code at source and binary level Great for framework developers when possible
![Page 14: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/14.jpg)
Extension methods bridge the gap between Windows Runtime and managed code
![Page 15: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/15.jpg)
Streams Code SampleFileOpenPicker picker = new FileOpenPicker();picker.FileTypeFilter.Add("*");
StorageFile file = await picker.PickSingleFileAsync();
Windows.Storage.Streams.IInputStream inputStream = await file.OpenReadAsync();
System.IO.Stream stream = inputStream.AsStreamForRead();System.IO.StreamReader reader = new StreamReader(stream);
string contents = reader.ReadToEnd();
![Page 16: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/16.jpg)
Understanding WinRT and Windows 8 for .NET Programmers
Podcast with Immo Landwerth, PM on the .NET Framework team
http://aka.ms/winrtnetfx
![Page 17: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/17.jpg)
Development Patterns Code-behind approaches
Simpler apps Event-driven Coupling UI to logic
Model-View-ViewModel (MVVM) Separation of concerns More easily testable (TDD) Binding-driven No Behavior support currently
![Page 18: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/18.jpg)
Using existing .NET patterns in Windows 8 apps
demo
![Page 19: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/19.jpg)
In Windows 8, your .NET skills extend to C++ and JavaScript developers!
![Page 20: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/20.jpg)
You can build Windows Runtime components that project into C++ or JavaScriptby following a few simple rules
![Page 21: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/21.jpg)
Only the public types and members in your WinRT components need to follow these simple rules
![Page 22: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/22.jpg)
API signatures must use only Windows Runtime typesStructs can only have public data fields
All types must be sealed (except XAML controls)Only supports system provided generic types
![Page 23: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/23.jpg)
Visual Studio has built-in support for building Windows Runtime component projects using C#/VB
![Page 24: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/24.jpg)
Building Windows Runtime Components in C#demo
![Page 25: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/25.jpg)
Windows.UI.Xaml
![Page 26: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/26.jpg)
Windows.UI.Xaml Same XAML primitives Optimized for touch experiences New UI Controls, familiar XAML structure
GridView/ListView SemanticZoom AppBar
Animation Library ThemeAnimations and Transitions
Extensibility Large 3rd party ecosystem still thriving
![Page 27: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/27.jpg)
Tour around some new XAMLdemo
![Page 28: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/28.jpg)
Resources and Localization Common resource APIs for WinRT No strongly-typed class generation from resource file
Folder- or file-based convention RESW == RESX in schema
Windows 8 only supports String resources XAML leverages a ‘merge’ technique for markup
String- and file-based resources compiled into PRI Visual Studio indexes all files for you
![Page 29: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/29.jpg)
Resources and Localizationdemo
![Page 30: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/30.jpg)
Data for Apps WCF endpoints
Add Service Reference still works! OData
In RP: Ultimate only, future will be NuGet/standalone Anonymous type binding Local Storage
IsolatedStorage Windows.Storage ESE (Jet) SQLite
![Page 31: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/31.jpg)
Accessing DataBinding DataDebugging databinding
demo
![Page 32: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/32.jpg)
Summary and More… You can use .NET for Apps and more Consider Portable Libraries as a method for code-share targeting
Create WinRT components when desired/needed
You can leverage your XAML/.NET skills to be successful quickly in the Windows Store!
![Page 33: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/33.jpg)
You already have the skills to build Windows 8 apps with C# and VB
![Page 34: Windows 8 for Existing .NET Developers](https://reader035.fdocuments.us/reader035/viewer/2022062502/56813a9b550346895da29506/html5/thumbnails/34.jpg)