Skip to main content

Component Plug-In SDK 2026 R1

Method TrySavingExistingSessionAsync

Last update: 19.06.2026

Namespace: Phoenix.BuilderUIClient
Assembly: Phoenix.BuilderUIClient.dll

TrySavingExistingSessionAsync(FutureOperation, IHarnessRunnerSession, bool, bool)

Checks the current builder or writer session for changes, prompts the user if they want to save and continue, and if so, saves and closes that session. Call this before calls to Phoenix.BuilderUIClient.ComponentInfoSessionManager.OpenComponentWithLocalEditSession(Phoenix.ComponentAPI.IHarnessRunnerSession), see Phoenix.BuilderUIClient.ComponentInfoSessionManager.OpenBuilderUIForComponent(Phoenix.ComponentAPI.IHarnessRunnerSession), Phoenix.BuilderUIClient.ComponentInfoSessionManager.OpenExistingBuilderUI(Phoenix.ComponentAPI.IHarnessBuilderUISession), and Phoenix.BuilderUIClient.ComponentInfoSessionManager.UnloadComponent. Does nothing if it is determined the current sessions can be reused via the provided arguments.

public Task<bool> TrySavingExistingSessionAsync(ComponentInfoSessionManager.FutureOperation operation, IHarnessRunnerSession newSession, bool silent = false, bool closeExistingSessions = true)

Parameters

operation ComponentInfoSessionManager.FutureOperation

The future operation that will be performed.

newSession IHarnessRunnerSession

The new Phoenix.ComponentAPI.IHarnessRunnerSession that will be switched to. Not the builder UI or local edit session.

silent bool

If true, the user will not be prompted to apply or cancel changes, and false will be returned if there are changes. (default: false)

closeExistingSessions bool

If true, will close any existing builder UI session if opening a local edit session and vice-versa. If false, will return that the operation is not possible in those cases. (default: true)

Returns

Task<bool>

Task whose result will be true if the operation should continue, and false if the user cancelled the operation.

Connect with Ansys