Skip to main content
1-Visitor
February 12, 2014
Question

More questions about Arbortext Editor and C#

  • February 12, 2014
  • 1 reply
  • 873 views
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

    18-Opal
    February 12, 2014
    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