Code Monkey home page Code Monkey logo

deftsharp.windows.input's People

Contributors

adielroyt avatar empiree avatar jaketanis avatar jo3stevens avatar jordonkane avatar michlukaszewicz avatar nullptrexception100 avatar romadanskiy avatar tmezups avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

deftsharp.windows.input's Issues

Add ability to simulate keyboard presses

It would be great to improve the KeyboardManipulator class, and add the ability to press any button you want.

For example:

var keyboardManipulator = new KeyboardManipulator()

keyboardManipulator.Press(Key.A);

This can be very useful in some usage scenarios.

Create tests for Sequences

Write KeyboardListener tests for:

  • SubscribeSequence
  • SubscribeSequenceOnce
  • Unsubscribe (Sequence)

Place it in the DeftSharp.Windows.Input.Tests.Keyboard namespace.

Please maintain consistency and pay attention to the code-style of other tests. But at the same time, don't hesitate to try something new.

Create MouseListener documentation

This task is part of the larger Create API documentation task.

Help from newcomers is welcome!

While solving this task, you can familiarize yourself with the library functionality and help other users to work with it.

To create documentation, please pay attention to the README file. The documentation should be designed in this style, and fully disclose all the features of the MouseListener class. If you have any ideas for new features of this class while writing documentation, please create a new issue and describe your idea.

Place the documentation in the Documentation.md file!

If you have any questions, feel free to post them here! Our project is beginner friendly!

Improve Unsubscribe methods

Add an overload of the Unsubscribe() method to unsubscribe from multiple keys.

In the KeyboardListener class we have convenient methods for unsubscribing by key, but nothing for unsubscribing from multiple related keys. For example, for combinations of.

I would like to implement an Unsubscribe() method overload that supports this. But we need to do it in a way that is convenient and doesn't confuse people. Because we can have a collection of single keys as well as collections of combinations and sequences.

There is an option, but I think we can come up with a better solution.

var keyboardListener = new KeyboardListener();

Key[] keys = [Key.LeftCtrl, Key.V];

keyboardListener.SubscribeCombination(keys, _ => { });
keyboardListener.Unsubscribe(keys, UnsubscribeOption.Combination);

Create tests for Combinations

Write KeyboardListener tests for:

  • SubscribeCombination
  • SubscribeCombinationOnce
  • Unsubscribe (Combination)

Place it in the DeftSharp.Windows.Input.Tests.Keyboard namespace.

Please maintain consistency and pay attention to the code-style of other tests. But at the same time, don't hesitate to try something new.

Create tests for KeyboardBinder

Write KeyboardBinder tests in the DeftSharp.Windows.Input.Tests.Keyboard namespace. Feel free to try something new, you don't have to do everything according to other tests. But if you don't have any ideas, you can look at how other tests are implemented.

Custom Interceptors

I would like to discuss one of the ideas for future releases.

This idea consists in creating a custom interceptor, the logic of which can be described in a class, for example, inheriting from CustomKeyboardInterceptor.

The logic is as follows: before any button press is processed, we pass through registered interceptors such as KeyboardListener, KeyboardManipulator, etc. If at least 1 interceptor does not allow processing of the press, it will not be processed anywhere and the OnPipelineFailed method will be called, if all interceptors allow processing of the key, the OnPipelineSuccess method will be called.

So, I'm thinking of making it possible for the user to create custom interceptors that will be registered with all other interceptors in one pipeline. This would allow the user to decide and define the processing logic. But this way is a bit more complicated than usual, so I want to focus on convenient methods, and leave this option as the last one.

Here is an example of one such class:

image

How do you feel about that?

Create KeyboardListener documentation

This task is part of the larger Create API documentation task.

Help from newcomers is welcome!

While solving this task, you can familiarize yourself with the library functionality and help other users to work with it.

To create documentation, please pay attention to the README file. The documentation should be designed in this style, and fully disclose all the features of the KeyboardListener class. If you have any ideas for new features of this class while writing documentation, please create a new issue and describe your idea.

Place the documentation in the Documentation.md file!

If you have any questions, feel free to post them here! Our project is beginner friendly!

Swap() method for KeyboardBinder

I propose to create a small method that will change button bindings between each other.

keyboardBinder.Swap(Key.Q, Key.W)

Instead of

keyboardBinder.Bind(Key.Q, Key.W);
keyboardBinder.Bind(Key.W, Key.Q);

But you need to consider the fact that one of these buttons may already be with a different bind. We need to think about what behavior is needed in such a scenario.

Create tests for SetInterval

Write KeyboardManipulator tests for:

  • SetInterval
  • ResetInterval
  • ResetIntervals

Place it in the DeftSharp.Windows.Input.Tests.Keyboard namespace.

Please maintain consistency and pay attention to the code-style of other tests. But at the same time, don't hesitate to try something new.

Long press support (KeyboardListener)

