Metro app meets Windows 10. A Microsoft win? Maybe after a little improvement

Hands on with the preview tools for the UAP

Windows 10 Universal Apps

First Look Microsoft has released preview tools for the Windows 10 Universal App Platform (UAP), giving developers their first opportunity to try and build new-style Windows apps.

The tools, which you can find here, require the latest tech preview of Visual Studio 2015, as well as the preview of Windows 10 itself, so it is preview on preview on preview: not something for a production machine.

Documentation is currently both sketchy and confusing, thanks to Microsoft’s decision to re-purpose the name “Universal App”, already used for a Windows 8.1 project type that targets multiple platforms using shared code. You may have to trawl through these videos to get a detailed overview of the new platform.

It is worth noting that you do not have to use a Universal App to target Windows 10. It is still Windows, and Win32 projects both still work, with the advantage that they also run on Windows 7 and 8.

What is the difference between a new and old Universal App? Aside from incremental improvements, the key change is that a UAP project is a single project that runs on all supported platforms, which will include Windows 10 PCs, tablets, phones, Xbox One and Windows 10 IoT (Internet of Things).

Previously, a Universal App included multiple projects, one for shared code, and another for each supported platform, and you would build separate apps per platform.

The Windows Core platform

The Windows Core platform

In order to achieve this level of compatibility, Microsoft has factored out a “Windows Core” which is common to all platforms. There are still plenty of device-specific features though, which you can target by referencing “Extension SDKs”, such as for Windows Desktop or Windows Mobile (yes, it is called Windows Mobile Extension SDK in the preview tools, suggesting that this old name may return).

If you use an Extension SDK, the referenced API will only work on that platform, but a stub API exists on the other platforms that does nothing. It is down to the developer to write code to detect whether it is present, using functions such as IsTypePresent or IsEventPresent.

Conditional compilation with #if still works, but it is discouraged since it breaks the UAP concept, taking you back to the old approach of separate builds for each device.

Another piece of the puzzle is what Microsoft calls the Adaptive UX, where you create a single user interface that adapts to the device. It is a similar approach to what on the web is called a Responsive UI, a web page that adapts itself to the display size and works on everything from mobile devices to desktop displays.

An Adaptive UX does not come for free, though; the developer has to consider different display or window sizes and write “Adaptive Triggers”, which change control properties according to the size of the display.

Creating an Adaptive UX is easier than it was, thanks to a new layout control called the RelativePanel, which lets you position child controls either relative to the panel, or relative to each other. You can say, for example, that you want a heading centred at the top, and an input box below the heading aligned to its left edge.

Like Metro in Windows 8 (also known as Store apps), a Universal App runs on top of the Windows Runtime (WinRT), a sandboxed environment that is also amenable to touch control. There are some useful enhancements to the WinRT platform in this release, including:

  • Drag and drop support between apps and the Windows desktop, important for desktop integration
  • App Services, a message-based API which lets one app call into a background task run by another app and obtain a result
  • Shared storage: one app can pass a token to another app to enable it to open a shared file
  • Support for the open source AllJoyn framework for IoT apps
  • 3D transforms for graphical apps and effects
  • WebView control based on the new “Project Spartan” engine for better standards support
  • New Map control and services, so you easily overlay your own user interface elements on a map
  • New Calendar control which is also used by the Universal App version of Outlook
  • This is not an exhaustive list and there is more to come

Sponsored: Minds Mastering Machines - Call for papers now open

Biting the hand that feeds IT © 1998–2018