Creating source node which sends new event when a property is changed #1781
-
Hello! Hope you are doing well. I'm trying to create a package that extends some functionality I need, but I'm not very familiar with C# and ReactiveX. I have already implemented the case for which I "feed" an input stream to the same source node and if any property is changed, the value of the next event is what is expected, so I believe that the problem has to do with the type of observable that I'm creating in the first case. Here's the code I'm using for both implementations:
In case it helps the properties of the node and the
Let me know if you need me to clarify the problem, because I believe my explanation is a bit confusing. Thank you in advance for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think the Bonsai source code has some examples for how to do this. For example, here. Basically, in addition to what you have already coded, you want to trigger an event that will emit a new value to the sequence whenever the property value changes. In the example above, there is a function called Inside of the |
Beta Was this translation helpful? Give feedback.
I think the Bonsai source code has some examples for how to do this. For example, here.
Basically, in addition to what you have already coded, you want to trigger an event that will emit a new value to the sequence whenever the property value changes. In the example above, there is a function called
OnValueChanged
which gets called anytime the value of the property is set. TheAction<int> ValueChanged
is a type of delegate, which takes a single argumentint
. TheOnValueChanged
method is responsible for raising theValueChanged
event.Inside of the
Generate
method,Observable.Defer(() => Observable.Return(value))
ensures that the current value is emitted when the observable sequence is sub…