Пример #1
0
        private void Notification_MouseClick(object sender, MouseEventArgs e)
        {
            if (_showFullWords)
            {
                WordsNotifier.Word w = _mainForm.GetWord(false);
                labelTitle.Text = w.word;

                ShowFullListWords();
            }
            else
            {
                switch (_mainForm.GetMode())
                {
                case WordsNotifier.Mode.HideTranslation:
                {
                    WordsNotifier.Word w = _mainForm.GetWord(false);
                    labelBody.Text = w.translation;
                    _showFullWords = true;
                    break;
                }

                case WordsNotifier.Mode.Inverse:
                {
                    WordsNotifier.Word w = _mainForm.GetWord(false);
                    labelBody.Text = w.word;
                    _showFullWords = true;
                    break;
                }
                }
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="title"></param>
        /// <param name="body"></param>
        /// <param name="duration"></param>
        /// <param name="animation"></param>
        /// <param name="direction"></param>
        public Notification(WordsNotifier.Form1 form, int duration, FormAnimator.AnimationMethod animation, FormAnimator.AnimationDirection direction, Position position)
        {
            InitializeComponent();

            _mainForm = form;

            if (duration < 0)
            {
                duration = int.MaxValue;
            }
            else
            {
                duration = duration * 1000;
            }

            WordsNotifier.Word w = _mainForm.GetWord(true);

            switch (_mainForm.GetMode())
            {
            case WordsNotifier.Mode.Default:
            {
                _showFullWords  = true;
                labelTitle.Text = w.word + "[" + w.part + "]";
                labelBody.Text  = w.translation;
                break;
            }

            case WordsNotifier.Mode.HideTranslation:
            {
                _showFullWords  = false;
                labelTitle.Text = w.word + "[" + w.part + "]";
                labelBody.Text  = "[click to show translation]";
                break;
            }

            case WordsNotifier.Mode.Inverse:
            {
                _showFullWords  = false;
                labelTitle.Text = w.translation + "[" + w.part + "]";
                labelBody.Text  = "[click to show the word]";
                break;
            }
            }

            lifeTimer.Interval = duration;

            _position = position;

            _animator = new FormAnimator(this, animation, direction, 500);

            _hrgn  = NativeMethods.CreateRoundRectRgn(0, 0, Width - 5, Height - 5, 20, 20);
            Region = Region.FromHrgn(_hrgn);
        }