예제 #1
0
        private void DismissMessage(MessageView messageView, bool clicked)
        {
            if (messageView != null && !messageView.Hit)
            {
                messageView.Hit = true;
                UIView.Animate(DismissAnimationDuration, () => messageView.Frame =
                                   new RectangleF((float)messageView.Frame.X, (float)-(messageView.Frame.Height - _messageBarOffset), (float)messageView.Frame.Width, (float)messageView.Frame.Height),
                               () =>
                {
                    _messageVisible = false;
                    messageView.RemoveFromSuperview();

                    var action = messageView.OnDismiss;
                    if (action != null)
                    {
                        action(clicked);
                    }

                    if (_messageBarQueue.Count > 0)
                    {
                        ShowNextMessage();
                    }
                });
            }
        }
예제 #2
0
        /// <summary>
        /// Hides all messages
        /// </summary>
        public void HideAll()
        {
            MessageView currentMessageView = null;
            var         subviews           = MessageWindowView.Subviews;

            foreach (UIView subview in subviews)
            {
                var view = subview as MessageView;
                if (view != null)
                {
                    currentMessageView = view;
                    currentMessageView.RemoveFromSuperview();
                }
            }

            _messageVisible = false;
            _messageBarQueue.Clear();
            CancelPreviousPerformRequest(this);
        }