File UI Events

I'm using the FileUIEvents in an addin to override the SaveAs dialog. The OnFileSaveAsUI event is fired every time the SaveAs dialog comes up, regardless whether the user chose save as, save copy as, save as image, save as flat...

I only want to override save and save as. At the moment I'm setting a global flag in the BeforeCommandRun event in these cases, and resetting it on the AfterCommandRun for the same command id. This is pretty ugly and I was wondering if anybody knows a better way of finding out the exact reason why the Save As dialog is popping up. Any Ideas ?

RE: File UI Events

I have just discoved another problem. When the user opens a new part, then opens an existing document and then at some stage clicks on Save All before saving the first part, then we end up in the OnFileSaveAsUI event. The problem is that the active document is the existing document not the document for which the dialog is appearing. We have no way of knowing which document type is being saved, making it rather difficult to come up with a file name...

I know it's a fairly obscure example, but I also know what your average user gets up to...

My problem is that I have to react to the saving of documents, whenever SaveAs, SaveCopyAs or SaveAll (or Save for a new document) are invoked then the SaveFileDialog pops up. This isn't allowed to happen... I have to generate a filename save the document and then perform a few more changes to the document before I leave that method. This means that I have to know if I need to call object.SaveAs(filename) or object.SaveCopyAs(filename), and I also need to know what I'm supposed to be saving (par, psm etc.)

I'm using the workaround discribed above at the moment and I've just cut support for SaveAll. But it's not very pretty and I don't 100% trust it...

I then reset m_saveType (this is a custom enumeration variable) to none in AfterCommandRun.

I am only providing support for Save, SaveAs and SaveAsCopy as these all apply to the active document (solidEdge->ActiveDocument). SaveAll will rarely cause the save dialog to open and in that case I just let things run as normal.

I've been meaning to log this with GTAC but still haven't got around to it