Are the methods an objects of GoDiagram (actual version) thread-safe?
We develop a Windows Forms App in C# with Visual Studio 2005 RC1
Best regards and greetings from Hamburg in Germany,
No, as documented, and as typical for UI Controls, GoDiagram (for Windows Forms) is not thread-safe.
However, we have implemented a number of subtle features that make programming with multiple threads much easier. As an example, the WebWalker sample application uses multiple threads, to support loading and parsing HTML pages while allowing the UI to be responsive.
And as you may have noticed, the currently available versions of GoDiagram work fine with currently available versions of .NET 2.0 and VS 2005.
In the GoDiagram FAQ it says that you need to start a timer to synchronize the thread with the view. Could you explain why this works? In webwalker, a timer is started, then the explorer thread is started. What exactly does the timer do? Thanks.
While the user is doing things in the GoView, such as selecting or deleting nodes, it wouldn’t make sense to simultaneously modify the view/document. That would be very confusing.
However, when the view isn’t doing anything else, it could add nodes that correspond to URL references that have been read from HTML documents that have been loaded by the explorer thread. The explorer thread just keeps downloading HTML pages and parsing them, resulting in structures representing HREF links.
The timer code, which runs in the GoView’s thread, looks for those structures for the pages that have been requested to be expanded (because the user double-clicked on the node), and then adds the new nodes, links them to the double-clicked node, and lays out the new ones in a circle around the double-clicked node.