Ejemplo n.º 1
0
        public void OnKeyDown(IKeyboardPluginContext context, object sender, LowLevelKeyEventArgs e)
        {
            e.Handled = true;

            try
            {
                var keysState = e.PressedKeys;
                var input     = e.ConvertToCurrentLanguage();
                if (context.Keybinds.Contains(keysState))
                {
                    context.Keybinds.Execute(keysState, e.CurrentKeyInfo.IsKeyHoldDown);
                    _stateController.PrintState();
                    return;
                }

                if (input.Length > 0)
                {
                    _stateController.FilterHints(input);
                }
            }
            catch (Exception ex)
            {
                UIAssistantAPI.LogAPI.WriteErrorMessage(ex);
            }
        }
Ejemplo n.º 2
0
 private void Hide_KeyUp(object sender, LowLevelKeyEventArgs e)
 {
     if (UIAssistantAPI.Instance.ViewAPI.Transparent)
     {
         UIAssistantAPI.Instance.ViewAPI.Transparent = false;
         e.Handled = true;
         return;
     }
 }
Ejemplo n.º 3
0
 private void Hide_KeyDown(object sender, LowLevelKeyEventArgs e)
 {
     if (e.PressedKeys.Equals(_temporarilyHide))
     {
         UIAssistantAPI.Instance.ViewAPI.Transparent = true;
         e.Handled = true;
         return;
     }
 }
Ejemplo n.º 4
0
        private void CallPluginKeyDown(object sender, LowLevelKeyEventArgs e)
        {
#if DEBUG
            if (!e.CurrentKeyInfo.IsInjected)
            {
                UIAssistantAPI.Instance.ViewAPI.DisplayKeystroke(e);
            }
#endif
            _plugin.OnKeyDown(_context, sender, e);
        }
Ejemplo n.º 5
0
        public static void Notify(LowLevelKeyEventArgs e)
        {
            if (!IsActive)
            {
                Initialize();
            }
            var input = e.ConvertToCurrentLanguage();

            if (input.Trim().Length > 0 && char.IsLetterOrDigit(input[0]))
            {
                _visualizer?.Dispatcher.Invoke((Action)(() => Notify(input)));
            }
            else if (!e.CurrentKeyInfo.Key.IsModifiersKey())
            {
                _visualizer?.Dispatcher.Invoke((Action)(() => Notify(e.PressedKeys.ToString(), true)));
            }
        }
Ejemplo n.º 6
0
        public void OnKeyDown(IKeyboardPluginContext context, object sender, LowLevelKeyEventArgs e)
        {
            e.Handled = true;

            var keysState = e.PressedKeys;
            var input     = e.ConvertToCurrentLanguage();

            if (context.Keybinds.Contains(keysState))
            {
                context.Keybinds.Execute(keysState, e.CurrentKeyInfo.IsKeyHoldDown);
                return;
            }

            if (string.IsNullOrEmpty(input) || char.IsControl(input[0]))
            {
                return;
            }
            _stateController.Input(input);
        }
Ejemplo n.º 7
0
        private void _hook_PreviewKeyDown(object sender, LowLevelKeyEventArgs e)
        {
            if (e.CurrentKeyInfo.Key == Key.None || e.CurrentKeyInfo.Key == Key.PrintScreen)
            {
                e.Handled = true;
                return;
            }

            if (Contains(e.PressedKeys))
            {
                UIAssistantAPI.Instance.NotificationAPI.NotifyWarnMessage("Forced termination", TextID.ForcedTermination.GetLocalizedText());
                var t = Task.Run(() =>
                {
                    System.Threading.Thread.Sleep(3000);
                    System.Windows.Application.Current.Dispatcher.Invoke(() => System.Windows.Application.Current.Shutdown());
                });
                IsActive  = false;
                e.Handled = true;
                return;
            }
        }
Ejemplo n.º 8
0
        public void OnKeyUp(IKeyboardPluginContext context, object sender, LowLevelKeyEventArgs e)
        {
            var keybinds = _currentKeybinds.Keybinds;

            if (e.CurrentKeyInfo.IsInjected)
            {
                e.Handled = false;
                return;
            }
            e.Handled = true;

            var key = e.CurrentKeyInfo.Key;

            var oldKeysState = new KeySet(key);

            if (_currentKeybinds.OneShotKeybinds.Contains(oldKeysState))
            {
                keybinds.Execute(oldKeysState, e.CurrentKeyInfo.IsKeyHoldDown, KeyState.Up);
                if (e.CurrentKeyInfo.IsOneShot)
                {
                    _currentKeybinds.OneShotKeybinds.Execute(oldKeysState, e.CurrentKeyInfo.IsKeyHoldDown);
                }
                return;
            }

            var keysState = GenerateKeySet(key, e.PressedKeys);

            if (keybinds.Contains(keysState, KeyState.Up))
            {
                var operation = keybinds.GetAction(keysState, KeyState.Up);
                ReleaseKeys(keysState);
                operation?.Invoke();
                return;
            }

            e.Handled = !_currentKeybinds.IsEnabledWindowsKeybinds;
            return;
        }
Ejemplo n.º 9
0
 private void CallPluginKeyUp(object sender, LowLevelKeyEventArgs e)
 {
     _plugin.OnKeyUp(_context, sender, e);
 }
Ejemplo n.º 10
0
 public void OnKeyUp(IKeyboardPluginContext context, object sender, LowLevelKeyEventArgs e)
 {
 }
Ejemplo n.º 11
0
 private static void Handlers_KeyDown(object sender, LowLevelKeyEventArgs e)
 {
     _keybinds.Execute(e.PressedKeys, e.CurrentKeyInfo.IsKeyHoldDown);
     e.Handled = true;
 }
Ejemplo n.º 12
0
        public void OnKeyDown(IKeyboardPluginContext context, object sender, LowLevelKeyEventArgs e)
        {
            var keybinds = _currentKeybinds.Keybinds;

            if (e.CurrentKeyInfo.IsInjected)
            {
                e.Handled = false;
                return;
            }
            e.Handled = true;

            var keysState = e.PressedKeys;
            var key       = e.CurrentKeyInfo.Key;

            _currentKeySet = keysState;

            if (keysState.Keys.Count == 1)
            {
                if (_currentKeybinds.OneShotDefined.ContainsKey(keysState))
                {
                    keybinds.Execute(keysState, e.CurrentKeyInfo.IsKeyHoldDown);
                    return;
                }
            }

            var input = e.ConvertToCurrentLanguage();

            if (input.Length > 0 && _command != null)
            {
                _command.Invoke(input, keysState);
                return;
            }
            if (keybinds.Contains(keysState))
            {
                if (e.CurrentKeyInfo.IsKeyHoldDown && !keybinds.CanActWhenKeyRepeat(keysState))
                {
                    return;
                }
                var operation = keybinds.GetAction(keysState);
                ReleaseKeys(keysState);
                operation?.Invoke();
                return;
            }

            //var keyset = new KeySet(key);
            var keyset = GenerateKeySet(key, keysState);

            if (keybinds.Contains(keyset))
            {
                if (e.CurrentKeyInfo.IsKeyHoldDown && !keybinds.CanActWhenKeyRepeat(keyset))
                {
                    return;
                }
                var operation = keybinds.GetAction(keyset);
                ReleaseKeys(keysState);
                operation?.Invoke();
                return;
            }

            e.Handled = !_currentKeybinds.IsEnabledWindowsKeybinds;
            return;
        }
Ejemplo n.º 13
0
 public void DisplayKeystroke(LowLevelKeyEventArgs e)
 {
     KeyVisualizer.Notify(e);
 }