Windows phone 8相机未初始化

编程入门 行业动态 更新时间:2024-10-26 06:33:15
本文介绍了Windows phone 8相机未初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好问候 我试图用以下代码初始化相机没有初始化。

hello greetings I am trying to initialize camera with the following code is not getting initialize.

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { // Initialize the camera, when available. camera = new PhotoCamera(); // Event is fired when the PhotoCamera object has been initialized. camera.Initialized += new EventHandler<CameraOperationCompletedEventArgs>(cam_Initialized); //Set the VideoBrush source to the camera. viewfinderBrush.SetSource(camera); } void cam_Initialized(object sender, CameraOperationCompletedEventArgs e) { if (e.Succeeded) { this.Dispatcher.BeginInvoke(delegate() { MessageBox.Show("Camera initialized."); }); } } protected override void OnOrientationChanged(OrientationChangedEventArgs e) { if (camera != null) { // LandscapeRight rotation when camera is on back of phone. int landscapeRightRotation = 180; // Change LandscapeRight rotation for front-facing camera. if (camera.CameraType == preferences.CameraDevice.Value) landscapeRightRotation = -180; // Rotate video brush from camera. if (e.Orientation == PageOrientation.LandscapeRight) { // Rotate for LandscapeRight orientation. viewfinderBrush.RelativeTransform = new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = landscapeRightRotation }; } else { // Rotate for standard landscape orientation. viewfinderBrush.RelativeTransform = new CompositeTransform() { CenterX = 0.5, CenterY = 0.5, Rotation = 0 }; } } base.OnOrientationChanged(e); }

提前谢谢

Thank you in advance

推荐答案

先检查一下,然后与你的代码进行比较.. msdn.microsoft/en-us/library/windowsphone/develop/hh202956%28v=vs.105%29.aspx?cs-save-lang=1&cs -lang = csharp#code-snippet-3 [ ^ ] Check this one first and then compare with your code.. msdn.microsoft/en-us/library/windowsphone/develop/hh202956%28v=vs.105%29.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-3[^]

更多推荐

Windows phone 8相机未初始化

本文发布于:2023-11-06 17:28:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564330.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:初始化   相机   Windows   phone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!