Exemple #1
0
        public void OnAnimationEnd(Animator animation)
        {
            if (_isShow)
            {
                _dragGesture.NeedShowBackgroundView.Invoke(true, 1);
            }
            else
            {
                _dragGesture.NeedShowBackgroundView.Invoke(false, 0);
            }

            _basePage.OnAnimationCompleted();
        }
Exemple #2
0
        void LayoutMenu()
        {
            if (!CheckPageAndMenu())
            {
                return;
            }

            //// areadly add gesture
            //if (_dialogDrawer != null)
            //return;

            var menu = _basePage.SlideMenu;

            _dialogDrawer = new VerticalDrawer(menu);
            _dialogDrawer.RequestLayout = (l, t, r, b, density) =>
            {
                _wrapper.Frame = new CGRect(l, t, (r - l), (b - t));
                _wrapper.SetNeedsLayout();
            };
            _dialogDrawer.NeedShowBackgroundView = (open, alpha) =>
            {
                if (open)
                {
                    ShowBackgroundOverlay(alpha);
                }
                else
                {
                    HideBackgroundOverlay();
                }
            };

            _basePage.HideMenuAction = () =>
            {
                UIView.Animate(((double)menu.AnimationDurationMillisecond) / 1000, () => { _dialogDrawer.LayoutHideStatus(); }, () => { _basePage.OnAnimationCompleted(); });
            };

            _basePage.ShowMenuAction = () =>
            {
                UIView.Animate(((double)menu.AnimationDurationMillisecond) / 1000, () => { _dialogDrawer.LayoutShowStatus(); }, () => { _basePage.OnAnimationCompleted(); });
            };

            if (_wrapper != null)
            {
                RemoveView();
            }

            _wrapper = new FormsElementWrapper(menu, this.Element);
            AddView();

            var rect = _dialogDrawer.GetHidePosition();

            menu.Layout(new Rectangle(
                            rect.left,
                            rect.top,
                            (rect.right - rect.left),
                            (rect.bottom - rect.top)));
            _wrapper.Frame = new CGRect(
                rect.left,
                rect.top,
                (rect.right - rect.left),
                (rect.bottom - rect.top));
            _wrapper.SetNeedsLayout();

            _wrapper.Layer.CornerRadius = (nfloat)_basePage.SlideMenu.CornerRadius;
            _wrapper.Renderer.NativeView.Layer.CornerRadius = (nfloat)_basePage.SlideMenu.CornerRadius;
        }