示例#1
0
        private bool SetBindState(KeyBinding binding, BoundKeyState state)
        {
            binding.State = state;

            var eventArgs = new BoundKeyEventArgs(binding.Function, binding.State,
                                                  new ScreenCoordinates(MouseScreenPosition), binding.CanFocus);

            UIKeyBindStateChanged?.Invoke(eventArgs);
            if (state == BoundKeyState.Up || !eventArgs.Handled)
            {
                KeyBindStateChanged?.Invoke(eventArgs);
            }

            var cmd = GetInputCommand(binding.Function);

            if (state == BoundKeyState.Up)
            {
                cmd?.Disabled(null);
            }
            else
            {
                cmd?.Enabled(null);
            }

            return(eventArgs.Handled);
        }
示例#2
0
        private void SetBindState(KeyBinding binding, BoundKeyState state)
        {
            binding.State = state;

            KeyBindStateChanged?.Invoke(new BoundKeyEventArgs(binding.Function, binding.State, new ScreenCoordinates(MouseScreenPosition)));

            var cmd = GetInputCommand(binding.Function);

            if (state == BoundKeyState.Up)
            {
                cmd?.Disabled(null);
            }
            else
            {
                cmd?.Enabled(null);
            }
        }