How can I call the camera on C # for Windows Phone? I found it only for Windows Phone 7 or 7.1, but it didn’t work because I need for Windows Phone 10, well, or at least for 8-8.1.
- If you are given an exhaustive answer, mark it as correct (tick the selected answer). - andreycha
|
2 answers
Windows Phone 8.x
Use CameraCaptureTask
:
var cameraCaptureTask = new CameraCaptureTask(); cameraCaptureTask.Completed += cameraCaptureTask_Completed; cameraCaptureTask.Show(); ... private void cameraCaptureTask_Completed(object sender, PhotoResult e) { if (e.TaskResult == TaskResult.OK) { // Отобразим фотографию в контроле myImage var bmp = new BitmapImage(); bmp.SetSource(e.ChosenPhoto); myImage.Source = bmp; } }
However, keep in mind that all photos taken this way will automatically be included in the photo album. And if the user has autoloading of photos at the same time, they will go online. If this behavior is undesirable (you need to take temporary or personal shots), then you must use the PhotoCamera
class and implement the shooting yourself .
Windows 10 Mobile
Use CameraCaptureUI
.
|
Here, I found a solution here , who is interested))))
|