Is it possible to disable my plugin after loading?
I start running a background worker in the OnLoad to speed up the login.
But after the background worker ends and the result is out of date I want to disable the plugin.
Is there an easier way than add a line in each command that the plugin is disabled?
What I now tried is to make a public variable that says true or false and when a command runs check if it is a command from my plugin, but cant figure out how to cancel the command from continueing.
Private Sub StartOfCommand(ByVal sender As Object, ByVal e As Rhino.Commands.CommandEventArgs)
If Definitions.PluginEnabled = False Then
If e.CommandPluginName = MyPlugin.MyPlugin.Instance.Name Then
'concel command from continueing here'
End If
End If
End Sub
Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As RunMode) As Result
If Not MyPlugIn.Instance().IsEnabled Then
RhinoApp.WriteLine("Plug-in disabled.")
Return Result.Failure
End If
' TODO...
Return Result.Success
End Function
Why donāt you just have an abstract base command class that all your other commands derive from? Then you can have this same functionality implemented in all of your commands.
I took a look at the button editor (per a previous question/answer [ here ]) and I now understand how to produce a button that launches a plugin.
I see that there is a left and right mouse button option and would like the right click to trigger an āendā process. So the question is really: How can one stop a plugin in a similar way to the English language method provided many of the development examples. Is there a way to do this?
I would like to tie an enlgish language āstopā command to the right mouse button.
Iāve sucessfully produced the RHI file and I believe that itās being installed correctly via your installer. Inside the RHI Iāve produced the specified document structure which includes a custom toolbar (RUI) for the plugin.
Two brief follow-up questions:
I notice that the toolbar icon doesnāt load - rather I see a : ) instead of my own icon. Do I need to place the icon file in any particular location? I was thinking that it would be wrapped by the RUI automatically.
Is there a way for me to unload the plugin that I just installed in order to retest it cleanly? Iāve tried to do the remove manually by deleting the installed plugin file but the plugin still lists in my rhino preferences. If possible Iād like to completely remove the plugin so that I can faithfully test the install process as a new user wouldā¦
1.) I am confused by your first question. But basically you use Rhino to create toolbars and toolbar buttons. The Toolbar command had a button editor that allows you to assign images to buttons, which are then embedded in RUI files. RUI files do not reference external icon files. Does this help?
2.) Not really. To really uninstall a plug-in, you must remove its entry from the Windows Registry.