Forum

How i can detect if a node is selected via plugin interface?

want to get the id paths of selected nodes. but how? couldnt find the info on the plugin specs page.

thx
ele

to move the solution from skype to the forum:
either IHDEHost.NodeSelectionChanged event for the INode2
or IHDEHost.GetXMLSnippetFromSelection method to receive the xml

thx woei, so far.

as a beginner im struggling with the concept of events in csharp, respectively the syntax to catch them.

found this: http://www.codeproject.com/Articles/11541/The-Simplest-C-Events-Example-Imaginable

and this: http://www.codeproject.com/Articles/20895/Delegates-for-Dummies

dont really get it :(

something like this:

public class MyPlugin: : IPluginEvaluate, IPartImportsSatisfiedNotification
{
  [Import()](Import())
  public IHDEHost FHDEHost;

  private INode2[]() FSelection; //for storing the selection


  public void OnImportsSatisfied() //called on creation
  {
    FHDEHost.NodeSelectionChanged += delegate(object sender, NodeSelectionEventArgs e)
    { 
	FSelection = e.Nodes; 
    };
  }
}

so each time the event is raised, that delegate is executed, which is simply saving the node selection.

thanks a lot woeishi.

still dont understand it in depth, but i got it working.

here is the plugin for those interested.

VVVVGetSelectedNode.zip (7.3 kB)