Skip to main content
.NET 6.0+

FileAttachmentsWindowsFormsModule.CustomSaveFiles Event

Occurs when attached files are about to be saved to a hard disk.

Namespace: DevExpress.ExpressApp.FileAttachments.Win

Assembly: DevExpress.ExpressApp.FileAttachment.Win.v24.1.dll

Declaration

public event EventHandler<CustomFileListOperationEventArgs> CustomSaveFiles

Event Data

The CustomSaveFiles event's data class is CustomFileListOperationEventArgs. The following properties provide information specific to this event:

Property Description
FileDataList Specifies files about to be saved to a hard disk.
Handled Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. Inherited from HandledEventArgs.

Remarks

When the FileAttachmentController‘s SaveTo Action is executed or the file data manager’s (see FileAttachmentsWindowsFormsModule.GetFileDataManager) SaveTo method is invoked, a dialog prompting the end-user to choose the destination folder is invoked. You can override this behavior by handling the CustomSaveFiles event. After manually saving the attached files data, set the handler’s Handled parameter to true, to suppress display of the default dialog.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.FileAttachments.Win;
using DevExpress.Persistent.Base;
//...
public class MyViewController : ViewController {
    FileAttachmentsWindowsFormsModule fileAttachmentsModule;
    protected override void OnActivated() {
        base.OnActivated();
        fileAttachmentsModule = Application.Modules.FindModule<FileAttachmentsWindowsFormsModule>();
        fileAttachmentsModule.CustomSaveFiles += fileAttachmentsModule_CustomSaveFiles;
    }
    void fileAttachmentsModule_CustomSaveFiles(object sender, CustomFileListOperationEventArgs e) {
        foreach (IFileData fileData in e.FileDataList) {
            //manually save attached files to a disk
            //...
        }
        e.Handled = true;
    }
    protected override void OnDeactivated() {
        fileAttachmentsModule.CustomSaveFiles -= fileAttachmentsModule_CustomSaveFiles;
        fileAttachmentsModule = null;
        base.OnDeactivated();
    }        
}
See Also