本文整理汇总了C#中PhotoCamera.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# PhotoCamera.Focus方法的具体用法?C# PhotoCamera.Focus怎么用?C# PhotoCamera.Focus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhotoCamera
的用法示例。
在下文中一共展示了PhotoCamera.Focus方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
photoCamera = new PhotoCamera();
previewVideo.SetSource(photoCamera);
photoCamera.Initialized += OnPhotoCameraInitialized;
CameraButtons.ShutterKeyHalfPressed += (o, arg) => photoCamera.Focus();
base.OnNavigatedTo(e);
}
示例2: OnNavigatedTo
// opening
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
_photoCamera = new PhotoCamera();
_photoCamera.Initialized += OnPhotoCameraInitialized;
_previewVideo.SetSource(_photoCamera);
CameraButtons.ShutterKeyHalfPressed += (o, arg) => _photoCamera.Focus();
}
示例3: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
_photoCamera = new PhotoCamera();
_photoCamera.Initialized += OnPhotoCameraInitialized;
_previewVideo.SetSource(_photoCamera); // _previewVideo is a VideoBrush-object
CameraButtons.ShutterKeyHalfPressed += (o, arg) => _photoCamera.Focus();
base.OnNavigatedTo(e);
}
示例4: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
_photoCamera = new PhotoCamera();
_photoCamera.Initialized += OnPhotoCameraInitialized;
qrPreviewVideo.SetSource(_photoCamera);
CameraButtons.ShutterKeyHalfPressed += (o, arg) => _photoCamera.Focus();
if (server.name != null)
joinMeeting();
base.OnNavigatedTo(e);
}
示例5: OnNavigatedTo
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
_cam = new PhotoCamera();
previewCanvas.SetSource(_cam);
previewCanvas.RelativeTransform = new CompositeTransform() {CenterX = 0.5, CenterY = 0.5, Rotation = 90};
_cam.CaptureImageAvailable += (sender, args) => {
//var library = new MediaLibrary();
string fileName = "wp8_kochbuch_" + _imgCounter + ".jpg";
_library.SavePictureToCameraRoll(fileName, args.ImageStream);
};
_cam.CaptureCompleted += (sender, args) => { _imgCounter++; };
CameraButtons.ShutterKeyPressed += (sender, args) => _cam.CaptureImage();
CameraButtons.ShutterKeyHalfPressed += (sender, args) => _cam.Focus();
//CameraButtons.ShutterKeyReleased += (sender, args) => { };
base.OnNavigatedTo(e);
}
示例6: MainPage
// Constructor
public MainPage()
{
InitializeComponent();
_photoCamera = new PhotoCamera();
_photoCamera.Initialized += OnPhotoCameraInitialized;
_previewVideo.SetSource(_photoCamera);
CameraButtons.ShutterKeyHalfPressed += (sender, args) => _photoCamera.Focus();
_photoChooserTask = new PhotoChooserTask();
_photoChooserTask.Completed += photoChooserTask_Completed;
_photoChooserTask.Show();
_timer = new DispatcherTimer
{
Interval = TimeSpan.FromMilliseconds(250)
};
_timer.Tick += (o, arg) => ScanPreviewBuffer();
}
示例7: CameraButton_Click
private void CameraButton_Click(object sender, RoutedEventArgs e)
{
if (photoCamera == null)
{
photoCamera = new PhotoCamera();
photoCamera.Initialized += OnPhotoCameraInitialized;
previewVideo.SetSource(photoCamera);
CameraButtons.ShutterKeyHalfPressed += (o, arg) => photoCamera.Focus();
}
if (timer == null)
{
timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
timer.Tick += (o, arg) => ScanPreviewBuffer();
}
BarcodeImage.Visibility = System.Windows.Visibility.Collapsed;
previewRect.Visibility = System.Windows.Visibility.Visible;
timer.Start();
}
示例8: InitializePhoneCamera
private void InitializePhoneCamera()
{
_phoneCamera = new PhotoCamera(CameraType.Primary);
_phoneCamera.Initialized += CameraInitialized;
viewfinderBrush.SetSource(_phoneCamera);
double cameraAspectRatioRotated = _phoneCamera.Resolution.Height / _phoneCamera.Resolution.Width;
double deviceAspectRatio = Application.Current.Host.Content.ActualHeight / Application.Current.Host.Content.ActualWidth;
double scaleY = cameraAspectRatioRotated * deviceAspectRatio;
viewfinderTransform.ScaleY = scaleY;
CameraButtons.ShutterKeyHalfPressed += CameraButtons_ShutterKeyHalfPressed;
_phoneCamera.AutoFocusCompleted += _phoneCamera_AutoFocusCompleted;
//Display the camera feed in the UI
_autofocusTimer = new DispatcherTimer();
_autofocusTimer.Interval = TimeSpan.FromMilliseconds(2000);
_autofocusTimer.Tick += (o, arg) =>
{
if (_phoneCamera == null)
{
return;
}
_phoneCamera.Focus();
};
// This timer will be used to scan the camera buffer every 250ms and scan for any barcodes
_scanTimer = new DispatcherTimer();
_scanTimer.Interval = TimeSpan.FromMilliseconds(250);
_scanTimer.Tick += (o, arg) => ScanForBarcode();
}
示例9: Scan_Loaded
void Scan_Loaded(object sender, RoutedEventArgs e)
{
if (photoCamera == null)
{
photoCamera = new PhotoCamera();
photoCamera.Initialized += OnPhotoCameraInitialized;
previewVideo.SetSource(photoCamera);
CameraButtons.ShutterKeyHalfPressed += (o, arg) => photoCamera.Focus();
}
if (timer == null)
{
timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) };
if (photoCamera.IsFocusSupported)
{
photoCamera.AutoFocusCompleted += (o, arg) => { if (arg.Succeeded) ScanPreviewBuffer(); };
timer.Tick += (o, arg) => { try { photoCamera.Focus(); } catch (Exception) { } };
}
else
{
timer.Tick += (o, arg) => ScanPreviewBuffer();
}
}
previewRect.Visibility = System.Windows.Visibility.Visible;
timer.Start();
}