Introduction to Windows Runtime (Winrt)

Total Page:16

File Type:pdf, Size:1020Kb

Introduction to Windows Runtime (Winrt) Introduction to Windows Runtime (WinRT) Raffaele Rialdi @raffaeler [email protected] http://www.iamraf.net Tailored User Experience full screen different resolutions Immersive Multiple live tiles form factors Engaging secure, and Alive trustable Inspiring Confidence Metro Connected Multitasking use live data Touch-first fast and fluid small devices Current problems • No marketplace: how can you trust an application? • Admin privilege is required to install most Apps • Interoperability is difficult (PInvoke / COM) –Memory and Performance costs are high –Accessing OS API can be tough • Mixing native and managed language is hard • "C" APIs lifecycle is error-prone (CreateFile … CloseHandle) • I/Os are blocking (network, storage, …) • No standards for App to App communication • Search, Tweets, Facebook posts, … Windows Runtime Architecture Metro apps Desktop apps Win MFC XAML DirectX HTML WPF SL HTML form DX Language Projections .NET / Js / C++ .NET / Js / C++ Filtered access BCL / libraries to WinRT Windows Runtime APIs and Services UI Controls Storage Media Win32 Win32 Windows Metadata XAML Pickers Network … Runtime Broker Windows Runtime Core Windows Kernel Services What is the Windows Runtime? • It's the evolution of the Component Object Model (COM) • The infrastructure reuse old concepts like apartments, IUnknown and addref/release • IDispatch is gone, IInspectable is the new base interface • New support for Events (no connection points) and static types • Totally different Type System (no Variants, no BSTRs, …) • WinRT use ECMA-335 (.net Framework) metadata • WinRT and CLR talks the same "language" • No marshalling gotchas It's not a replacement for the CLR • CLR is required for managed languages infrastructure WinRT Type System • Basic types - bool, integers, floats, enum, guid, type, object • Strings - binary compatibile with .NET (string) and C++ STL (wstring) - are immutable - are value-types (non-nullable) • There are Reference Types - All types that implement WinRT interfaces • There are Value Types - All the others … for example arrays and structures - Structures can't declare reference (deep/shallow copy problem) • "Complex" types - Vector (collection) and Map (dictionary) - Vector<T> implements IObservableVector<T> that is mapped to INotifyCollectionChanged Language Projections Projections map WinRT types to the projected language • Different casing standards - Javascript (camelCase), C++ and .NET (PascalCase) • Developers need to understand edge-cases - Javascript standard only support IEEE-754 (floats). This means the max integer is 53 bit maximum • Few types are defined both in WinRT and .NET - They are treated as 'special' and seen as equivalent - INotifyPropertyChanged, INotifyCollectionChanged, … • Some .NET types cannot be mapped transparently - Streams, Buffers, Tasks are mapped via extension methods • I expect third party projections too - Java?, Python?, D language?, Delphi?, … Contracts : «XXI century's clipboard» • A standard way to "talk" to other Apps or OS services • A sort of publisher / subscriber pattern • Main Contracts available: • Search, Share, Protocol, PlayTo, App to App picking • WinRT activate Apps that expose Contracts • Running Apps is done via Launch Contract • Tiles are NOT shortcuts! • Apps use the Manifest to opt-in for Contracts • They receive parameters in the activation method Application Activation Explorer.exe Activate Activation RPCSS System Application.exe DCOM Class Launch Catalog Asynchronous by design Problem: Apps should never block UI thread Solution: API that may take more than 50ms are only async Special objects wraps Asynchronous Operations • In WinRT they implement IAsyncOperation<T> • AsTask extension method is used to convert it to a Task<T> • In .NET these objects are Task<T> • AsAsyncOperation extension method to obtain an IAsyncOperation<T> Tomorrow C# 5.0 have new async/await keywords Hall 4 - 10:45 Javascript and C++ can use "promises" pattern The sandbox Application Package Application code Manifest Marketplace Security Broker Proxy WinRT Libraries Win32 White-listed Windows Kernel Services Developing with WinRT • XAML UI for .NET and C++ • XAML / DirectX can share surfaces • DirectX inside a XAML control • Large virtual DirectX surface in conjunction with XAML • High Performance DirectX drawing, XAML overlapped • Custom WinRT components are easy to write • i.e. exposing C# or C++ code to Javascript or vice-versa • Custom components are private to the App (no RegSvr32) • Cross language calls are cheap • No more P-Invokes! • As fast as a vtable call • Desktop Apps can use a WinRT APIs subset • CLR have an additional weapon: "Portable Class Library" • A DLL with code that run on Metro, desktop, SL, … • As it's IL code, it runs as 32 or 64 bits as well Metro profile for .NET development Metro profile was a good opportunity to clean BCL • Removed: Xml DOM, WebClient, Threads, … • Moved Reflection in System.Reflection • GetTypeInfo extension method to access reflection classes Metro Fx 4.5 WP7 # assemblies 15 120 22 # namespaces 60 400 88 # types ~1'000 ~14'000 ~2'000 # members ~10'000 ~110'000 ~14'000 What else is not in the Metro profile? • APIs that are already in WinRT (Storage, Sockets, Network, etc.) • Server libraries like WCF, Asp.net, … • APIs that could bypass the sandbox • System.Data, Remoting, AppDomain, Private Reflection, … Developer thoughts • No need to elevate (UAC) a Metro App • Admin Apps will run in the old desktop • Storage • Apps can access only locations specified by manifest • Users can pick (via UI) a file that is stored elsewhere • No local db APIs at the moment • Media and Sensors • Easy access to cameras, accelerometer, … • Require user consent (requested via manifest) • Network • Great library to ease oAuth authentication • Flexible HttpClient replace WebClient • Websockets support • Dig into the APIs and discover it by yourself! Takeaways • WinRT is a great step in Windows evolution • Exposes native OS services in a pure OOP way • Closes the gap between managed and native languages • Developers can use their current knowledge to create Apps from small devices to classic PCs • Marketplace is an opportunity for developers and a sweet experience for end-users • Think about performance/battery issues • It's Framework.NET best friend Windows 8 Cheat Sheet C Charms Bar O Locks device orientation H Share charm Tiles to the left / right (.) K Connect charm Split left/right I Settings charm Temporarily peek at the desktop Cycle apps / Q Search pane F File Search Cycle input language & keyboard W Settings Search Narrator Z V Cycles through toasts Application Bar Tools for WinRT WinRT.codeplex.com (more to come …) Don’t forget to submit your feedback and win a great Nokia smartphone and Kindle e-reader! .
Recommended publications
  • Microsoft Patches Were Evaluated up to and Including CVE-2020-1587
    Honeywell Commercial Security 2700 Blankenbaker Pkwy, Suite 150 Louisville, KY 40299 Phone: 1-502-297-5700 Phone: 1-800-323-4576 Fax: 1-502-666-7021 https://www.security.honeywell.com The purpose of this document is to identify the patches that have been delivered by Microsoft® which have been tested against Pro-Watch. All the below listed patches have been tested against the current shipping version of Pro-Watch with no adverse effects being observed. Microsoft Patches were evaluated up to and including CVE-2020-1587. Patches not listed below are not applicable to a Pro-Watch system. 2020 – Microsoft® Patches Tested with Pro-Watch CVE-2020-1587 Windows Ancillary Function Driver for WinSock Elevation of Privilege Vulnerability CVE-2020-1584 Windows dnsrslvr.dll Elevation of Privilege Vulnerability CVE-2020-1579 Windows Function Discovery SSDP Provider Elevation of Privilege Vulnerability CVE-2020-1578 Windows Kernel Information Disclosure Vulnerability CVE-2020-1577 DirectWrite Information Disclosure Vulnerability CVE-2020-1570 Scripting Engine Memory Corruption Vulnerability CVE-2020-1569 Microsoft Edge Memory Corruption Vulnerability CVE-2020-1568 Microsoft Edge PDF Remote Code Execution Vulnerability CVE-2020-1567 MSHTML Engine Remote Code Execution Vulnerability CVE-2020-1566 Windows Kernel Elevation of Privilege Vulnerability CVE-2020-1565 Windows Elevation of Privilege Vulnerability CVE-2020-1564 Jet Database Engine Remote Code Execution Vulnerability CVE-2020-1562 Microsoft Graphics Components Remote Code Execution Vulnerability
    [Show full text]
  • NET Technology Guide for Business Applications // 1
    .NET Technology Guide for Business Applications Professional Cesar de la Torre David Carmona Visit us today at microsoftpressstore.com • Hundreds of titles available – Books, eBooks, and online resources from industry experts • Free U.S. shipping • eBooks in multiple formats – Read on your computer, tablet, mobile device, or e-reader • Print & eBook Best Value Packs • eBook Deal of the Week – Save up to 60% on featured titles • Newsletter and special offers – Be the first to hear about new releases, specials, and more • Register your book – Get additional benefits Hear about it first. Get the latest news from Microsoft Press sent to your inbox. • New and upcoming books • Special offers • Free eBooks • How-to articles Sign up today at MicrosoftPressStore.com/Newsletters Wait, there’s more... Find more great content and resources in the Microsoft Press Guided Tours app. The Microsoft Press Guided Tours app provides insightful tours by Microsoft Press authors of new and evolving Microsoft technologies. • Share text, code, illustrations, videos, and links with peers and friends • Create and manage highlights and notes • View resources and download code samples • Tag resources as favorites or to read later • Watch explanatory videos • Copy complete code listings and scripts Download from Windows Store Free ebooks From technical overviews to drilldowns on special topics, get free ebooks from Microsoft Press at: www.microsoftvirtualacademy.com/ebooks Download your free ebooks in PDF, EPUB, and/or Mobi for Kindle formats. Look for other great resources at Microsoft Virtual Academy, where you can learn new skills and help advance your career with free Microsoft training delivered by experts.
    [Show full text]
  • Preview Windows 10 Development Tutorial
    Windows 10 Apps Development About the Tutorial Welcome to Windows 10 tutorial. This tutorial is designed for people who want to learn how to develop apps meant for Windows 10. After completing it, you will have a better understating of Windows apps and what you can do with Windows applications using XAML and C#. Audience This tutorial has been prepared for anyone who has a basic knowledge of XAML, C#, and Visual Studio and has an urge to develop apps for mobile or desktop. Prerequisites Before you start proceeding with this tutorial, we are assuming that you have a good understanding of the basics of XAML, C#, and Visual Studio. If you are not well aware of these concepts, then we will suggest you to go through our short tutorials on these topics. Copyright & Disclaimer Copyright 2018 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected] i Windows 10 Apps Development Table of Contents About the Tutorial ............................................................................................
    [Show full text]
  • NET Core Succinctly by Giancarlo Lelli Foreword by Daniel Jebaraj
    1 .NET Core Succinctly By Giancarlo Lelli Foreword by Daniel Jebaraj 2 Copyright © 2016 by Syncfusion, Inc. 2501 Aerial Center Parkway Suite 200 Morrisville, NC 27560 USA All rights reserved. Important licensing information. Please read. This book is available for free download from www.syncfusion.com on completion of a registration form. If you obtained this book from any other source, please register and download a free copy from www.syncfusion.com. This book is licensed for reading only if obtained from www.syncfusion.com. This book is licensed strictly for personal or educational use. Redistribution in any form is prohibited. The authors and copyright holders provide absolutely no warranty for any information provided. The authors and copyright holders shall not be liable for any claim, damages, or any other liability arising from, out of, or in connection with the information in this book. Please do not use this book if the listed terms are unacceptable. Use shall constitute acceptance of the terms listed. SYNCFUSION, SUCCINCTLY, DELIVER INNOVATION WITH EASE, ESSENTIAL, and .NET ESSENTIALS are the registered trademarks of Syncfusion, Inc. Technical Reviewer: Gavin Lanata Copy Editor: Courtney Wright Acquisitions Coordinator: Hillary Bowling, online marketing manager, Syncfusion, Inc. Proofreader: Tres Watkins, content development manager, Syncfusion, Inc. 3 Table of Contents Preface ...................................................................................................................................... 8 Introduction
    [Show full text]
  • Programming Windows Store Apps with HTML, CSS, and Javascript
    spine = 2.07” Programming Windows Sixth Edition Writing Windows 8 Apps with C# and XAML Windows Programming Writing Windows 8 Apps with C# and XAML About the Sixth Edition Like Windows itself, this classic book has been reimagined for • Completely rewritten for Windows 8 Programming a new world of programming and user experiences. Guided • Focuses on creating apps using C#, XAML, and the Windows Runtime by developer legend Charles Petzold, Programming Windows, Sixth Edition teaches how to use your existing C# skills with • Expertly teaches essential skills in Part 1: Elementals XAML and the Windows Runtime to create full-screen, touch Rounds out your Windows 8 education apps for Windows 8. • Windows Store in Part 2: Specialties • Provides code samples in both C# Master the elementals and C++ • Create and initialize objects with code or XAML • Handle user-input events such as taps Apps with HTML, • Manage and experiment with dynamic layout • Visually redefine a control’s appearance • Create Windows Runtime libraries • Use MVVM for data binding and commanding • Work with asynchronous methods; write your own About the Author CSS, and JavaScript • Animate transitions and create 2D and 3D effects Charles Petzold has been writing • Manage resolution, scaling, and navigation about Windows programming for 25 years. A Windows Pioneer Extend your skills and apps Award winner, Petzold is author Second Edition of the classic Programming Windows, the • Handle pointer, manipulation, tap, and hold events widely acclaimed Code: The Hidden • Manipulate bitmaps and rich text Language of Computer Hardware and • Work with GPS and orientation sensors Software, Programming Windows Phone 7, and more than a dozen other books.
    [Show full text]
  • ACUCOBOL-GT Runtime Manual V8.1
    Runtime Manual ACUCOBOL-GT® Version 8.1 Micro Focus 9920 Pacific Heights Blvd. San Diego, CA 92121 858.795.1900 © Copyright Micro Focus 1998-2008. All rights reserved. Acucorp, ACUCOBOL-GT, Acu4GL, AcuBench, AcuConnect, AcuServer, AcuSQL, AcuXDBC, AcuXUI, extend, and “The new face of COBOL” are registered trademarks or registered service marks of Micro Focus. “COBOL Virtual Machine” is a trademark of Micro Focus. Acu4GL is protected by U.S. patent 5,640,550, and AcuXDBC is protected by U.S. patent 5,826,076. Microsoft and Windows are registered trademarks of Microsoft Corporation in the United States and/or other countries. UNIX is a registered trademark of the Open Group in the United States and other countries. Solaris is a trademark of Sun Microsystems, Inc., in the United States and other countries. Other brand and product names are trademarks or registered trademarks of their respective holders. Microsoft, ActiveX, Windows, Win32, and Windows NT are registered trademarks of Microsoft Corporation in the United States and/or other countries. HP-UX is a trademark of the Hewlett-Packard Company. DB2 Connect is a trademark, and IBM, AIX, CICS, DB2, Informix, MQSeries, AS/400, OS/390, PowerPC, RS/6000, TXSeries, WebSphere, pSeries, and zSeries are registered trademarks of IBM in the United States. UNIX is a registered trademark of the Open Group in the United States and other countries. Oracle is a registered trademark, and Oracle 8i, Oracle9i, Pro*C, Pro*COBOL, and SQL*Plus are trademarks or registered trademarks of Oracle Corporation. Btrieve is a registered trademark of Pervasive Software Inc.
    [Show full text]
  • Intouch Hmi - Machine Edition®
    PRODUCT DATASHEET INTOUCH HMI - MACHINE EDITION® InTouch Machine Edition is a highly scalable, flexible HMI/ SCADA software designed to provide everything from advanced HMI applications to small-footprint embedded devices. The rich feature set enables users to create intuitive, secure, and highly maintainable HMI /SCADA applications for any industry. InTouch Machine Edition is ideal for OEMs, Machine Builders, Value Added Resellers, Discrete HMI/SCADA, or Process HMI/SCADA. aveva.com PRODUCT DATASHEET INTOUCH HMI - MACHINE EDITION® NEW in InTouch HMI - Machine Edition® InTouch HMI - Machine Edition® Features: Enhancements for Studio Mobile Access Thin Alarms: Send online alarms or reports using Clients (supported by HTML5) multi-media formats like PDF. Alarms are real-time and historical; log data in binary format or to any y Improved contextual information database. Use remote notification to send alarms y Support for Proprietary and Binary Alarm History right to your inbox, printer, or smartphone. Custom Alarm fields allow you to customize up to 10 y Alarm Control object enhancement supports additional fields to the alarm history. Alarm and Events Custom Fields Animation: Take command over graphics in a Support for importing Custom Widgets from user friendly and intuitive interface. Paste images, a library and even rotate dynamically using custom rotation New Custom Widgets (installed with points. Fill bar graphs with color, or adjust the scale software) enabled of objects with easy-to-use configuration. Other animations include ‘command’ (for touch, keyboard y TreeView and mouse interaction), hyperlink, text data link, y Calendar color, resize, transparency, and position. y PieChart Business Intelligence: Transform raw data into y Web Browser meaningful information.
    [Show full text]
  • Beginning Windows 8 Data Development
    For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author ...............................................................................................................xiii About the Technical Reviewer ............................................................................................ xv Acknowledgments ............................................................................................................ xvii ■ Chapter 1: Introduction to Windows 8 Development .........................................................1 ■ Chapter 2: HTML5 and JavaScript Apps with MVVM and Knockout ................................13 ■ Chapter 3: Windows 8 Modern App Data Access Options ...............................................29 ■ Chapter 4: Local Data Access: I: IndexedDB ....................................................................35 ■ Chapter 5: Local Data Access I: JET API and Application Data .......................................61 ■ Chapter 6: Local Data Access III: SQLite ..........................................................................89 ■ Chapter 7: ASP.NET Web API ..........................................................................................123 ■ Chapter 8: WCF Services ...............................................................................................147 ■ Chapter 9: Windows Azure Mobile Services ..................................................................179
    [Show full text]
  • Copyrighted Material
    PART I ➤ CHAPTER 1 : .NET Application Architectures ➤ CHAPTER 2 : Core C# ➤ CHAPTER 3 : Objects and Types ➤ CHAPTER 4 : Inheritance ➤ CHAPTER 5 : Managed and Unmanaged Resources ➤ CHAPTER 6 : Generics ➤ CHAPTER 7 : Arrays and Tuples ➤ CHAPTER 8 : Operators and Casts ➤ CHAPTER 9 : Delegates, Lambdas, and Events ➤ CHAPTER 10 : Strings and Regular Expressions ➤ CHAPTERCOPYRIGHTED 11 : Collections MATERIAL ➤ CHAPTER 12 : Special Collections ➤ CHAPTER 13 : Language Integrated Query ➤ CHAPTER 14 : Errors and Exceptions ➤ CHAPTER 15 : Asynchronous Programming ➤ CHAPTER 16 : Refl ection, Metadata, and Dynamic Programming 1 WHAT’S IN THIS CHAPTER? ➤ Reviewing the history of .NET ➤ Understanding differences between .NET Framework 4.6 and .NET Core 1.0 ➤ Assemblies and NuGet Packages ➤ The Common Language Runtime ➤ Features of the Windows Runtime ➤ Programming Hello, World! ➤ Universal Windows Platform ➤ Technologies for creating Windows Apps ➤ Technologies for creating Web Apps WROX.COM CODE DOWNLOADS FOR THIS CHAPTER The wrox.com code downloads for this chapter are found at www.wrox.com/go/professionalcsharp6 on the Download Code tab. The code for this chapter is divided into the following major examples: ➤ DotnetHelloWorld ➤ HelloWorldApp (.NET Core) CHOOSING YOUR TECHNOLOGIES In recent years, .NET has become a huge ecosystem for creating any kind of applications on the Windows platform. With .NET you can create Windows apps, web services, web applications, and apps for the Microsoft Phone. The newest release of .NET is a big change from the last version—maybe the biggest change to .NET since its invention. Much of the .NET code has become open-source code, and you can create applications for other platforms as well. The new version of .NET (.NET Core) and NuGet packages allow Microsoft to provide faster update cycles for delivering new features.
    [Show full text]
  • Mdn 1012Win8dg.Pdf
    Untitled-2 1 8/30/12 11:54 AM THE MICROSOFT JOURNAL FOR DEVELOPERS OCTOBER 15, 2012 VOL 27 NO 10A magazine Special Issue Windows 8 Reimagining App Development COLUMNS with the Windows Runtime EDITOR’S NOTE Jason Olson ........................................................................................ 20 All Eyes on Windows 8 Michael Desmond, page 4 Under the Hood with .NET and the Windows Runtime MODERN APPS The Windows Store App Lifecycle Shawn Farkas ...................................................................................... 28 Rachel Appel, page 6 Windows Runtime Components in a .NET World WINDOWS AZURE INSIDER Jeremy Likness ................................................................................... 34 Windows 8 and Windows Azure: Convergence in the Cloud Writing Silverlight and WPF Apps Bruno Terkaly and with Windows Runtime XAML in Mind Ricardo Villalobos, page 12 Pete Brown ......................................................................................... 42 Using the MVVM Pattern in Windows 8 Laurent Bugnion ................................................................................. 48 Introducing C++/CX and XAML Andy Rich ........................................................................................... 56 Porting Desktop Applications to the Windows Runtime Diego Dagum ..................................................................................... 64 Managing Memory in Windows Store Apps David Tepper .....................................................................................
    [Show full text]
  • Universal Windows Apps
    Universal Windows Apps Version: 1.0 Introduction Federal Office for Information Security Post Box 20 03 63 D-53133 Bonn Phone: +49 22899 9582-0 E-Mail: [email protected] Internet: https://www.bsi.bund.de © Federal Office for Information Security 2020 2 Federal Office for Information Security Table of Contents 1 Introduction ................................................................................................................................................................................... 5 1.1 Zusammenfassung................................................................................................................................................................. 5 1.2 Executive Summary .............................................................................................................................................................. 6 1.3 Concepts and Terms ............................................................................................................................................................. 7 2 Technical Analysis of Functionalities .................................................................................................................................. 9 2.1 AppContainer processes ...................................................................................................................................................... 9 2.2 Integrity verification .........................................................................................................................................................
    [Show full text]
  • Microsoft Game Development Guide September 2017 Edition
    Your Game. Any Screen. Y X B A Microsoft Game Development Guide September 2017 Edition Microsoft Azure Windows Mixed Reality Table of contents Introduction to game development for the Universal Windows Platform (UWP) 3 Game development resources 4 Concept and planning 10 Prototype and design 21 Production 29 Submitting and publishing your game 33 Game lifecycle management 35 Adding Xbox Live to your game 37 Additional resources 40 Dream.Build.Play 41 Welcome to the Windows 10 Game Development Guide! This guide provides an end-to-end collection of the resources and information you’ll need to develop a Universal Windows Platform (UWP) game. Introduction to game development for the Universal Windows Platform (UWP) When you create a Windows 10 game, you have the opportunity to reach millions of players worldwide across phone, PC, and Xbox One. With Xbox on Windows, Xbox Live, cross-device multiplayer, an amazing gaming community, and powerful new features like the Universal Windows Platform (UWP) and DirectX 12, Windows 10 games thrill players of all ages and genres. The new Universal Windows Platform (UWP) delivers compatibility for your game across Windows 10 devices with a common API for phone, PC, and Xbox One, along with tools and options to tailor your game to each device experience. This guide provides an end-to-end collection of information and resources that will help you as you develop your game. The sections are organized according to the stages of game development, so you’ll know where to look for information when you need it. To get started, the Game development resources section provides a high-level survey of documentation, programs, and other resources that are helpful when creating a game.
    [Show full text]