Created
June 28, 2011 03:42
-
-
Save dtchepak/1050445 to your computer and use it in GitHub Desktop.
Observing combinations of events where another event does not occur
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mouseDown = Observable.FromEventPattern(firstButton, "MouseDown"); | |
var mouseUp = Observable.FromEventPattern(firstButton, "MouseUp"); | |
var mouseMove = Observable.FromEventPattern(firstButton, "MouseMove"); | |
mouseDown.Subscribe(x => Debug.WriteLine(">>> mouse down")); | |
mouseUp.Subscribe(x => Debug.WriteLine(">>> mouse up")); | |
(from down in mouseDown | |
from up in mouseUp.TakeUntil(mouseMove) | |
select up) | |
.Subscribe(x => Debug.WriteLine(">>> mouse down then up without move")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
...and the same thing as done in WPF: