The requested page is not available for the requested platform. You are viewing the content for Default platform.

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.v19.1.dll

Declaration

public event EventHandler<CustomFileListOperationEventArgs> CustomSaveFiles
Public Event CustomSaveFiles As EventHandler(Of CustomFileListOperationEventArgs)

Event Data

The CustomSaveFiles event handler receives an argument of the CustomFileListOperationEventArgs type. The following properties provide information specific to this event.

Property Description
FileDataList Specifies files about to be saved to a hard disk.

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