问题
I've diligently followed the instructions at http://msdn.microsoft.com/en-us/library/microsoft.devices.camerabuttons.shutterkeyhalfpressed(v=vs.92).aspx to try and hook the camera events in my WP7.1 Silverlight app. In my main form I have:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
CameraButtons.ShutterKeyPressed += new EventHandler(CameraButtons_ShutterKeyPressed);
}
And then...
void CameraButtons_ShutterKeyPressed(object sender, EventArgs e)
{
// stuff
}
However, this event never fires. When I press the camera button, the phone just jumps to camera mode. Am I missing something? I got the sense from the above article that I might need to add the following to my WPAppManifest.xml, because the project was converted from WP7.0:
<Capability Name="ID_CAP_ISV_CAMERA" />
... but I did that, and nothing much changed. Any ideas?
回答1:
If the capture has not started (CaptureSource.Start), this event will not fire.
来源:https://stackoverflow.com/questions/8442571/camerabuttons-events-just-not-firing-in-wp7-1-app