Accessing the Application and UIApplication from IExternalApplication

Accessing the Application and UIApplication from IExternalApplication

Anonymous
Not applicable
2,699 Views
2 Replies
Message 1 of 3

Accessing the Application and UIApplication from IExternalApplication

Anonymous
Not applicable

I'm trying to creat parameter when when the ViewActivated event is triggered. I cannot get the pass the Application or UIApplication from the event. I'm getting the Document from e.Document. And I was trying to cast the sender as Application and UIApplication. It will compile and run without issue, but isn't working. I dont have a need to implement IExternalCommand. How can I acomplish this? Thanks. 

0 Likes
2,700 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

UIApplication uiapp = new UIApplication(doc.Application);
Application app = uiapp.Application;

Message 3 of 3

arnostlobel
Alumni
Alumni

The sender of  ViewActivated is indeed the UIApplication, which you probably found by casting to it. What do you mean by "it's not working"?

 

As for your code snippet, let me try to understand:

- you get the Application from the document

- then you instantiate UIApplication from the Application

- then you get the Application back from the newly instantiated UIApplicaiton

 

Am I reading it correctly?

 

Thanks

Arnošt Löbel

Revit R&D

Arnošt Löbel
0 Likes