| Page 11: React to Changes |
As we've seen on Page 6: React to Changes, all model types implement IElement, which itself inherits INotifyPropertyChangedPropertyChanged. We can use this event as follows:
AsyncPump.Run(
async () =>
{
using (var client = await ConnectAsync("localhost", 9000))
using (var consumer = await Consumer<SapphireRoot>.CreateAsync(client))
{
var valueChanged = new TaskCompletionSource<string>();
var positionParameter = consumer.Root.Sapphire.Sources.Fpgm1.Fader.Position;
positionParameter.PropertyChanged += (s, e) => valueChanged.SetResult(((IElement)s).GetPath());
Console.WriteLine("Waiting for the parameter to change...");
Console.WriteLine("A value of the element with the path {0} has been changed.", await valueChanged.Task);
}
});We can test this by running the above program and then modfiying a value of the parameter in Tiny Ember+.
Proceed to Page 12: Send Local Changes to the Provider.