Пример #1
0
        /// <summary>
        /// Raises KeyDown Translated and KeyPress Events
        /// </summary>
        /// <param name="key"></param>
        /// <param name="keystate"></param>
        private void raiseKeyDown(Keys key, KeyboardState keystate)
        {
            // First call own Translation
            String translated = translateKey(key, keystate);

            // Call Registered Translators
            if (OnTranslating != null)
            {
                TranslatorEventArgs args = new TranslatorEventArgs(key, translated);
                OnTranslating(this, args);

                if (args.IsTranslated)
                {
                    translated = args.Translated;
                }
            }

            // Raise KeyDown
            if (OnKeyDown != null)
            {
                OnKeyDown(this, new TextInputEventArgs(key, translated));
            }

            // Raise KeyPress
            if (OnKeyPress != null)
            {
                OnKeyPress(this, new TextInputEventArgs(key, translated));
            }
        }
Пример #2
0
        /// <summary>
        /// Raises Translation and KeyUp Event
        /// </summary>
        /// <param name="key"></param>
        /// <param name="keystate"></param>
        private void raiseKeyUp(Keys key, KeyboardState keystate)
        {
            // First call own Translation
            String translated = translateKey(key, keystate);

            if (OnTranslating != null)
            {
                TranslatorEventArgs args = new TranslatorEventArgs(key, translated);
                OnTranslating(this, args);
                if (args.IsTranslated)
                {
                    translated = args.Translated;
                }
            }

            // Raise OnKeyUp
            if (OnKeyUp != null)
            {
                OnKeyUp(this, new TextInputEventArgs(key, translated));
            }
        }