AppExtensionCatalog.PackageStatusChanged Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Event that is fired when an extension package in the catalog removed, updated, or installed.
// Register
event_token PackageStatusChanged(TypedEventHandler<AppExtensionCatalog, AppExtensionPackageStatusChangedEventArgs const&> const& handler) const;
// Revoke with event_token
void PackageStatusChanged(event_token const* cookie) const;
// Revoke with event_revoker
AppExtensionCatalog::PackageStatusChanged_revoker PackageStatusChanged(auto_revoke_t, TypedEventHandler<AppExtensionCatalog, AppExtensionPackageStatusChangedEventArgs const&> const& handler) const;
public event TypedEventHandler<AppExtensionCatalog,AppExtensionPackageStatusChangedEventArgs> PackageStatusChanged;
function onPackageStatusChanged(eventArgs) { /* Your code */ }
appExtensionCatalog.addEventListener("packagestatuschanged", onPackageStatusChanged);
appExtensionCatalog.removeEventListener("packagestatuschanged", onPackageStatusChanged);
- or -
appExtensionCatalog.onpackagestatuschanged = onPackageStatusChanged;
Public Custom Event PackageStatusChanged As TypedEventHandler(Of AppExtensionCatalog, AppExtensionPackageStatusChangedEventArgs)
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 app 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 anytime 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 determined 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 that's status changed. It is up to you to match the Package against the AppExtensions you have loaded to determine which extensions are affected by the status change.