Skip to content

Instantly share code, notes, and snippets.

@cryks
Created October 19, 2010 10:00
Show Gist options
  • Select an option

  • Save cryks/633948 to your computer and use it in GitHub Desktop.

Select an option

Save cryks/633948 to your computer and use it in GitHub Desktop.
KONMAI on Rx
Observable.FromEvent<KeyEventArgs>(this, "KeyDown")
.BufferWithTimeOrCount(TimeSpan.FromMilliseconds(2000), 6)
.Select(keys => keys.Select(key => key.EventArgs.KeyCode))
.Where(keys => keys.SequenceEqual(new[] { Keys.K, Keys.O, Keys.N, Keys.M, Keys.A, Keys.I }))
.Repeat()
.Subscribe(_ => MessageBox.Show("Hit !"))
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment