Пример #1
0
        public bool OnPressed(GlobalAction action)
        {
            if (action == GlobalAction.Back)
            {
                BackAction.Invoke();
                return(true);
            }

            return(false);
        }
Пример #2
0
        public bool OnPressed(GlobalAction action)
        {
            switch (action)
            {
            case GlobalAction.Back:
                BackAction.Invoke();
                return(true);

            case GlobalAction.Select:
                SelectAction.Invoke();
                return(true);
            }

            return(false);
        }
Пример #3
0
        public Popup(float contentWidth, float contentHeight) : base()
        {
            _y            = -Height;
            ContentHeight = contentHeight;

            _popupWidth        = contentWidth;
            _headerHeight      = HeaderHeightRatio * Height;
            _footerHeight      = FooterHeightRatio * Height;
            _radius            = Height / 25;
            _popupX            = (Width - _popupWidth) / 2;
            _popupY            = (Height - (_headerHeight + _footerHeight + ContentHeight)) / 2;
            _secondButtonX     = _popupX + _popupWidth * ButtonWidthRatio;
            _secondButtonWidth = _popupWidth * (1 - ButtonWidthRatio);
            _popupHeight       = _headerHeight + ContentHeight + _footerHeight;


            _titleBlock = new TextBlock(_popupX + _popupWidth / 2, _popupY + _headerHeight / 2, Title, _headerHeight / 2, new SKColor(255, 255, 255));
            AddChild(_titleBlock);

            var leftButton = new PopupLeftButton(_popupX, _popupY + _headerHeight + ContentHeight,
                                                 _popupWidth * ButtonWidthRatio, _footerHeight, _popupWidth, _popupHeight, _radius);

            _rightButton = new PopupRightButton(_secondButtonX, _popupY + _headerHeight + ContentHeight, _secondButtonWidth, _footerHeight, _popupWidth, _popupHeight, _radius, ActionName);

            Title      = "Popup title";
            ActionName = "Action";

            AddChild(leftButton);
            AddChild(_rightButton);

            _container = new CenteredContainer(_popupX, _popupY + _headerHeight, contentHeight, contentWidth);
            AddChild(_container);

            leftButton.Activated += () =>
            {
                HideLeft();
                BackAction?.Invoke();
            };

            _rightButton.Activated += () =>
            {
                HideRight();
                NextAction?.Invoke();
            };

            DeclareTappable(this);
        }
Пример #4
0
        public bool OnPressed(GlobalAction action)
        {
            switch (action)
            {
            case GlobalAction.SelectPrevious:
                InternalButtons.SelectPrevious();
                return(true);

            case GlobalAction.SelectNext:
                InternalButtons.SelectNext();
                return(true);

            case GlobalAction.Back:
                BackAction.Invoke();
                return(true);

            case GlobalAction.Select:
                SelectAction.Invoke();
                return(true);
            }

            return(false);
        }
Пример #5
0
        public bool OnPressed(KeyBindingPressEvent <GlobalAction> e)
        {
            switch (e.Action)
            {
            case GlobalAction.SelectPrevious:
                InternalButtons.SelectPrevious();
                return(true);

            case GlobalAction.SelectNext:
                InternalButtons.SelectNext();
                return(true);

            case GlobalAction.Back:
                BackAction.Invoke();
                return(true);

            case GlobalAction.Select:
                SelectAction.Invoke();
                return(true);
            }

            return(false);
        }
Пример #6
0
        public bool OnPressed(GlobalAction action)
        {
            switch (action)
            {
            case GlobalAction.SelectPrevious:
                if (selectionIndex == -1 || selectionIndex == 0)
                {
                    setSelected(InternalButtons.Count - 1);
                }
                else
                {
                    setSelected(selectionIndex - 1);
                }
                return(true);

            case GlobalAction.SelectNext:
                if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
                {
                    setSelected(0);
                }
                else
                {
                    setSelected(selectionIndex + 1);
                }
                return(true);

            case GlobalAction.Back:
                BackAction.Invoke();
                return(true);

            case GlobalAction.Select:
                SelectAction.Invoke();
                return(true);
            }

            return(false);
        }
Пример #7
0
 /// <summary>
 /// Invokes BackAction to go back
 /// </summary>
 public void Back()
 {
     BackAction?.Invoke();
 }
Пример #8
0
 /// <summary>
 /// Invokes BackAction to go back
 /// </summary>
 public void BackToList()
 {
     BackAction?.Invoke();
 }
Пример #9
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     BackAction?.Invoke();
 }