// The external command invokes this on the end-user's request public void ShowForm(UIApplication uiapp) { uiapp.Application.WriteJournalComment("[STREAMVR] APP SHOW FORM", true); // If we do not have a dialog yet, create and show it if (_uiForm == null || !_uiForm.IsActive) { // A new handler to handle request posting by the dialog MessageEventHandler handler = new MessageEventHandler(); // External Event for the dialog to use (to post requests) ExternalEvent exEvent = ExternalEvent.CreateJournalable(handler); uiapp.Application.WriteJournalComment("[STREAMVR] CREATING FORM", true); var startingViews = new FilteredElementCollector(uiapp.ActiveUIDocument.Document). OfClass(typeof(View3D)). Select(e => e as View3D); _uiForm = new WPF.StreamVRUI(exEvent, handler, (string msg) => { uiapp.Application.WriteJournalComment(msg, true); }) { ServerURL = StreamVRApp.Instance.BaseServerURL, UserName = uiapp.Application.Username, RoomCode = "123456", StartingView = startingViews.FirstOrDefault()?.Name ?? "", StartingViewOptions = startingViews.Select(v => v.Name) }; _uiForm.InitialLoad(); _uiForm.Show(); } }
/// <summary> /// Constructor /// </summary> public RevitExternalHandler(RevitAsyncSettings settings, IRevitContext revitContext) { this.revitContext = revitContext; this.name = settings.Name; if (settings.IsJournalable) { this.externalEvent = ExternalEvent.CreateJournalable(this); } else { this.externalEvent = ExternalEvent.Create(this); } }
public RevitEventDispatcher() { _extEvent = ExternalEvent.CreateJournalable(this); }