Microsoft Adds UWP Features To Exisiting PC Software

Microsoft has announced the Desktop Bridge features which will enable you to use exciting Universal Windows Platform (UWP) features, along with capabilities which were earlier unavailable to the existing PC software.

In the summer of 2016, Microsoft released Windows 10 Anniversary Update, and alongside this, the company went on to make an announcement of the Windows Store supporting apps built with the Desktop Bridge technology.
 
However, now, Microsoft has announced the Desktop Bridge features which will enable you to use exciting Universal Windows Platform (UWP) features, along with the capabilities which were earlier unavailable to the existing PC software. The four examples of adding such features with complete source code are now available on GitHub, accompanying the corresponding apps which are also available in the Windows Store.
 
Microsoft states,
 
“The corresponding apps are also available in the Windows Store, so you can start exploring them on Windows 10 PCs without a development environment.”
 
The company has picked a different desktop application technology for each of the samples so as to further emphasize that the Desktop Bridge is applicable to all PC software. The samples call into Windows 10 UWP APIs using the techniques.
 
Adding a UWP XAML user experience
 
In the very first example provided by Microsoft,  they are extending a Visual Basic 6 application to use the UWP XAML Map control so as to visualize the location information of a database application. The sample also uses UWP APIs to pop up the toast notifications.
 
 
Image Source: blogs.windows.com
 
AppxManifest.xml
 
You will now be able to add a UWP component to the package, which will provide you with the XAML UI. In order to facilitate the activation of the modern component from the existing application, you will need to define a protocol extension in the manifest. Moreover, it is important for you to notice the two capabilities which Microsoft has gone on to declare. They are:
  • ‘runFullTrust’ to keep the VB6 code running at the same level of trust as before the Desktop Bridge conversion
  • ‘internetClient’ for the Map control to download map data from the internet.
Code Snippets
 
In order to protocol-activate the UWP view from the VB6 application, the company has gone on to invoke the LaunchUriAsync UWP API by wrapping it into a VB6-callable interop function ((‘LaunchMap’) and pass in the latitude and longitude as parameters. For more information, check the official Microsoft Blog.
 
Exposing an UWP App Service
 
In the second example, we see Microsoft extending a WinForms data application that exposes an App Service so as to provide other apps controlled access to its database, even if the WinForms app is not running.
 
 
Image Source: blogs.windows.com
 
AppxManifest.xml
 
The entry point here is the Windows Forms application that the company has packaged using the Desktop Bridge. Now, you will be able to add a UWP component (implemented in a Windows Runtime component called ‘MyAppService.dll’) to the package, which provides the App Service implementation.
 
Code Snippet
 
In the App Service implementation, you will need to validate and handle requests from other applications that request access to the database. For more information, check the official blog.
 
Adding a UWP background task
 
In this example, Microsoft is extending an MFC application so as to receive raw push notifications from a server application, regardless of whether the client software is running or not. If the application is running, then it will go on to receive the notification event and process the payload within the application process. However, if it is not running, a background task will be triggered to handle the payload.
 
 
Image Source: blogs.windows.com
 
AppxManifest.xml
 
Alongside the main MFC application, Microsoft is declaring a background task type “pushNotification”. For more information, check the official Microsoft blog.
 
Code Snippet
 
The code which the company is subscribing to is to get notified via an event (in-proc) and background task (out-of-proc) whenever the server application sends a raw push notification to the application instance.
 
Microsoft states,
 
“With UWP and Windows 10, applications can take advantage of several exciting new features to increase their user engagement. With the Desktop Bridge platform and tooling enhancements, existing PC software can now be part of the UWP ecosystem and take advantage of the same set of new platform features and operating system capabilities.”