Reactive Extensions for .NET (Rx): Take action once all events are completed

Viewed 5942

As a proof of concept, I want to write "Done" in a text box after a check box has been checked and a key has been pressed in a text box (in either order). I would expect this code to handle this, but it writes Done as soon as either event happens. Thanks for your help.

var seq = Observable.FromEvent<EventArgs>(this.checkBox, "CheckedChanged")
   .Merge(Observable.FromEvent<KeyPressEventArgs>(this.textBox, "KeyPress"));

seq.Subscribe((unused) => this.resultTextBox.Text = "Done");
2 Answers
Related