My suggestion is to make it so that the user specifies the time needed to trigger an event when a certain key is held down. This could be very useful.

Example:

var keyboardListener = new KeyboardListener();

keyboardListener.SubscribePress(Key.A, key => {
// logic
}, TimeSpan.FromSeconds(2)); // time for trigger

Implement the possibility of delayed events

Add the ability to have the event handler trigger after a certain time after the button is clicked. For example, after 5 seconds.

keyboardListener.Subscribe(Key.A, key =>
{
   // do smth after 5 seconds...
}).WithDelay(TimeSpan.FromSeconds(5));

Improve the NumpadListener class

Currently, the NumpadListener class only takes one Action<Key> argument when subscribing. It would be great to extend its functionality, and add optional parameters that exist in the Subscribe() methods in the KeyboardListener class.

  1. A TimeSpan parameter that will accept the delegate trigger interval.
  2. A KeyboardEvent parameter that will accept the event type.

Also, you can think how to improve this class. Feel free to suggest your ideas!

I will be glad to answer all your questions!

Change unsubscribe method in NumpadListener

NumpadListener is a decorator over the KeyboardListener class, it allows you to subscribe to the presses of the numeric buttons on the NumPad in a convenient way.

At the moment, when the Unsubscribe() method of NumpadListener is called, it unsubscribes from all Numpad events registered in KeyboardListener, even those created directly through KeyboardListener.

Therefore, the proposed solution is to make the NumpadListener unsubscribe only from those events that were created exclusively by it. This can be achieved by using GUID unsubscription.

Important! The Subscribe() method in NumpadListener can be called several times and more subscriptions will be created.

If there are any questions, feel free to ask! Help from newcomers is welcome!

Create tests for MouseManipulator

Write MouseManipulator tests in the DeftSharp.Windows.Input.Tests.Mouse namespace.

Please maintain consistency and pay attention to the code-style of other tests. But at the same time, don't hesitate to try something new.

Make support for combinations and sequential button presses.

1. Implement the ability to set the sequence of keystrokes as a condition for triggering an event.

For example:

  var sequence = new ButtonSequence(Key.A, Key.B);
  keyboardListener.SubscribeSequence(sequence, e => {
  // do smth...
  })

2. Implement the ability to set a combination of keystrokes as a condition for triggering an event..

For example:

  var combination = new ButtonCombination(Key.A, Key.B);
  keyboardListener.SubscribeCombination(combination, e => {
  // do smth...
  })

Manually test different combinations with Press method

In release 0.5, we added a new feature of pressing key combinations using KeyboardManipulator. But some system combinations don't work for some reason.

Our goal is to find all the combinations that don't work and find out what the problem is.

Please post here all combinations that didn't work for you.

Create a KeyboardKeySet class

There is code duplication in the project with the definition of sets of keyboard keys (for example, a collection of numpad buttons for NumpadListener class and for tests NumpadListenerSubscribeTests and NumpadListenerUnsubscribeTests).

The proposed solution is to make a KeyboardKeySet class that will provide collections of specific keyboard keys (numpad keys, number keys, function keys, etc.).

Advantages:

  • Reduce code duplication.
  • Allows users to use ready-made key sets to create their own logic.

Proposed key sets:

  • Numpad keys
  • Number keys (including numpad keys)
  • Function keys (F1, F2, ...)
  • Arrow keys
  • Navigation keys (Home, End, Page Up, Page Down)
  • Multimedia keys (Play/Pause, Stop, Previous Track, Next Track, Volume Up, Volume Down, Mute)
  • Editing keys (Backspace, Enter, Caps Lock, Insert, Delete)
  • Special keys (Control, Alt, Fn, Tab, Esc)

Create a NumberListener class

This class will handle pressing any digits on the keyboard. Follow the NumpadListener example.

The class must contain a Subscribe method that will accept Action<Key> and will subscribe to all possible number buttons, including NumPad.

And it must also contain an Unsubscribe method to unsubscribe from all keyboard events.

Important! Use GUID to unsubscribe only those subscriptions that we have created inside this class.

Create tests for custom interceptors

The 0.6 update introduced custom interceptors. It would be great to write a couple of small tests that will check their performance.

Place it in the DeftSharp.Windows.Input.Tests.CustomInterceptors namespace.

Please maintain consistency and pay attention to the code-style of other tests. But at the same time, don't hesitate to try something new.

There are no requirements as such, it all depends on your imagination. If you have any questions, I will be happy to answer them :)

Create a LetterListener class

This class will handle pressing any letters on the keyboard. Follow the NumpadListener example.

The class must contain a Subscribe method that will accept Action<Key> and will subscribe to all possible letter buttons.

And it must also contain an Unsubscribe method to unsubscribe from all keyboard events.

Important! Use GUID to unsubscribe only those subscriptions that we have created inside this class.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.