Accessing Treeview from a dllplugin. C#
I am writing a plugin for an app that needs to access the client's treeview. What is the best way to开发者_如何学编程 do this? Would it simply be the case of passing the treeview reference through to the dll?
The plugin will need to update the treeview based on data being uploaded to a database from the plugin. When this data is uploaded, additional nodes will require to be added to the treeview. I have methods that fulfil this functionality within the client, however I need this to be achieved through the dll.
Thanks.
I think that the best way to achieve this is changing the architecture a bit. Your component that monitors database should declare an event i.e: RecordsAdded. The treeview should add its own handler to that event, which would update its content as desired. Possibly there should be more tiers, but that is just an idea, not a complete solution.
A good solution (which I actually used myself) is to do like IIS 7 do and let the user register "hierarchy providers" that manipulate the nodes in the tree.
You can read more about the IIS 7 tree manipulation and get some inspiration here: http://blogs.msdn.com/b/carlosag/archive/2006/08/12/extendingtreeview.aspx
精彩评论