cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

More questions about Arbortext Editor and C#

ebenton
1-Visitor

More questions about Arbortext Editor and C#

Got another question:

Newbie Alert!! Using Arbortext 6.0 and C#:

When the user saves a document, we want to perform certain actions on the saved data. However, the DocumentSaving event fires before the disk file is updated, so the event listener doesn't have access to freshest data; rather, the disk file represents the previous save. The documentation mentions cancelling the event and then calling save manually (ADocument Save), which gives you the opportunity to perform actions before and/or after the document is saved; this seems like a promising technique, but I can't figure out how to save the document in the event listener - sounds simple enough, but I'm not sure how to gain access to an object that is tied to the editing session and has a Save method. Can anyone help?

Related question: Is there a way to cancel the ACL Save callback function?

1 REPLY 1

Hi Ed--

You should be able to get the (A)Document object from the event object in your event listener. I don't know much about C#, but in Java it would look something like this:

public void handleEvent(Event e) {
ADocument adoc = (ADocument) e.getRelatedDocument();
pre_save_fixup(adoc);
adoc.save(); // add flags, etc. as needed
post_save_fixup(adoc.getDocumentURI());
}

I'm not sure quite what you mean by "cancel the ACL save callback function". You mean you want your C# event listener to intercept the save so it doesn't trigger the ACL callback? I'm not sure about that. You might be able to do it by using some combination of preventDefault() and stopPropagation() on the Event object that triggers the listener. I guess you'd just have to play around with it a bit to see if it works.

--Clay
Announcements

Top Tags