system.reactive

SignalR and Reactive combo

萝らか妹 提交于 2019-12-08 05:42:05
问题 I found this little gem about how to get SignalR and Rx to play nicely: Rx and Reactive Tutorial However as you might have noticed this only works when going from server -> client. Does anyone know how to go the other way around? I want my framework to be a bit more "message" based like NServiceBus and less RPC (which signalr standard examples tend to be). The reason for this is the weakly typed world doesn't lend itself very well to RPC. On the server side I'd love to be able to put

Update WPF progress bar while filling DataSet, all using Rx

99封情书 提交于 2019-12-08 04:32:07
问题 I'm a bit new in Rx, so please excuse me if this seems silly or obvious... I have an application which at a certain time, is meant to scan a selected folder and retrieve all files recursively, after which it needs to store them in a database. I would like to display a progress bar during that process while keeping the UI responsive of course. A cancel button would also be nice at a later stage. I've implemented this using Rx, like so: // Get a list of all the files var enumeratedFiles =

Rx.NET: Combine observables in order

时间秒杀一切 提交于 2019-12-08 03:43:05
问题 I have 2 IConnectableObservables where one is replaying old historic messages and the other is emitting fresh current values: HistoricObservable: - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - ... CurrentObservable: - - - - - 5 - 6 - 7 - 8 - 9 - 10 - ... How can I merge them into a single observable such that I get the full (correct) sequence from both observables, but also drop the subscription and call Dispose on the HistoricObservable subscription once I've started emitting values from

Buffer by time or running sum for reactive extensions

空扰寡人 提交于 2019-12-08 02:25:49
问题 I'm quite new to Reactive Extensions and want to buffer a stream based on time, or by a running sum not exceeding a threshold (size of each item is specified by a lambda) whichever occurs first, much like the existing Buffer by count or time. Currently I have written my own implementation of a Buffer method that works as expected, using the IScheduler for triggering on timeout, and then managing my own buffers in memory and emitting them whenever the accumulated sum exceeds the threshold, but

What is the proper way to determine the end of a mouse drag using Rx?

萝らか妹 提交于 2019-12-08 02:01:56
问题 I am slowly learning how to use Reactive Extensions for .NET with WPF. There a few beginner examples about how simple it is to write drag-drop or drawing routines but they are all extremely simple. I'm trying to go one step further and it's not obvious to me what the "proper" way is. The examples all show how you can define streams of events from MouseDown , MouseMove , and MouseUp var mouseDown = from evt in Observable.FromEvent<MouseButtonEventArgs>(..., "MouseDown") select evt.EventArgs

Convert Railway oriented failure track to Rx friendly errors

非 Y 不嫁゛ 提交于 2019-12-08 01:52:39
问题 I'm using a library that takes the results as two-track values (success and failure).In the Observable.map function bodies I often get an observable from success track of a function, and I don't know how to handle them (at Observable.map body). In the other words I often get stuck in situations that the result looks something like the following (of course it's the simplest one): Rop.Result<IObservable<Rop.Result<IObservable,Messages>,Messages> On one hand, translating messages back to

Using Rx over events on a WPF UserControl, why does the control receive a mousedown and mousemove when the window is maximized?

落爺英雄遲暮 提交于 2019-12-08 01:32:54
问题 This one's got me a bit baffled. I've written some extension methods on UIElement to provide Observables on some of the mouse events. Here are the relevant ones: public static IObservable<EventPattern<MouseEventArgs>> ObserveMouseLeftButtonDown(this UIElement element) { return Observable.FromEventPattern<MouseEventArgs>(element, "MouseLeftButtonDown"); } public static IObservable<EventPattern<MouseEventArgs>> ObserveMouseMove(this UIElement element) { return Observable.FromEventPattern

Between values with Rx

主宰稳场 提交于 2019-12-08 01:10:58
问题 Is there some extension method in Rx to do the scenario below? I have a value to start the pumping (green circles) and other value to stop the pumping (reed circles), the blue circles should be the expected values, I would not want this command to be canceled and recreated (ie "TakeUntil" and "SkipUntil" will not work). The implementation using LINQ would be something like this: public static IEnumerable<T> TakeBetween<T>(this IEnumerable<T> source, Func<T, bool> entry, Func<T, bool> exit) {

Best way to get an IObservable<T> from Action<T>

佐手、 提交于 2019-12-07 21:38:44
问题 I have a method void OnAction(Action<Person> callback) and I wanna create an IObservable<T> from this using the reactive extensions (Rx). I have found two methods that could help me: Observable.FromEvent() and Observable.Start() : var observable = Observable.Start(() => { Person person = null; _mngr.OnAction(p => person = p); return person; }); and: var observable = Observable.FromEvent<Person>( action => _mngr.OnAction(action), //Add Handler action => // Remove Handler { }); The first one

ObserveOn with Scheduler.NewThread does not observe so, if observer's OnNext is blocked and continued

喜欢而已 提交于 2019-12-07 18:52:07
问题 Can some one please help explain why when I "block and continue" observer's onNext sequence subscribed to a buffer with time observable sequence, that Scheduler.NewThread does not apply anymore? For example: If I buffer a sequence of number via var query = from number in Enumerable.Range(1,200) select SnoozeNumberProduction(number); var observableQuery = query.ToObservable(); var bufferedSequence = observableQuery.Buffer(TimeSpan.FromSeconds(2)); Where SnoozeNumberProduction delays the number