The example of cameracaptureui demonstrates how to use Windows. Media. Capture. Cameracaptureui API, which displays a UI for capturing full screen photos or videos. Async Void Scenario1button_click ( Object Sender, routedeventargs E)
{
Try
{
Cameracaptureui dialog = New Cameracaptureui ();
Size aspectratio = New Size ( 16 , 9 );
Dialog. photosettings. croppedaspectratio = aspectratio;
Storagefile file = await dialog. capturefileasync (cameracaptureuimode. Photo );
If (File! = Null )
{
Scenario1outputtext. Text = "" ;
Bitmapimage = New Bitmapimage ();
Using (Irandomaccessstream filestream = await file. openasync (Windows. Storage. fileaccessmode. Read ))
{
Bitmapimage. setsource (filestream );
}
Scenario1image. Source = bitmapimage;
Scenario1resetbutton. Visibility = visibility. visible;
Photofile = file. path;
}
Else
{
Scenario1outputtext. Text = " No photo captured. " ;
}
}
Catch (Exception ex)
{
Scenario1outputtext. Text = ex. message;
}
}
Complete example:/files/risk/windows8/camera and uicamera sample.rar