Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I register that event handler has finished?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
JackTilley
1096 Views, 5 Replies

How do I register that event handler has finished?

Hi

 

I am closing and reopening an active document from the api and in order to this I need to. 

 

Step 1.Open a placeholder document and close my main document.

Step 2.Do this again only opening the original document and closing the place holder.

 

This requires me to register that the document has closed. unfortunately in i can't do step 2 in the event handler because step 2 also involves closing a document.

 

So what i need to do is check that the event hander has finished before i start step 2. (I NEED HELP WITH THIS PART)


Capture.PNG

 

If I can't register the event in main, I don't mind exploring alternatives

 

* m_Closehelper closes the opens the new document and closes the current one.

 

5 REPLIES 5
Message 2 of 6
Aaron.Lu
in reply to: JackTilley

is it neccessary to use event? are you using below procedure?

var doc = commandData.Application.ActiveUIDocument.Document;
var file = doc.PathName;
var doc2 = commandData.Application.OpenAndActivateDocument(placeholderFile);
doc.Close(false);
TaskDialog.Show("info", "open old one");
var uidoc = commandData.Application.OpenAndActivateDocument(file);
doc2.Document.Close(false);


Aaron Lu
Developer Technical Services
Autodesk Developer Network
Message 3 of 6
JackTilley
in reply to: Aaron.Lu

I am basing my code off the building coders article here.

 

http://thebuildingcoder.typepad.com/blog/2012/12/closing-the-active-document.html

 

I think I have to use an event becuase it throws an unrecoverable error when i i reopen it too soon so i figgered i had to check to see if the document had fully closed first. i will try your way out in the mean time.

 

Thanks, Jack

Message 4 of 6
JackTilley
in reply to: JackTilley

No? I don't know what it is or how to use it. I will look into it 🙂 Thanks
Message 5 of 6
JackTilley
in reply to: Aaron.Lu

Thank you thank you thank you. this worked like a charm 😄

Message 6 of 6
Aaron.Lu
in reply to: JackTilley

my pleasure 🙂


Aaron Lu
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community