I like to use reactive extension throttle on my user interface. A simple example will be when you need to make auto complete textbox, you don’t want to respond to the user typing’s event for every type he made but wait for a second or less before you load any data related with his typing values.

var second=1
Observable.FromEventPattern<TextValueChangedEventArgs>(textBox, "TextValueChangedEventArgs")
                .Throttle(TimeSpan.FromSeconds(second), new DispatcherScheduler(Application.Current.Dispatcher))
                .Subscribe(o =>
                {
                   //do load data here                    
                });
//new DispatcherScheduler(Application.Current.Dispatcher) - this will make your wpf ui thread safe
Advertisements