Remember Windows 8? Microsoft is still trying to reunify the API it split for the touchy OS’s benefit


Old meets new in WinRT API Packs

A Windows Forms app running on .NET Core and calling the UWP API

A Windows Forms app running on .NET Core and calling the UWP API

Microsoft has released “WinRT API Packs” for Windows desktop developers, letting you call on platform functions previously restricted to UWP apps, as well as a preview Windows Forms designer for .NET Core 3.0 desktop applications.

There is a lot to parse here. The world may be trying to forget Windows 8, but it marked a change in direction for Windows desktop development that is still significant today. Windows 8, released in 2012, introduced the Windows Runtime, or WinRT, which aimed to provide a secure, touch-friendly, app store-oriented application platform alongside the familiar Win32/Win64 platform.

Microsoft soon started back-pedalling as the new platform failed to win adoption. Windows 10 in 2015 restored the desktop as the primary user interface, but in the meantime the developer division had obediently made many modern API functions WinRT-specific. Microsoft transitioned WinRT to UWP (Universal Windows Platform), retaining some of the WinRT concepts, but with the idea of running on Windows desktop, phone, Xbox and HoloLens.

Much of the rationale behind UWP disappeared when Windows Phone died, leaving Xamarin (Windows, iOS, Android and Mac) the closest thing Microsoft has to a universal developer framework. Microsoft still offers UWP as an option, but in the majority of cases there is little advantage, and some disadvantage, when building a desktop application for Windows.

That leaves the question of what to do about those WinRT APIs. The new WinRT API pack, now generally available, is a package you can add to desktop applications that makes those APIs available, covering areas such as geolocation, AI (including speech recognition), maps, sensors and more. While the ability to call WinRT APIs from desktop apps is not new, it is now easier since the package handles all the necessary contract files and assembly references.

READ  Unity and Improbable’s beef gets spicy and strange in dueling blog posts

There are still complications. One is that some UWP APIs require what Microsoft calls “packaged apps”. This means you have to wrap the application in an MSIX installer package for them to work. Packaging gives the app a system identity used for permissions and more. Details of which APIs work are here. The Windows API therefore remains untidy as developers continue to pick up the pieces of the failure of Windows 8 and Windows Phone.

Another issue is that UWP APIs, naturally, do not work on Windows 7. While this used to be a deal breaker, it is not so much today, with Windows 7 going out of support in January 2020. Another big deal for Microsoft platform developers is the transition from the Windows-only .NET Framework to the cross-platform and open source .NET Core. Version 3.0, just released, adds support for desktop applications using WPF (Windows Presentation Framework) and Windows Forms. Full Visual Studio support is lagging, though, and a visual designer for Windows Forms with .NET Core has only just hit preview.

This Windows Forms designer has been completely rewritten. The complication is that Visual Studio itself uses .NET Framework, not Core. Microsoft has written a new bridging process, WinFormsSurface.exe, which communicates between the designer and the main part of Visual Studio.

The consequence of this trickery, and the differences between the two varieties of .NET, is that this remains “an early preview with many features still to be implemented”, according to the release notes.

You can use this with the WinRT API pack and it was easy to run up a quick sample calling the geolocation API.

READ  Gorilla Technology raises $15 million for real-time video analytics

Why is Microsoft bothering with Windows Forms? The reason is that the company has yet to improve on it for quick and easy desktop development, even though WPF is far superior for scaling, visual transitions and more.

Does desktop development still matter? Looking around here at Microsoft’s Future Decoded event in London, you would think not. AI and cloud dominate, and for cross-platform on mobile devices you still need Xamarin, or an alternative framework such as Google’s Flutter.

However, the reality in business is that many of us still spend much of our time bashing PC keyboards and for as long as that remains true, you can expect Windows desktop development to remain important. ®

Sponsored:
Serverless Computing London – 6-8 Nov 2019



READ SOURCE

LEAVE A REPLY

Please enter your comment!
Please enter your name here