// Implements the OnStartup event public Result OnStartup(UIControlledApplication application) { AddRibbonPanel(application); formFL = null; // no dialog needed yet; the command will bring it thisApp = this; // static access to this application instance return(Result.Succeeded); }
// This method creates and shows a modeless dialog, unless it already exists. // The external command invokes this on the end-user's request public void ShowForm(UIApplication uiapp) { // If we do not have a dialog yet, create and show it if (formFL == null || formFL.IsDisposed) { // A new handler to handle request posting by the dialog RequestHandler handler = new RequestHandler(); // External Event for the dialog to use (to post requests) ExternalEvent exEvent = ExternalEvent.Create(handler); // We give the objects to the new dialog; // The dialog becomes the owner responsible for disposing them, eventually. formFL = new FindLabelForm(exEvent, handler, uiapp); formFL.Show(); } }