Пример #1
0
        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();
        }
Пример #2
0
        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();
        }