system.reactive

Invoking source property update on a non-UI thread in two-way data binding

送分小仙女□ 提交于 2019-12-13 21:28:29
问题 Suppose I have a WPF two-way data binding between a source (CLR property) and a destination (UI control property). Now anytime the destination property is updated, I want to update the source property on a non-UI thread (not on Dispatcher thread). In my application, I am using Rx (Reactive Extension) Scheduler, thus, I plan to provide one Rx scheduler for the execution. As an example, if I bind the property Value of the following object and the UI updates the property using the binding, I

something like INotifyCollectionChanged fires on xml file changed

隐身守侯 提交于 2019-12-13 21:08:18
问题 It's possible to implement INotifyCollectionChanged or other interface like IObservable to enable to bind filtered data from xml file on this file changed ? I see examples with properties or collection, but what with files changes ? I have that code to filter and bind xml data to list box: XmlDocument channelsDoc = new XmlDocument(); channelsDoc.Load("RssChannels.xml"); XmlNodeList channelsList = channelsDoc.GetElementsByTagName("channel"); this.RssChannelsListBox.DataContext = channelsList;

How to combine GroupedObservables in rx.net?

倾然丶 夕夏残阳落幕 提交于 2019-12-13 20:14:09
问题 I have one observable that I use GroupBy on to get a number of streams. I actually want a Scan result over each sub-stream. Let's say the observable is over product prices and the scan result is average price per product type. I have another stream of events pertaining to those 'products' (let's say "show product price" events) and I want to combine it with the previous stream's latest product price. So the Scan output per group needs to be combined with each element of the event stream to

How do I combine three observables such that

强颜欢笑 提交于 2019-12-13 18:28:20
问题 If I have three observables, how do I combine them such that when the first emit a new value, I can combine that with the latest emitted from the other two.. Its important that we only produce a new value of the combined observables when the first observable has a new value regardles of whether the other two has emitted new values. Thanks. 回答1: You could do this (note that you get default values for sources 2 and 3 if they have yet to emit, and I have allowed for you to optionally supply

Merging Observables with feedback, merging Observable with Itself

可紊 提交于 2019-12-13 17:56:16
问题 I need to create Observable, that will collect information from different sources(other Observables), and each source has impact on the event value, but still, the value is built based on previous value(kind of state machine). We have message with int value and operation code: class Message{ Integer value; String operation; public Message(Integer value, String operation) { this.value = value; this.operation = operation; } } And some source of such values, with init value: Observable<Message>

Rx: operator for getting first and most recent value from an Observable stream

末鹿安然 提交于 2019-12-13 14:13:39
问题 For an Rx based change tracking solution I am in need of an operator which can get me the first and most recent item in an observable sequence. How would I write an Rx operator that produces the following marble diagram ( Note: the brackets are used just to lineup the items...I'm not sure how best to represent this in text ): xs:---[a ]---[b ]-----[c ]-----[d ]---------| desired:---[a,a]---[a,b]-----[a,c]-----[a,d]---------| 回答1: Using the same naming as @Wilka you can use the below extension

Subscribing to a future observable

十年热恋 提交于 2019-12-13 09:13:25
问题 I have na event-based API (Geolocator) that I want to convert to Rx . The problem is that some operations require that all events are unsubscribed and I don't want to pass that burdon to the user of the Rx API. So, the user will subscribe to a few observables and when the events are subscribed they are published to those observables. What's the best way to do this? I thought of creating a subject that the users subscribe to and then have the events published to those through another set of

Any Rx operator that returns both the input variable and the result?

我们两清 提交于 2019-12-13 07:35:44
问题 When using Rx (specifically, RxJava), is there an operator that will package the input variable along with the function's output, in order to use both in the next step? For example, let's say I start with a list of Tweet ID's, and my program a) does a REST call to get the text of that tweet and b) saves the id and text into a local database. A normal "map" will return the text for step a, but it discards the original id. In code: Observable.from(tweet_id_list) .specialMap(i -> getTweetText(i)

Best way to keep actual data in application

ⅰ亾dé卋堺 提交于 2019-12-13 05:29:59
问题 I Faced some problem with the relevance of the data in application. In our app we have 1 activity and many fragments. For example, we have 1 Fragment with list of User and there button for like(with 3 states: none/like/favorite). In next page we have full description of User and like button too. If we press like button in userList, there will be no problem and in details screen we see correct like state. But if we click like button in User details and go back to list, there still past data

Publishing decoded messages from a Stream while keeping encapsulation in Rx

荒凉一梦 提交于 2019-12-13 05:07:27
问题 I'm new to using Rx and I've been trying to re-write my MVC w/ Service Layer ( NOT ASP !) to use this awesome new-fangled Rx. I have a class called Remote which encapsulates a NetworkStream . The Remote uses Rx to listen to bytes from the NetworkStream and once it works out it's received a full message worth of data, it decodes that data into an IMessage . I get how I can read from the Stream continuously using Rx from inside the Remote , but how do I publish decoded IMessage from that stream