WinRT Revealed(解密) - Introduction to WinRT

来源:互联网 发布:linux 显示日志级别 编辑:程序博客网 时间:2024/06/11 19:44

While Windows will continue to provide an environment for the current methods of development, Microsoft is introducing a new environment. This one is focused on
apps rather than on programs, and on mobile devices with touch interfaces rather than on desktops and laptops.

What Is WinRT?

MSDN describes WinRT as “a straightforward set of APIs used to build Metro style apps.” It is a new framework or programming model for building Metro software. This is how Windows 8 exposes the system services to the apps installed and running on the machine. This includes the display. UI development uses Extensible Application Markup Language (XAML) components, which are part of WinRT. These APIs are available to developers in many supported languages: C#,VB,C++,JS

For more discussion on WinRT diagram, visit http://dougseven. com/2011/09/15/a-bad-picture-is-worth-a-thousand-long-discussions.

 

WinRT is not .NET (nor a subset thereof ): The new Windows Runtime is not a subset of nything. It is a new framework and the sole provider of all Windows system services to etro style apps. It is not a part of .NET, but it is used by the .NET languages, as well as the other supported languages.

WinRT is not based on Win32: WinRT replaces Win32 for Metro development. This is a new execution layer, and the programming model is very different from Win32. Don’t worry, though, because Win32 is still included in Windows 8. Thus, legacy software will continue to work.

WinRT is not cross-platform: Windows uses the Windows Runtime to expose system services. When your app uses the WinRT APIs, it does so to access those Windows services. Therefore, WinRT is not used in any other context. It is used in Windows apps or Windows devices.

Note WinRT is written in C++ and has been designed as object-oriented. The support of reflection provides efficiency to dynamic languages such as JavaScript.

 

The WinRT APIs are native, meaning they are written in C++ and compiled to binaries run against the core Windows services. There is no Common Language Runtime (CLR) or other type of interpreter in the middle.

Every WinRT component has a WinMD file associated with it. This file contains all of the information needed by the operating system and other software to access this component. Microsoft uses the same format (ECMA-335) for this new type of file that it uses in the .NET framework.

Note The WinMD files can be found in the Windows\System32\WinMetaData folder. They are all stored here by Windows 8. These files can be inspected using the ILDASM tool.

WinRT works with native code, the CLR, and dynamic code.

 

When it comes to developing the user experience for Windows 8, developers have two choices: XAML or HTML5. XAML is used by .NET and C++ developers, while HTML5 pairs with JavaScript.XAML controls are actually part of WinRT. Windows Forms and WPF controls are based on Win32, so they will not run in the Metro space. WinRT includes all new controls. Developers using C++ will now use XAML to build the UI for apps. Silverlight and WPF developers will carry forward their knowledge into a familiar design experience.XAML is a nice markup language for developing the UI for an application. Many developers have certainly found themselves building the UI by writing the XAML by hand. Most developers prefer tools, and Microsoft delivers. Expression Blend has been around for many years as a designer tool for building the UI and generating the XAML for further development.

The thought of an HTML UI for a “desktop” experience is new and interesting. This is not web development. This is PC development. Developers with HTML and CSS3 skills can bring what they already know to Windows app development. JavaScript directly uses WinRT, so no new syntax or language needs to be introduced. To make the jump to the Metro design a bit easier, Microsoft offers JavaScript and CSS for use in your projects. WinRT apps using HTML will not run in a browser. They are meant for the Windows 8 experience only. The idea of using HTML and CSS3 together with JavaScript to build a clean and fast app without struggling against the issues introduced by the browser environment is a nice thought indeed.

We are quick to uninstall apps with too much lag time. Having to wait more than a few seconds for apps on our smartphones to respond tempts us to buy new devices altogether. Microsoft understands this and has designed Windows Runtime with performance in mind. Microsoft set the threshold very low. Any call into WinRT that takes longer than 50ms is asynchronous by default. That is 1/20th of a second. Anything that takes longer than that runs asynchronously.

 

 

原创粉丝点击