コード例 #1
0
        // 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();
            }
        }
コード例 #2
0
        public Result OnStartup(UIControlledApplication application)
        {
            application.ControlledApplication.WriteJournalComment("[STREAMVR] APP STARTUP", true);

            _uiForm  = null;  // no dialog needed yet; the command will bring it
            Instance = this;  // static access to this application instance

            return(Result.Succeeded);
        }