/// <summary> /// Perform key up handling. /// </summary> /// <param name="e">A KeyEventArgs that contains the event data.</param> public override void KeyUp(KeyEventArgs e) { // Tell current view of key event if (FocusView != null) { MouseCaptured = FocusView.KeyUp(e); } }
/// <summary> /// Perform key press handling. /// </summary> /// <param name="e">A KeyPressEventArgs that contains the event data.</param> public override void KeyPress(KeyPressEventArgs e) { // Tell current view of key event if (FocusView != null) { FocusView.KeyPress(e); } }
public Session() { Camera = new CameraView(); Cooler = new CoolerView(); Filter = new FilterView(); Focus = new FocusView(); FilterWheelService = new AscomFilterWheelService(); FilterWheelService.Initialize(this); }
/// <summary> /// Perform key down handling. /// </summary> /// <param name="e">A KeyEventArgs that contains the event data.</param> public override void KeyDown(KeyEventArgs e) { // Tell current view of key event if (FocusView != null) { FocusView.KeyDown(e); } else { // Pass onto the ribbon so it can transfer focus to next _ribbon.MinimizedKeyDown(e.KeyData); } }
/// <summary> /// The view has loaded and is ready for final initialization. /// </summary> public override void ViewDidLoad() { base.ViewDidLoad(); OverlayView = new FocusView { Frame = new CGRect(0, 0, 1920, 1080), Hidden = true, FocusEnabled = false }; View.AddSubview(OverlayView); LoadingSpinnerView = new LoadingSpinnerView(new CGRect(880, 460, 160, 160)); OverlayView.AddSubview(LoadingSpinnerView); }
private void Focus(UITapGestureRecognizer recognizer) { var point = recognizer.LocationInView(this); var viewSize = Bounds.Size; var newPoint = new CGPoint(point.Y / viewSize.Height, 1.0 - point.X / viewSize.Width); var device = AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video); NSError error; if (device.LockForConfiguration(out error)) { if (device.IsFocusModeSupported(AVCaptureFocusMode.AutoFocus)) { device.FocusMode = AVCaptureFocusMode.AutoFocus; device.FocusPointOfInterest = newPoint; } if (device.IsExposureModeSupported( AVCaptureExposureMode.ContinuousAutoExposure)) { device.ExposureMode = AVCaptureExposureMode.ContinuousAutoExposure; device.ExposurePointOfInterest = newPoint; } device.UnlockForConfiguration(); } FocusView.Alpha = 0; FocusView.Center = point; FocusView.BackgroundColor = UIColor.Clear; FocusView.Layer.BorderColor = Configuration.BaseTintColor.CGColor; FocusView.Layer.BorderWidth = 1; FocusView.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f); Add(FocusView); AnimateNotify(0.8, 0.0, 0.8f, 3.0f, UIViewAnimationOptions.CurveEaseIn, () => { FocusView.Alpha = 1; FocusView.Transform = CGAffineTransform.MakeScale(0.7f, 0.7f); }, finished => { FocusView.Transform = CGAffineTransform.MakeScale(1.0f, 1.0f); FocusView.RemoveFromSuperview(); }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.cam_layout); Window.AddFlags(WindowManagerFlags.Fullscreen); Window.DecorView.SystemUiVisibility = (StatusBarVisibility)SystemUiFlags.ImmersiveSticky; cameraView = FindViewById <CameraView>(Resource.Id.cameraView); focusView = FindViewById <FocusView>(Resource.Id.focusView); capture = FindViewById <FloatingActionButton>(Resource.Id.fabCapture); switchCamera = FindViewById <FloatingActionButton>(Resource.Id.fabSwitchCam); fotoapparat = CreateFotoapparat(); TakePictureOnClick(); SwitchCameraOnClick(); // Create your application here }
/// <summary> /// Raises the navigated to event. /// </summary> /// <param name="navigationParameters">Navigation parameters.</param> public void OnNavigatedTo(IDictionary <string, object> navigationParameters) { #if WINDOWS_PHONE OrientationPage.TouchHandler += HandleTouchHandler; #endif _model.CameraLoading = false; LoadingView.SetBinding(VisualElement.IsVisibleProperty, new Binding("CameraLoading")); _model.CanCapture = CameraView.CameraAvailable; switch (PageOrientation) { case Orientation.Portrait: // set starting focus points for each orientation FocusView.SetFocusPoints(new Point(Width / 2, Height / 2), new Point(Height / 2, Width / 2)); break; case Orientation.LandscapeLeft: case Orientation.LandscapeRight: // set starting focus points for each orientation FocusView.SetFocusPoints(new Point(Height / 2, Width / 2), new Point(Width / 2, Height / 2)); break; } CameraView.NotifyOpenCamera(true); // camera must store these widths for IOS on orientation changes for camera preview layer resizing #if __IOS__ CameraView.NotifyWidths(CAMERA_BUTTON_CONTAINER_WIDTH); #endif this.Show(navigationParameters); }
/// <summary> /// Perform key press handling. /// </summary> /// <param name="e">A KeyPressEventArgs that contains the event data.</param> public override void KeyPress(KeyPressEventArgs e) { // Tell current view of key event FocusView?.KeyPress(e); }
/// <summary> /// Perform key down handling. /// </summary> /// <param name="e">A KeyEventArgs that contains the event data.</param> public override void KeyDown(KeyEventArgs e) { // Tell current view of key event FocusView?.KeyDown(e); }