private void mLightButton_Click(object sender, RoutedEventArgs e)
{
// check if the camera light is available
if (mRecognizer.IsTorchSupported) {
// toggle camera light
mRecognizer.TorchOn = !mRecognizer.TorchOn;
// toggle "Light" button icon
if (mRecognizer.TorchOn) {
mLightImage.ImageSource = new BitmapImage(new Uri("Assets/Icons/icon_flashlight_selected.png", UriKind.Relative));
} else {
mLightImage.ImageSource = new BitmapImage(new Uri("Assets/Icons/icon_flashlight.png", UriKind.Relative));
}
} else {
// if camera light is not available display message
MessageBox.Show("Camera light is not supported on this device!");
}
}