Plugin install event

Hi Grasshopper devs,

I’m looking for an event that gets fired when the user installs a plugin by dropping it onto the canvas. Is there such thing?

Thanks and kind regards,
Paul

The GH_ComponentServer.GHAFileLoaded event does that.

Thanks for the info :slight_smile:
However, I cannot get it to work.
I’m registering a handler like so:

Grasshopper.Instances.ComponentServer.GHAFileLoaded -= new GH_ComponentServer.GHAFileLoadedEventHandler(HandlerPluginLoaded);
Grasshopper.Instances.ComponentServer.GHAFileLoaded += new GH_ComponentServer.GHAFileLoadedEventHandler(HandlerPluginLoaded); 

public void HandlerPluginLoaded(Object sender, GH_GHALoadingEventArgs e)
{
	// Do something...
}

If I now drag e.g. the Hoopsnake GHA onto the canvas it get’s copied to the Libraries folder and becomes available in Grasshopper, but my HandlerPluginLoaded does not get called…

Am I doing something wrong here?

Works here when testing with the GrasshopperImagingComponent.gha file. I can try with HoopSnake.gha as well.

Hoopsnake is fine too:

1 Like

You are right, it works.
I was registering the handlers from within a custom widget which gets instanciated once I place the first component onto the canvas, i.e. once the first document is created.
I was dragging the Hoopsnake onto the virgin canvas all the time so my widget wasn’t even there yet…

ps: thanks for the Rhino.RhinoApp.WriteLine(), didn’t know that one…