例子:Basic Lens sample

时间:2023-03-09 16:47:02
例子:Basic Lens sample

本例演示了如何自己扩展一个Camera Lens。

1. UI界面是一个MediaViewer

    <controls:MediaViewer
x: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);
}