DynamoDS/Dynamo — pull request #2412 by Steell (2014-09-15 15:39:26+00:00)
Title: Fix DefaultWatchHandler not accessing RevitWatchHandler when traversing collections: MAGN-4347

@ikeough

Due to the recent `IWatchHandler` refactor, when the `DefaultWatchHandler` is invoked from the `RevitWatchHandler`, any dynamic dispatch being done inside the `DefaultWatchHandler` does not invoke methods declared in the `RevitWatchHandler`. This is because all methods that perform dynamic dispatch in the `DefaultWatchHandler` invoke the dynamic `Process` method implemented on the `DefaultWatchHandler`.

The symptom of this was that when traversing collections (handled in the `DefaultWatchHandler`) of Revit `Element` instances, those instances were not being handled in the `RevitWatchHandler`, and thus the buttons wouldn't appear in the Watch node.

To fix this, I've added a callback argument that passes the appropriate `Process` method to all the dynamic dispatch targets. Whenever a `ProcessThing` method needs to perform a dynamic dispatch, it calls the function passed in via the `callback` argument, as opposed to directly calling the dynamic `Process` method. The callback is initially provided by the `GenerateWatchViewModelForData` method, which passes the original dynamic `Process` method as the callback.