Getting Started With Reactive Extensions – 2nd Part

Hi Friends,

In this section, we will continue from the previous section and we will few examples around UI side. Let us suppose the below snippet, where in i have simply created one windows form and attached a textbox to it.

Now, with the above change in place, it will simply give me one windows form with one text-box in it.

9th Now, here I would like to listen to text changed event. So, what i would do? I will simply go ahead and attach text changed handler as shown below in the snippet. 10th Therefore, it has created the below sample event code.

But, here also if you look below screenshot, textchanged is not available.

11th

Hence, this won’t be helpful for me. Rather than that, I would prefer to have reactive extension and subscribe the same as shown below.

Now, if you see below in the screenshot, it gave me EventArgs. 12th Really

Here, in order to get changed text, I need to make use of LINQ on the top of Rx. Hence, below is the finished code for the same. I have done little bit of refactoring as well, just to keep the code more readable and clean.

Hence, with the above change in place, when I run the app, it will produce me the below output.

13th

You can also download the source code from here https://github.com/rahulsahay19/RxSample

With this I would like to wrap this session here. Thanks for joining me.

Thanks,
Rahul Sahay
Happy coding

1,586 total views, 1 views today