DRAG DROP
You are developing a Windows Store app. The app uses hardware devices that are attached
to the computer. The app must meet the following requirements:
• Display a list of currently available hardware devices when the app launches.
• Detect when a hardware device is connected to or removed from the computer.
Develop the solution by selecting and arranging the required code segments in the correct
order. You may not need all of the code segments.
You are developing a Windows Store app that must meet the following requirements:
DRAG DROP
You are developing a Windows Store app. The app uses hardware devices that are attached
to the computer. The app must meet the following requirements:
• Display a list of currently available hardware devices when the app launches.
• Detect when a hardware device is connected to or removed from the computer.
Develop the solution by selecting and arranging the required code segments in the correct
order. You may not need all of the code segments.
totally wrong!
1)
myWatcher = Windows.Devices.Enumeration.DeviceInformation.createWatcher();
2)
myWatcher.addEventListener(“added”, onDeviceAdded);
myWatcher.addEventListener(“stopped”, onDeviceStopped);
3)
function startDeviceWatch(){
try{
output.innerHTML = “”;
4)
myWatcher.start();
5)
} catch (e) {
document.getElementById(“statusMessage”).innerHTML = “Failed to create watcher, error: ” + e.message;
}
6)
}
functionstopDeviceWatcher(){
try {
myWatcher.stop();
7)
}
catch (e) {
document.getElementById(“statusMessage”).innerHTML = “Failed to stop watcher, error: ” + e.message;
}
}