system.reactive

What is the practical difference among all of these Reactive Observable extensions?

Given a BehaviorSubject, what is the practical difference between calling all of these different functions on it? First() Last() LatestValue() MostRecentValue() NextValue() Single() Take(1) Assuming I understand it right, they should all do about the same thing, given the BehaviorSubject. If so, then which call is the most appropria...

Combining Multiple Events in RX

I have 2 touch enabled Canvas' in a Silverlight App. What I need to do is when a person Holds (presses and keeps pressing) both canvases at the same time increment a value on the screen once. This should happen for every "double" hold. I can do that fine using normal events but tried writing the same thing using RX and I am getting stu...

Reactive Framework ASP.NET MVC

Is it possible to apply reactive frame work in MVC application? or is it applicable for WPF? ...

Time flies like an arrow demo in WinForms

Looking at the Reactive Extensions for javascript demo on Jeff Van Gogh's blog, I thought I'd give it a try in C#/Winforms, but it doesn't seem to work so well. I just threw this into the constructor of a form (with the Rx framework installed and referenced): Observable.Context = SynchronizationContext.Current; var mousemove = Observab...

How can you do Co-routines using C#?

In python the yield keyword can be used in both push and pull contexts, I know how to do the pull context in c# but how would I achieve the push. I post the code I am trying to replicate in c# from python: def coroutine(func): def start(*args,**kwargs): cr = func(*args,**kwargs) cr.next() return cr return start @corouti...

Zipping Rx IObservable with infinite number set

I have a IObservable [named rows in the sample below] from Reactive extensions framework and I want to add index numbers to each object it observes. I've tried to implement this using Zip function: rows.Zip(Enumerable.Range(1, int.MaxValue), (row, index) => new { Row = row, Index = index }) .Subscribe(a => ProcessRow(a.Row, a....

What are the Hot and Cold observables?

I watched the video and I know the general principles - hot happens even when nobody is subscribed, cold happens "on demand". Also, Publish() converts cold to hot and Defer() converts hot to cold. But still, I feel I am missing the details. Here are some questions I'd like to have answered: Can you give a comprehensive definition for ...

Use .net reactive in silverlight to generate multiple events.

I have a method in a silverlight application. I want to start calling this method when an event occurs (mouse move), and continue to call this method every 1 second until a simple boolean condition changes. Is this possible ? I can't work out how to get the rx to generate multiple 'events' from the single event ...

TPL v/s Reactive Framework

When would one choose to use Rx over TPL or are the 2 frameworks orthogonal? From what I understand Rx is primarily intended to provide an abstraction over events and allow composition but it also allows for providing an abstraction over async operations. using the Createxx overloads and the Fromxxx overloads and cancellation via dispos...

Good example of Reactive Extensions Use

I understand the basics of Rx. Where I'm struggling is how you would actually use this beyond academic examples? What are some common, simple real-world scenarios where Rx is a much better solution than what we have today in .NET? ...

What's the best way to structure this Linq-to-Events Drag & Drop code?

I am trying to handle a drag & drop interaction, which involves mouse down, mouse move, and mouse up. Here is a simplified repro of my solution that: on mouse down, creates an ellipse and adds it to a canvas on mouse move, repositions the ellipse to follow the mouse on mouse up, changes the colour of the canvas so that it's obvious wh...

Rx: Piecing together multiple IObservable web requests

Hello, I'm creating multiple asynchronous web requests using IObservables and reactive extensions. So this creates observable for "GET" web request: var tweetObservalue = from request in WebRequestExtensions.CreateWebRequest(outUrl + querystring, method) from response in request.GetResponseAsync()...

How can I dispatch an PropertyChanged event from a subscription to an Interval based IObservable

I'm getting an 'UnauthorizedAccesExpection - Invalid cross-thread access' exception when I try to raise a PropertyChanged event from within a subscription to an IObservable collection created through Observable.Interval(). With my limited threading knowledge I'm assuming that the interval is happening on some other thread while the even...

What does System.Concurrency.AsyncLock do?

The System.Reactive.dll adds a class AsyncLock to System.Concurrency. It has a single instance method, Wait, that takes an Action. The documentation page I found just tells it it pre-release documentation, so I ask here: What does this class do? ...

Is the Reactive Framework (RX) available for use in Mono yet?

Been searching but the only thing I found was http://evain.net/blog/articles/2009/07/30/rebasing-system-reactive-to-the-net-clr which I got to work, but it feels like there should be a simpler way, specially since rx was first release back in mid 09. ...

Reactive Extensions vs FileSystemWatcher

One of the things that has long bugged me about the FileSystemWatcher is the way it fires multiple events for a single logical change to a file. I know why it happens, but I don't want to have to care - I just want to reparse the file once, not 4-6 times in a row. Ideally, there would be an event that only fires when a given file is done...

Rx framework: How to wait for an event to be triggered in silverlight test

Hi, I have a ViewModel that starts loading the Model async in the constructor, and triggers an event when the Model is loaded. I got a test working with the silverlight unit test framework, like this : bool done = false; [TestMethod] [Asynchronous] public void Test_NoCustomerSelected() { ProjectListViewMode...

Creating a mouse drag done observable with Reactive Extensions

I have the following var leftMouseDown = Observable.FromEvent<MouseButtonEventArgs>(displayCanvas, "MouseLeftButtonDown"); var leftMouseUp = Observable.FromEvent<MouseButtonEventArgs>(displayCanvas, "MouseLeftButtonUp"); var mouseMove = Observable.FromEvent<MouseEventArgs>(displayCanvas, "MouseMove"); var leftMouseDragging = from down ...

How to use Rx to asynchronously query Twitter search ?

Hi, I'm thinking about using Rx (Reactive Framework) in order to asynchronously query Twitter search API on a given keyword. The sample app I'd like to build should be able to display new tweets in the console. Do you think it is possible to do that ? Would it be simpler than using standard programming techniques ? How would you do th...

How is IObservable<double>.Average supposed to work?

Update Looks like Jon Skeet was right (big surprise!) and the issue was with my assumption about the Average extension providing a continuous average (it doesn't). For the behavior I'm after, I wrote a simple ContinuousAverage extension method, the implementation of which I am including here for the benefit of others who may want somet...