BeforeFileClose¶
Called when the user closes a project, before the native save prompt. The plugin may veto the close.
When is this called?
Called only when beforeFileClose is advertised. If the plugin returns null or an error, the host continues closing (allowClose=true) so the user is never trapped. Do not release PDM locks here; the user can still cancel the native save prompt. Wait for SetProjectVariables, which runs after the close is confirmed.
Capability: beforeFileClose
C# Override¶
public override BeforeFileCloseResponse? BeforeFileClose(BeforeFileCloseRequest request)
{
return new BeforeFileCloseResponse { AllowClose = true };
}
Request¶
| Field | Type | Required | Description |
|---|---|---|---|
projectPath |
string |
✅ | Full path to the project file being closed. |
isModified |
boolean |
✅ | Whether the project has unsaved changes. Use this instead of calling Host.GetCurrentProject. |
parentWindowHandle |
integer |
✅ | HWND for modal plugin dialogs. |
Response¶
| Field | Type | Required | Description |
|---|---|---|---|
allowClose |
boolean |
✅ | false cancels the close. true lets the native save prompt and close continue. |
JSON¶
The SDK serializes these JSON bodies for you.