public virtual void OnCreated(View rootView) { if (rootView == null) { return; } // Register to resize and move through pan gestures. borderPanGestureDetector = new PanGestureDetector(); borderPanGestureDetector.Attach(rootView); borderPanGestureDetector.Detected += OnPanGestureDetected; // Register touch event for effect when border is touched. rootView.LeaveRequired = true; rootView.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Started) { backgroundColor = new Color(rootView.BackgroundColor); rootView.BackgroundColor = DefaultClickedBackgroundColor; } else if (e.Touch.GetState(0) == PointStateType.Finished || e.Touch.GetState(0) == PointStateType.Leave || e.Touch.GetState(0) == PointStateType.Interrupted) { rootView.BackgroundColor = backgroundColor; } return(true); }; borderPinchGestureDetector = new PinchGestureDetector(); borderPinchGestureDetector.Attach(rootView); borderPinchGestureDetector.Detected += OnPinchGestureDetected; AddInterceptGesture(); }
// If two finger long press is done, create a windowView. // then, Register a gesture on the windowView to do a resize or move. private bool OnTick(object o, Timer.TickEventArgs e) { windowView = new View() { WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, BackgroundColor = new Color(1, 1, 1, 0.5f), }; windowView.TouchEvent += (s, e) => { return(true); }; BorderWindow.Add(windowView); winTapGestureDetector = new TapGestureDetector(); winTapGestureDetector.Attach(windowView); winTapGestureDetector.SetMaximumTapsRequired(3); winTapGestureDetector.Detected += OnWinTapGestureDetected; winPanGestureDetector = new PanGestureDetector(); winPanGestureDetector.Attach(windowView); winPanGestureDetector.Detected += OnWinPanGestureDetected; BorderWindow.InterceptTouchEvent -= OnWinInterceptedTouch; isWinGestures = true; return(false); }
public virtual void OnCreated(View borderView) { if (borderView == null) { return; } this.borderView = borderView; // Register to resize and move through pan gestures. borderPanGestureDetector = new PanGestureDetector(); borderPanGestureDetector.Attach(borderView); borderPanGestureDetector.Detected += OnPanGestureDetected; // Register touch event for effect when border is touched. borderView.LeaveRequired = true; borderView.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Started) { if (BorderWindow.IsMaximized() == false) { BorderWindow.Raise(); } backgroundColor = new Color(borderView.BackgroundColor); borderView.BackgroundColor = DefaultClickedBackgroundColor; } else if (e.Touch.GetState(0) == PointStateType.Finished || e.Touch.GetState(0) == PointStateType.Leave || e.Touch.GetState(0) == PointStateType.Interrupted) { borderView.BackgroundColor = backgroundColor; } return(true); }; borderPinchGestureDetector = new PinchGestureDetector(); borderPinchGestureDetector.Attach(borderView); borderPinchGestureDetector.Detected += OnPinchGestureDetected; AddInterceptGesture(); UpdateIcons(); }