Reply

preventing save, BeforeDocumentSave

[ Edited ]

Hi,

Is there a way to listen for all saves like using BeforeDocumentSave yet to stop specific save of a file?

scenario: user hit ctrl+s my code stands on BeforeDocumentSave event and tells solid to stop save since some condition that my add-in checks fails.

The type of method SolidEdgeFramework.DISEApplicationEvents_BeforeDocumentSaveEventHandler(void (Object)target)

So my target function cannot return some error values and causing an exception seems like very bad idea..

 

 

 

Posted by: joseph polk
Post date: 1/30/2012 2:32:31 PM

3 REPLIES

RE: preventing save, BeforeDocumentSave

[ Edited ]

exception didn't work

but:

SolidEdgeFramework.SolidEdgeDocument document = (SolidEdgeFramework.SolidEdgeDocument)m_application.ActiveDocument;

bool seekStatus = true;

document.SeekReadOnlyAccess(out seekStatus);

 

did prevent saving and moved the file to read only state (can be changed back it in the AfterSaveEvent).

 

Yet it fire message to user..

Any way to disable the message or doing it in a normal way?

 

Posted by: joseph polk
Post date: 1/31/2012 6:12:39 AM

Re: preventing save, BeforeDocumentSave

Any news here? I'm trying to accomplish the same thing. Let's make it even more general, I'd like to know if it's possible to prevent any event from occuring when a certain condition is met.

 

public void BeforeEvent()

{

    if (condition is met)

    {

        <prevent event from happening code>

    }

}

 

Regards,

Jonas

Re: RE: preventing save, BeforeDocumentSave

I need the same as what you've described. Your 'read only' solution, whilst not pretty, may be the only way we can do it. How about we use seApplication.DisplayAlerts to temporarily prevent the message box while we prevent the file from saving? Set to False in the before save and switch them back on for the next before command maybe?