In this section, we will be representing the acceptance of your application to different devices held by Windows 10. We have previously educated about adopting your UI and all the tricks, techniques and controls used in UWP applications.
Currently, we will learn about accepting your code, because
Adaptive code can light up your application temporarily and execute code only when running on a particular device family and/or on a particular version of the platform/extension APIs.
In Windows 10, you can implement the UWP applications in Visual Studio by using either C++, C#, Visual Basic or JavaScript.
The Windows Core APIs run in the similar way for all the devices, which comprise most of the functionality you need for your code and UI.
Though, for the code and the UI tailored for specific device families, you need to use the adaptive code and adaptive UI.
The UI adapts to changed screens easily, but altered device families not only have different screen sizes, it has a lot more than that.
To add any particular extension SDK, needed in your application, follow the below given steps −
Desktop and Mobile extensions are the two most mutual platform Extension SDKs. The Mobile extension, for instance, enables the APIs essential to use the hardware camera button.
You can check the device competences by using the Windows.Foundation.Metadata.ApiInformation class method, which returns a Boolean output if the type is supported on the current device. For example, you can enable your Windows app to use the Camera button with code like this –
The phone-camera button code will perform only if the Mobile Extension SDK is enabled on the device. Likewise, you can also check for any precise event, method or property in the current API version by using IsEventPresent, IsMethodPresent, IsPropertyPresent, instead of IsTypePresent as shown below.
A Universal Widows Platform (UWP) application or Windows Runtime Component, which are written in C++/CX, can access Win32 APIs, which are also a part of UWP now. All of the Windows 10 device families can implement Win32 APIs by linking your application with Windowsapp.lib.
Windowsapp.lib is an "umbrella" lib that delivers the spreads for the UWP APIs. Linking to Windowsapp.lib will add to your app addictions on dllsthat are present on all Windows 10 device families.
Let us have a look into an easy instance in which the application targets both the desktop and the phone. As a result, when the application runs on the desktop, it will not show the status bar, but when the same application runs on the phone, it will display the status bar.
Given below is the XAML code in which different controls are added.
Given below is the C# implementation for different events.
When the above given code is compiled and executed on a Mobile, you will see the resulting window.
You can modify the background color of the status bar with the checkbox as shown in the image.
You can also hide the status bar.
Currently, when you run the similar application on a desktop device, you will see the resulting window in which the status bar and the checkboxes exact to the status bar are not visible.
|
|
Windows 10 Development Related Tutorials |
|
---|---|
Microsoft Azure Tutorial | Windows Communication Foundation (WCF) Tutorial |
Windows 10 Development Related Interview Questions |
|
---|---|
VBScript Advanced Interview Questions | Active Directory Interview Questions |
Windows Administration Interview Questions | SCCM Interview Questions |
ActiveX Interview Questions | Windows 7 Interview Questions |
Microsoft Azure Interview Questions | Windows Communication Foundation (WCF) Interview Questions |
Unity 3D Interview Questions | Windows CE .NET Interview Questions |
Advanced C# Interview Questions | Advanced C++ Interview Questions |
Angular 5 Interview Questions | Windows Server Administration Interview Questions |
Windows Controls Interview Questions | Sql Azure Interview Questions |
Windows 10 Development Related Practice Tests |
|
---|---|
Active Directory Practice Tests | Windows Administration Practice Tests |
SCCM Practice Tests | Windows 7 Practice Tests |
Microsoft Azure Practice Tests | Windows Communication Foundation (WCF) Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.