Windows 10: Changing Paradigms

windows10-evolutionWindows 10 is the main discussion topic in the online development communities. This new operating system that is currently in the technical preview (and available through the Microsoft insider program) is a milestone in the platform unification journey that Microsoft embarked upon with starting with Windows Phone and Windows 8 operating systems. With Windows 10, developers and users are introduced to one development kit, one store, one application and one binary distribution package.

Introducing Windows Core

With Windows 10, developers are introduced to the new Windows Core concept. Windows Core is the refactored common core of Windows. It is the common set of APIs, a common infrastructure, which gives a, for the first time, truly binary compatibility across different platforms.

Up until Windows 10, a lot of the operating systems shared lots of commonality. In essence, most features were re-written from scratch for different platforms by separate development teams. Windows 8 was the first attempt to create a unified core with the so-called windows 8 kernel. The Windows CE kernel that was used for Windows Phone 7 was finally replaced with the Windows 8 kernel on Windows Phone 8. Xbox platform with the same kernel joined the unified platform with the release of Xbox One.

However, even though the kernels were the same, the implementation still differed on certain features which led to the Universal App Concept. The core functionality for mobile and desktop apps were implemented in either shared libraries or windows runtime class libraries targeting certain platforms that could be reused on the separate binaries for the respective platforms.

Universal App Platform

Universal App Platform is another new concept that we, developers, will need to get acquainted with. UAP is a collection of contracts and versions. It defines the platform that is running your application and acts as a broker between the application and the operating systems. It is built on top of the Windows Core and can be described as a superset of all the APIs that are supported on different devices and platforms running Windows 10.

With this new concept, the developers’ responsibility towards the OS shifts towards the UAP and in return the operating system is responsible for providing the UAP to the applications. Targeting platforms with the UAP is as simple as a manifest declaration.

<TargetPlaform Name="Microsoft.Universal" minVersion="2.0.0.0" maxVersionTested="3.5.0.0" />

The existence of a broker between the application and the operating system also creates an OS-agnostic development experience. For instance, if/when a new version of the OS becomes available, the application does not need to be aware of the version of the OS. Only important thing is to check if the UAP version is compatible with the current application.

Extensions SDK

Extensions SDK is really what makes the device specific APIs accessible. In an object oriented analogy, if the UAP is defining the abstract classes and interfaces to all the available APIs, the extensions SDK provides the implementations for these device specific feature sets. For instance, without adding the windows phone extension SDK as a reference to your application (the extension SDKs can be added using the Add Reference link in the project menu), the UAP will not be able to provide your application the access to types like BackButtonPressed or a contract like Wallet.

API Information Metadata

Since your application communicates with the OS through the UAP, and using the implementation by the extension sdks, the easiest way to probe for a certain API or device is the foundation metadata namespace. ApiInformation static class lets developers/application probe the current platform any of the supported classes, APIs, contracts, etc.

On Windows 8.1 Universal App:

#if Windows_Phone_App

Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_Pressed

#else

On Windows 10 App:

If(Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))

{

Windows.Phone.UI.Input.HardwareButtons.Backpressed += HardwareButtons_BackPressed;

}

Since the HardwareButtons class and the Backpressed event is infact included in the UAP, even though the runtime type does not exist in the current device, there is no need for conditional compilation.

Instead of using IsTypePresent, you can test for the presence of individual members by using IsEventPresent, IsMethodPresent, IsPropertyPresent, and similar methods.

The set of APIs within a device family is further broken down into subdivisions known as API contracts. And you can use the ApiInformation.IsApiContractPresent method to tests for the presence of an API contract. This is useful if you want to test for the presence of a large number of APIs that all exist in the same version of an API contract.

public boolean HasScannerApi

{

get

{

return Foundation.Metadata.ApiInformation

.IsApiContractPresent("Devices.Scanners.ScannerDeviceContract", 3);

}

}

Windows 10 Changes

Other than the basic concepts in the development methodology, there are also changes in the framework and app model itself.

Continuation Manager No More (Windows Phone)

The infamous continuation context and the continuation manager are completely removed from windows phone to create a more unified programming model.
The methods that provide a continuation context such as FileOpenPicker.PickSingleFileAndContinue or WebAuthenticationBroker.AuthenticateAndContinue are replaced with their Windows Runtime counter parts such as FileOpenPicker.PickSingleFileAsync, WebAuthenticationBroker.AuthenticateAsync.

Charms Bar No More (Windows)

A concept that was introduced with Windows 8, the so-called charms bar, has been removed from Windows 10. In order to support the Windows 8 applications running on Windows 10, a top navigation button is introduced to access the charm functionalities like settings or sharing contracts.

win10-windows8apponwindows10

 

 

For windows 10 applications, this top menu item does not appear. It is the developer’s responsibility to make these contracts accessible either with an app bar button or a button in the application interface.

windows10-settingsflyout

 

Another change related to the charms is that the flyouts related to the charm bar buttons, such as the settings flyout; does not appear in the side of the whole client window but rather uses the application window.

Changing Layout Concepts (Windows)

Windows application on Windows 8 two separate models of layout. First one was the full screen layout, and the second one was the snapped layout. Snapped layout was initially a fixed half window sized view but later changed to an adjustable window.

Windows 10 - Tablet Mode

Windows 10 – Tablet Mode

Windows 10 user interface can be used in two different modes. One is the tablet mode, which resembles to the previous layout and the application is visible either in snapped or full screen views. The second mode is the desktop mode, which makes the windows runtime apps visually no different than classic windows applications. On the desktop mode, the applications can be moved by the user or resized as desired.

App Bar (Windows)

App bar is still accessible and usable in Windows 10 applications. The only change is the fact that now the app bar became part of the window that is presenting your application. This change does not affect the developers directly, only directed towards the user experience.

However, windows 8 applications running on Windows 10 still display their app bar just like before.

I tried to give a quick overview of the changes related to Windows 10. Overall, Windows 10 is coming with a lot of surprises both for developers and users.
Happy coding every one,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.