Compartir a través de


IVsRunningDocTableEvents7.OnBeforeSaveAsync(UInt32, UInt32, IVsTask) Method

Definition

Called right before a save is about to occur.

public Microsoft.VisualStudio.Shell.Interop.IVsTask? OnBeforeSaveAsync (uint cookie, uint flags, Microsoft.VisualStudio.Shell.Interop.IVsTask? saveTask);
abstract member OnBeforeSaveAsync : uint32 * uint32 * Microsoft.VisualStudio.Shell.Interop.IVsTask -> Microsoft.VisualStudio.Shell.Interop.IVsTask
Public Function OnBeforeSaveAsync (cookie As UInteger, flags As UInteger, saveTask As IVsTask) As IVsTask

Parameters

cookie
UInt32

The document cookie.

flags
UInt32

Provides additional information about the save.

saveTask
IVsTask

A task representing the save operation.

Returns

An optional task representing async work done by the event sink. If this is non-null, the RunningDocTable will await its completion before continuing the save.

Examples

async IVsTask OnBeforeSaveAsync(uint cookie, uint flags)
{
    await jtf.Run(() => /** Do work *// );
}

Remarks

When the RunningDocTable notifies the event sink about save events, it will first check if the event implements this interface and call this method. If not, it will check if it implements IVsRunningDocTableEvents3 and call OnBeforeSave(UInt32). Note that this means the RDT will not call both methods.

This method is safe to access from any thread.

Applies to