/// <summary> /// The external command invokes this on the end-user's request /// </summary> /// <param name="uiapp"></param> public void ShowForm(UIApplication uiapp) { try { // If we do not have a dialog yet, create and show it if (RvtWindow != null) { return; } // A new handler to handle request posting by the dialog var handler = new ExtEvntOpenView(); // External Event for the dialog to use (to post requests) var extEvent = ExternalEvent.Create(handler); // We give the objects to the new dialog; // The dialog becomes the owner responsible for disposing them, eventually. RvtWindow = new RevitWindow(uiapp, extEvent, handler); RvtWindow.Show(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Constructor /// </summary> /// <param name="_uiapp"></param> /// <param name="exEvent"></param> /// <param name="handler"></param> public RevitWindow(UIApplication _uiapp, ExternalEvent exEvent, ExtEvntOpenView handler) { InitializeComponent(); try { ExtEvent = exEvent; Handler = handler; uiapp = _uiapp; } catch (Exception ex1) { TaskDialog.Show("Error!", "exception: " + ex1); } }
/// <summary> /// The external command invokes this on the end-user's request /// </summary> /// <param name="uiapp"></param> public void ShowForm(UIApplication uiapp) { try { // If we do not have a dialog yet, create and show it if (RvtWindow != null) return; // A new handler to handle request posting by the dialog var handler = new ExtEvntOpenView(); // External Event for the dialog to use (to post requests) var extEvent = ExternalEvent.Create(handler); // We give the objects to the new dialog; // The dialog becomes the owner responsible for disposing them, eventually. RvtWindow = new RevitWindow(uiapp, extEvent, handler); RvtWindow.Show(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }