MSIX Training Evolving Enhancing Desktop Apps
Evolving and enhancing Win32 applications to maximize on the features available on Windows 10 is a key objective for Microsoft’s MSIX team. Part of the process in achieving this involves working to bring the modern application and desktop application platforms closer together. The eventual goal will be the creation of one unique app platform that brings modern features that are ready to use for desktop applications while at the same time leveraging already existing powerful components from the desktop with the UWP platform.
Enhancing your desktop app
So the question is why would you possibly modify your code to enhance an application? Well, you may be interested in leveraging on the new UWP APIs or XAML Controls that are built into the system. Leveraging and evaluation of Windows Machine Learning may also be a factor, as well as the possible need for Ink powered experiences. Also, .NET Core 3 is a fantastic choice because it is capable of leveraging every kind of UWP API on the platform. Plenty of other benefits as well since you will be able to use all of the features without re-writing your code for the existing Win32 application.
Enhancing your desktop assets - .NET Core 3
With version 3, Windows workload has been added in such a way as to create Windows form and WPF applications in Windows on the .NET Core 3. This provides a good way to be able to utilize all Windows APIs and controls. Migration to the .NET Core 3 will provide you with all these benefits as well as being able to run applications side by side. What this allows is for you to target one specific version of the .NET Core 3 and embed the runtime in your package if you want to. The new .NET Core framework has the advantage of being more agile and thus offers more functionality.
Moving your desktop forward
There are two ways to enhance your app with UWP features.
The first one involves adding UI. The Universal Windows Platform comes with a lot of new controls that are optimized for touch, inking, accessibility, and so on. A new feature called XAML Islands allows you to alter these controls within your existing Windows application.
All this is possible because of a new set of APIs known as XAML Bridge Source WinRT API that communicate with the HWND. And to simplify things for developers within the Windows community toolkit, controls will be provided to alter the WPF controls inside the WPF and Windows form applications. These controls will come in two kinds, control wrappers, and custom controls.
The other way to leverage the universal windows platform with your desktop application is by using Windows 10 features. The Windows features are exposed through UWP APIs: devices and sensors (i.e BluetoothLE), XAML, Ink, Media, Speech/Cortana, Mixed Reality/3D, Machine Learning, and new input modes such as eye-tracking.
Background tasks
This is an independent Windows Runtime component containing code that can be executed at any stage of the application’s lifestyle. A background task will be connected to two concepts which are triggers and conditions. Triggers are the events that kick the code execution and conditions consist of one or more prerequisites that need to be satisfied before the task is executed. It’s great for use in a Win32 app because it is CPU, memory, and battery-friendly as well as allowing you to easily handle complex events like time zone changes.
Registration and firing
The background task or app service is inside the MSIX package. On installation of the application, we register in Windows the background task so that the system knows that there is a background task and also becomes aware of the trigger to launch the task.
App services
App services are essentially background tasks that are exposed to the app. It’s local services for the app and can be consumed by different applications. It’s also to be found in the manifest. In the enterprise scenario, you can think of using line-of-business applications. All of these applications would need services like the creation of pdfs or invoices, so all the applications can utilize the app services provided by the package.
Calling an app service
Initially, an application will try and connect to the app service using the name of the app service provided and the entire package family name of the application containing the app service. If the connection is successful, value sets can then be exchanged. Work which will be done by the app service can then be invoked.
Enhancing UWP applications
The best of both worlds
MSIX packaging allows you to enhance native UWP applications in addition to packaging existing desktop applications. And thanks to the desktop extension, you can start a Win32 process from a UWP application. This provides you with a great way of reusing existing investments or implementing scenarios that are not yet supported by UWP.
App service as a communication channel
Within your MSIX package, you can include a UWP application and a Win32 process. And with the use of an app service, you can handle communication between the two services. For it to function, the UWP application sends a request to the Win32 process through the app service. The Win32 process then prepares the data which it then sends back to the UWP application through the app service, which creates a two-way communication channel.
The bottom line
The benefits that can be derived from the use of MSIX can only serve to vastly improve the services that developers are able to offer to their various clients. With the various enhancements availed on the platform seeing to it that your operations are simplified by the elimination of needless time-consuming tasks, Microsoft has a package whose impact will only increase with time. MSIX is setting a new gold standard for app packaging and optimization, and with input from various stakeholders helping to create the perfect solution, this platform is quickly becoming the only one you will need.