本例演示了如何自己扩展一个Camera Lens。
1. UI界面是一个MediaViewer
<controls:MediaViewerx:Name="MediaViewer"Items="{Binding CameraRoll}" FooterVisibility="Visible"FooterDisplayed="MediaViewer_FooterDisplayed"ItemDisplayed="MediaViewer_ItemDisplayed"ItemZoomed="MediaViewer_ItemZoomed"ItemUnzoomed="MediaViewer_ItemUnzoomed"InitiallyDisplayedElement="Last"><controls:MediaViewer.FooterTemplate>
2. 实现类:
public enum ViewModelState { Unloaded, Loading, Loaded, AutoFocusInProgress, PointFocusAndCaptureInProgress, AutoFocusAndCaptureInProgress, CaptureInProgress }class LensViewModel : DependencyObject, INotifyPropertyChanged, ICameraEngineEvents{
接口ICameraEngineEvents:
interface ICameraEngineEvents{void OnCameraLoaded(ICameraCaptureDevice captureDevice);void OnStillCaptureComplete(Stream thumbnailStream, Stream imageStream);void OnReviewImageAvailable();void OnFocusComplete(bool succeeded);}