Esempio n. 1
0
        public void AddMessage(string message, FlyMessageType type)
        {
            if (!_isRunning)
            {
                _isRunning     = true;
                textBlock.Text = message;

                Color color;
                ConvertMessageTypeToColor(type, out color);
                textBlock.Foreground =
                    new SolidColorBrush(color);

                SetMessageIcon(type);

                Storyboard.Begin();
            }
            else
            {
                if (message != textBlock.Text && !Contains(message))
                {
                    _messageList.Enqueue(message);
                    _messageTypeList.Enqueue(type);
                }
            }
        }
 private void SetMessageIcon(FlyMessageType type)
 {
     switch (type)
     {
         case FlyMessageType.Celebrate:
             image.Source =
                 BlackboxImageUtils.Image(BlackboxImageType.MessageCelebrate);
             break;
         case FlyMessageType.Criticism:
             image.Source =
                 BlackboxImageUtils.Image(BlackboxImageType.MessageCriticism);
             break;
         case FlyMessageType.Prompt:
             image.Source =
                 BlackboxImageUtils.Image(BlackboxImageType.MessagePrompt);
             break;
         default:
             break;
     }
 }
        public void AddMessage(string message, FlyMessageType type)
        {
            if (!_isRunning)
            {
                _isRunning = true;
                textBlock.Text = message;
                textBlock.Foreground =new SolidColorBrush(Colors.Black);
                SetMessageIcon(type);

                Storyboard.Begin();
            }
            else
            {
                if (message != textBlock.Text && !Contains(message))
                {
                    _messageList.Enqueue(message);
                    _messageTypeList.Enqueue(type);
                }
            }
        }
Esempio n. 4
0
        private void ConvertMessageTypeToColor(FlyMessageType type, out Color color)
        {
            switch (type)
            {
            case FlyMessageType.Celebrate:
                color = Colors.Blue;
                break;

            case FlyMessageType.Criticism:
                color = Colors.Red;
                break;

            case FlyMessageType.Prompt:
                color = Colors.Black;
                break;

            default:
                color = Colors.Black;
                break;
            }
        }
Esempio n. 5
0
        void Storyboard_Completed(object sender, EventArgs e)
        {
            if (_messageList.Count > 0)
            {
                textBlock.Text = _messageList.Dequeue();

                FlyMessageType type = _messageTypeList.Dequeue();

                Color color;
                ConvertMessageTypeToColor(type, out color);
                textBlock.Foreground =
                    new SolidColorBrush(color);

                SetMessageIcon(type);

                Storyboard.Begin();
            }
            else
            {
                _isRunning = false;
            }
        }
Esempio n. 6
0
        private void SetMessageIcon(FlyMessageType type)
        {
            switch (type)
            {
            case FlyMessageType.Celebrate:
                image.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.MessageCelebrate);
                break;

            case FlyMessageType.Criticism:
                image.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.MessageCriticism);
                break;

            case FlyMessageType.Prompt:
                image.Source =
                    BlackboxImageUtils.Image(BlackboxImageType.MessagePrompt);
                break;

            default:
                break;
            }
        }