Share via


PackageExtensionCatalog.PackageStatusChanged Event

Definition

Event that is fired when an extension package in the catalog removed, updated, or installed.

// Register
event_token PackageStatusChanged(TypedEventHandler<PackageExtensionCatalog, PackageExtensionPackageStatusChangedEventArgs const&> const& handler) const;

// Revoke with event_token
void PackageStatusChanged(event_token const* cookie) const;

// Revoke with event_revoker
PackageExtensionCatalog::PackageStatusChanged_revoker PackageStatusChanged(auto_revoke_t, TypedEventHandler<PackageExtensionCatalog, PackageExtensionPackageStatusChangedEventArgs const&> const& handler) const;
public event TypedEventHandler<PackageExtensionCatalog,PackageExtensionPackageStatusChangedEventArgs> PackageStatusChanged;
function onPackageStatusChanged(eventArgs) { /* Your code */ }
packageExtensionCatalog.addEventListener("packagestatuschanged", onPackageStatusChanged);
packageExtensionCatalog.removeEventListener("packagestatuschanged", onPackageStatusChanged);
- or -
packageExtensionCatalog.onpackagestatuschanged = onPackageStatusChanged;
Public Custom Event PackageStatusChanged As TypedEventHandler(Of PackageExtensionCatalog, PackageExtensionPackageStatusChangedEventArgs) 

Event Type

Remarks

This event helps you identify when a package is no longer available, valid, or has been modified. Handle this event to determine when an extension may no longer be valid and should be disabled. A common use for this event is to detect whether the package providing the extension is installed on removable media. If the user removes the media containing the package, this event is raised for that package.

The PackageStatus class provides the possible package status states.

Use PackageStatus.VerifyIsOk to determine if the package is in good condition. If it returns false, you can check PackageStatus.LicenseIssue or PackageStatus.PackageOffline and provide special handling for those situations. Typically, if the package state is not Ok, you should disable it. It is good practice to call PackageStatus.VerifyIsOk any time you are about to load an extension.

Consider handling the this event to provide an indicator in your extension manager UI that the extension is disabled or not usable because there is something wrong with the package.

Continue to handle this event, even if you've certain that there is an issue with a package, because the user may update the package and it may then be Ok to load.

Like PackageUpdating and PackageUninstalling, this event only passes the Package with a status that's changed. It is up to you to match the Package against the PackageExtensions you have loaded to determine which extensions are affected by the status change.

Applies to

See also