예제 #1
0
        public bool TryProcessEvent(KeyboardEvent evnt, out string result)
        {
            result = string.Empty;
            if (!evnt.IsChar)
            {
                Keys keyCode = evnt.Keys & Keys.KeyCode;

                switch (keyCode)
                {
                    case Keys.LControlKey:
                    case Keys.RControlKey:
                    case Keys.LShiftKey:
                    case Keys.RShiftKey:
                    case Keys.RMenu:
                    case Keys.LMenu:
                        return true;
                }

                if (evnt.Keys.HasFlag((Keys)524288)) return false;
                if (!evnt.Keys.HasFlag(Keys.Control) && !evnt.Keys.HasFlag(Keys.Alt)) return false;
                if (evnt.Keys == Keys.Alt || evnt.Keys == Keys.Control) return false;

                //Keys n = keyCode & ~(Keys.LControlKey | Keys.RControlKey | Keys.LShiftKey | Keys.RShiftKey | Keys.LMenu | Keys.RMenu);
                //if (n == Keys.None) return true;

                result = (string)_keysConverter.ConvertTo(evnt.Keys, typeof(string));
                return true;
            }

            return false;
        }
예제 #2
0
        public bool TryProcessEvent(KeyboardEvent evnt, out string result)
        {
            result = null;
            if (evnt.IsChar)
            {
                result = evnt.Char.ToString();
                return true;
            }

            return false;
        }
        public bool TryProcessEvent(KeyboardEvent evnt, out string result)
        {
            result = null;

            if (!evnt.IsChar && _translation.ContainsKey(evnt.Keys))
            {
                result = _translation[evnt.Keys];
                return true;
            }

            return false;
        }
예제 #4
0
        public bool TryProcessEvent(KeyboardEvent evnt, out string result)
        {
            result = null;
            if (evnt.Keys.HasFlag((Keys)524288))
            {
                return false;
            }

            Keys n = evnt.Keys & Keys.KeyCode;

            if (evnt.IsChar)
            {
                result = evnt.Char.ToString();
                return true;
            }
            else
            {
                result = _converter.ConvertToString(evnt.Keys);
                result = result.Replace("+None", "");
                return true;
            }
        }
예제 #5
0
        public bool TryProcessEvent(KeyboardEvent evnt, out string result)
        {
            result = null;
            var k = evnt.Keys;
            switch (_state)
            {
                case 0:
                    if (k.HasFlag(Keys.Control) && k.HasFlag(Keys.K)) _state = 1;
                    break;
                case 1:
                    if (k.HasFlag(Keys.Control) && k.HasFlag(Keys.L))
                    {
                        _state = 2;
                        _startIndex = _index;
                    }
                    else _state = 0;
                    break;
                case 2:
                    if (k.HasFlag(Keys.Control) && k.HasFlag(Keys.K)) _state = 3;
                    else if (_index > _startIndex && _index < _endIndex)
                    {
                        result = "*";
                        return true;
                    }
                    break;
                case 3:
                    if (k.HasFlag(Keys.Control) && k.HasFlag(Keys.L)) _state = 0;
                    else
                    {
                        _state = 0;
                        _endIndex = _index;
                    }
                    break;
            }

            _index++;

            return false;
        }
예제 #6
0
 private void AddToBuffer(KeyboardEvent evnt)
 {
     _buffer.Add(evnt);
     OnPropertyChanged("Buffer");
 }
예제 #7
0
 private void AddToBuffer(KeyboardEvent evnt)
 {
     _buffer.Add(evnt);
     OnPropertyChanged("Buffer");
 }