public void DisplaySceneInTree() { if (sceneTreeView.InvokeRequired) { //If an invoke is required because we are running on a different thread //we make an instance of the delegate here, once Invoke is called this method //will be called again, this time in the context of the called thread //when that occurs, InvokeRequired will then have a value of 'false' //and we can then update the scenetree with the latest scene information var d = new ThreadSafeDisplaySceneElements(DisplaySceneInTree); sceneTreeView.Invoke(d, Array.Empty <object>()); } else { //grab the scene _application = (PulsarApplication)_renderScene.DrawingSurface.Application; if (_application != null) { _scene = _application.DisplayScene; _sceneTree.CurrentScene = _scene; _sceneTree.DisplaySceneElements(); } } }
void IRegisterMessage.CallBack(PulsarMessage message) { if (message != null) { switch (message.Type) { case PulsarMessage.MessageType.NodeNameChanged: case PulsarMessage.MessageType.RefreshTreeView: var displaySceneElements = new ThreadSafeDisplaySceneElements(DisplaySceneElements); _sceneTreeView.Invoke(displaySceneElements, Array.Empty <object>()); break; } } }