我用来调用相机的代码如下,暂时未发现您所说的情况。
PhotoCamera cam = null;
// Check to see if the camera is available on the device.
if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true) ||
(PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing) == true))
{
// Initialize the camera, when available.
if (PhotoCamera.IsCameraTypeSupported(CameraType.FrontFacing))
{
// Use front-facing camera if available.
cam = new Microsoft.Devices.PhotoCamera(CameraType.FrontFacing);
}
else
{
// Otherwise, use standard camera on back of device.
cam = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
}
//// Event is fired when the PhotoCamera object has been initialized.
//cam.Initialized += new EventHandler<Microsoft.Devices.CameraOperationCompletedEventArgs>(cam_Initialized);
//// Event is fired when the capture sequence is complete.
//cam.CaptureCompleted += new EventHandler<CameraOperationCompletedEventArgs>(cam_CaptureCompleted);
// Event is fired when the capture sequence is complete and an image is available.
cam.CaptureImageAvailable += new EventHandler<Microsoft.Devices.ContentReadyEventArgs>(cam_CaptureImageAvailable);
// Event is fired when the capture sequence is complete and a thumbnail image is available.
cam.CaptureThumbnailAvailable += new EventHandler<ContentReadyEventArgs>(cam_CaptureThumbnailAvailable);
//Set the VideoBrush source to the camera.
CameraVideoBrushExtensions.SetSource(viewfinderBrush, cam);
//viewfinderBrush.SetSource(cam);
CameraButtonEnable = true;
AppBarModeDefault = true;
}
Cedar