Answer the question
In order to leave comments, you need to log in
How to programmatically trigger an event using Rx?
Hello.
When we work with events directly, everything is simple
ListBox lb = new ListBox();
lb.SelectedValueChanged += LbOnSelectedValueChanged;
....
private void LbOnSelectedValueChanged(object sender, EventArgs eventArgs)
{
....
}
IObservable<EventArgs> selectedValueChanged = Observable.FromEventPattern<EventHandler, EventArgs>(
h => lb.SelectedValueChanged += h,
h => lb.SelectedValueChanged -= h).Select(x => x.EventArgs);
selectedValueChanged.Delay(TimeSpan.FromSeconds(10)).Where(ts =>
{
return IsCorrect();
}).Subscribe(x =>
{
.....
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question