I'm very new to C# and reading about attributes, is there a keypress attribute?

Posted by akevit on Stack Overflow See other posts from Stack Overflow or by akevit
Published on 2014-06-07T03:20:07Z Indexed on 2014/06/07 3:24 UTC
Read the original article Hit count: 97

Filed under:

I'm coming from intermediate java level and I wanted to spend some time tonight learning C#, partly because a game I used to play is now free to play (Asheron's Call) and when I used to play I had always wanted to write a plugin for Decal but 10 years ago I didn't know nearly enough to do anything. Anyways most of that won't mean much to anyone, but what I essentially want to do is something along the lines of (psuedo code):

[KeyPressEvent("KeyPressed")]
private void KeyPressed(object sender, KeyPressEventArgs args) {
    if (args.KeyPressed == VK_K) {
        // Do stuff
    }
}

If I'm not providing enough information or if my description of what I want to do is a little off base let me know. Most plugins for this are written in VB6, but in the past few years Decal has upgraded to .NET 3.5 support so I can use things up until there; a lot of the VB6 stuff uses event subscriptions (e.g. Core.EchoFilter.ServerDispatch += EchoFilter_ServerDispatch;)

My C# vernacular is not up to part, but on that notion I haven't done a whole lot of Java projects that related to events (or Observers as I believe they're referred to as).

© Stack Overflow or respective owner