Esempio n. 1
0
        public static void Initialize()
        {
            _globalHook                = Hook.GlobalEvents();
            _globalHook.KeyDown       += GlobalHookKeyPressHandler;
            _globalHook.MouseWheelExt += GlobalHookMouseScrollHandler;

            // #TODO: Remap all actions to json read local file for allowing user bindings
            var exit       = Sequence.FromString("Shift+Z, Shift+Z");
            var assignment = new Dictionary <Sequence, Action>
            {
                { exit, ExitApplication }
            };

            _globalHook.OnSequence(assignment);
        }
        private void AnyKey_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName is nameof(ILaminarValue.Value))
            {
                Combination[] combinations = new Combination[Keys.VisualComponentList.Count];
                int           i            = 0;
                foreach (INodeField field in Keys.VisualComponentList)
                {
                    combinations[i] = Combination.TriggeredBy(field.GetInput <Keys>());
                    i++;
                }
                sequence = Sequence.Of(combinations);

                _globalHook?.Dispose();
                _globalHook = Hook.GlobalEvents();
                _globalHook.OnSequence(new KeyValuePair <Sequence, Action>[] { new KeyValuePair <Sequence, Action>(sequence, ActivateTriggerOnKeyUp) });
            }
        }
Esempio n. 3
0
        private void TextInputChanged(object obj)
        {
            if (obj as string is null or "")
            {
                _globalHook?.Dispose();
                return;
            }

            Combination[] combinations = new Combination[((string)obj).Length];
            int           i            = 0;

            foreach (char ch in (string)obj)
            {
                combinations[i] = Combination.TriggeredBy(TextTyper.ConvertCharToKey(ch));
                i++;
            }
            Sequence sequence = Sequence.Of(combinations);

            _globalHook?.Dispose();
            _globalHook = Hook.GlobalEvents();
            _globalHook.OnSequence(new KeyValuePair <Sequence, Action>[] { new KeyValuePair <Sequence, Action>(sequence, ActivateTriggerOnKeyUp) });
        }