コード例 #1
0
ファイル: Login.cs プロジェクト: wangaofang/bimsync4Revit
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument    uidoc = uiapp.ActiveUIDocument;
            Application   app   = uiapp.Application;
            Document      doc   = uidoc.Document;

            try
            {
                //Token token = AuthorizeApp();
                // A new handler to handle request posting by the dialog
                ExternalEventAuthorizationHandler handler = new ExternalEventAuthorizationHandler();

                // 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.
                ExternalEventAuthorization externalEventAuthorizationAnswer = new ExternalEventAuthorization(exEvent, handler);

                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                // unchecked exception cause command failed
                message = ex.Message;

                return(Autodesk.Revit.UI.Result.Failed);
            }
        }
コード例 #2
0
ファイル: Login.cs プロジェクト: wangaofang/bimsync4Revit
        public ExternalEventAuthorization(ExternalEvent exEvent, ExternalEventAuthorizationHandler handler)
        {
            m_ExEvent = exEvent;
            m_Handler = handler;

            AuthorizeApp();

            AuthorizationAnswer();
        }