DRAG DROP
You are developing a Universal Windows Platform (UWP) app that will take photos. The app will be used
across Windows 10 device families.
You need to ensure that when the app runs on a phone, the app can use the built-in features of the phone.
How should you complete the code? To answer, drag the appropriate code elements to the correct targets.Each element may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.
Select and Place:
Explanation:
Box 1, box 2:
Example code:
Windows.Foundation.Metadata.ApiInformation.IsTypePresent(“Windows.Phone.UI.Input.HardwareButtons”);
if (isHardwareButtonsAPIPresent)
{
Windows.Phone.UI.Input.HardwareButtons.CameraPressed +=
HardwareButtons_CameraPressed;
}
Box 3:
Example: Making the Back button appear requires just one line of code:
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
AppViewBackButtonVisibility.Visible;https://msdn.microsoft.com/en-us/library/windows/apps/dn894631.aspx
ApiInformation :Enables you to detect whether a specified member, type, or API contract is present so that you can safely make API calls across a variety of devices
IsTypePresent(String)
Returns true or false to indicate whether a specified type is present.
IsEventPresent(String, String)
Returns true or false to indicate whether a specified event is present for a specified type.
Hardware buttons class is a type
SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
AppViewBackButtonVisibility.Visible;
The SystemNavigationManager lets you respond to user presses of the system provided back button such as a hardware button, or gestures and voice commands that activate the same event.
To enable your app to respond to the system back-navigation event, call GetForCurrentView to get the SystemNavigationManager object associated with the current view, then register an event handler for the BackRequested event. Your app will receive the event only of it’s the foreground app. If you handle the BackRequested event, set the BackRequestedEventArgs.Handled property to true to mark the event as handled. If you don’t mark the event as handled, the system decides whether to navigate away from the app (on the Mobile device family) or ignore the event (on the Desktop device family).