There is only one reason that is happening that I know of.
When you "install" a client package into Select, it is a two step procedure.
- Use a Select utility to move some package information to Registry so it can be easily found.
- Start Select the with command line option "/setup". This scans all the client packages referenced in registry and creates a list of all UI buttons, windows, and default states that need to be displayed and saves it to a UI file.
We do this to save time startup time since we never have to do this unless a package is added/removed.
When you launch the Select application (without /setup), Select uses this UI file to generate UI components - but it doesn't activate your package. Until the first button is pressed with a handler in your package, the assumption is nothing has changed (it couldn't have - your package is not running).
Look at the client package code below. If you put a breakpoint on the RegisterHandler() line and start Select, you will see that it is not loaded by Select until you push a button that needs to be handled by your specific package. This is a method to speed application startup an prevent loading unnecessary/unused packages. Once your package OnInitialize() is executed (due to a button press), the QueryStatus() method will be called periodically too.
Code: Select all
...
[RegisterPackage("My Company", "My Product", "1.0", "...")]
partial class MyPackage : Package
{
protected override void OnInitialize()
{
//TODO: Provide package initialization logic here.
this.RegisterHandler(MyPackage.RibbonButton1, RibbonButton1_Invoked, RibbonButton1_QueryStatus);
}
...
If you need the package to be loaded immediately on client startup, the package class must be decorated with a slightly different RegisterPackageAttribute. The optional
AutoLoad parameter must be set to True. Now the OnInitialize() method will be called on startup.
Code: Select all
[RegisterPackage("My Company", "My Product", "1.0", "...", true)]
Be aware that in this scenario, some interfaces may not be available yet. If you need to do anything other than set up button handlers, then also subscribe to the IShell.Load event in OnInitialize() and do the remaining work there. IShell.Load is called after all packages have been loaded and the server link is established for the session.