private void Initialize()
        {
            _gestureLayer?.Unrealize();
            _gestureLayer = new GestureLayer(NativeView);
            _gestureLayer.Attach(NativeView);

            _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Move, OnMoved);
            _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.End, OnEnd);
            _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Abort, OnEnd);
        }
Beispiel #2
0
        void Initialize()
        {
            AlignmentX = -1;
            AlignmentY = -1;
            WeightX    = 1;
            WeightY    = 1;

            _contentBox = new Box(_mainLayout);
            _contentBox.Show();
            _mainLayout.PackEnd(_contentBox);

            _drawerBox = new Box(_mainLayout);
            _drawerBox.Show();
            _mainLayout.PackEnd(_drawerBox);

            _drawerContentBox = new Box(_drawerBox);
            _drawerBox.PackEnd(_drawerContentBox);

            _drawerIconBox = new Box(_drawerBox);
            _drawerBox.PackEnd(_drawerIconBox);

            _drawerIcon = new EImage(this)
            {
                AlignmentY = -1,
                AlignmentX = -1,
                WeightX    = 1,
                WeightY    = 1
            };
            _drawerIcon.Show();
            using (var stream = GetType().Assembly.GetManifestResourceStream(DefaultIcon))
            {
                _drawerIcon.Load(stream);
            }

            _drawerIconBox.PackEnd(_drawerIcon);

            _contentGesture = new GestureLayer(_contentBox);
            _contentGesture.Attach(_contentBox);
            _contentGesture.SetMomentumCallback(GestureLayer.GestureState.Start, OnContentDragStarted);
            _contentGesture.SetMomentumCallback(GestureLayer.GestureState.End, OnContentDragEnded);
            _contentGesture.SetMomentumCallback(GestureLayer.GestureState.Abort, OnContentDragEnded);

            _drawerGesture = new GestureLayer(_drawerIconBox);
            _drawerGesture.Attach(_drawerIconBox);

            _drawerGesture.SetMomentumCallback(GestureLayer.GestureState.Move, OnDrawerDragged);
            _drawerGesture.SetMomentumCallback(GestureLayer.GestureState.End, OnDrawerDragEnded);
            _drawerGesture.SetMomentumCallback(GestureLayer.GestureState.Abort, OnDrawerDragEnded);

            _mainLayout.SetLayoutCallback(OnLayout);
            _drawerBox.SetLayoutCallback(OnDrawerContentLayout);
            _contentBox.SetLayoutCallback(OnContentLayout);

            RotaryEventManager.Rotated += OnRotateEventReceived;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the RefreshLayout class.
        /// </summary>
        /// <param name="parent"></param>
        public RefreshLayout(EvasObject parent) : base(parent)
        {
            MinimumHeight  = _minimumSize;
            _refreshState  = RefreshState.Idle;
            _refreshIcon   = new RefreshIcon(parent);
            _contentLayout = new Box(parent);
            _refreshIcon.Show();
            _contentLayout.Show();

            _gestureLayer = new GestureLayer(parent);
            _gestureLayer.Attach(_contentLayout);
            _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Move, OnMoved);
            _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.End, OnEnded);
            _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Abort, OnEnded);

            this.PackEnd(_contentLayout);
            this.PackEnd(_refreshIcon);

            SetLayoutCallback(OnLayoutUpdate);
        }
 private void SetupMomentumGesture()
 {
     _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Move, OnMove);
 }