PackageExtensionCatalog.PackageInstalled 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 is installed.
// Register
event_token PackageInstalled(TypedEventHandler<PackageExtensionCatalog, PackageExtensionPackageInstalledEventArgs const&> const& handler) const;
// Revoke with event_token
void PackageInstalled(event_token const* cookie) const;
// Revoke with event_revoker
PackageExtensionCatalog::PackageInstalled_revoker PackageInstalled(auto_revoke_t, TypedEventHandler<PackageExtensionCatalog, PackageExtensionPackageInstalledEventArgs const&> const& handler) const;
public event TypedEventHandler<PackageExtensionCatalog,PackageExtensionPackageInstalledEventArgs> PackageInstalled;
function onPackageInstalled(eventArgs) { /* Your code */ }
packageExtensionCatalog.addEventListener("packageinstalled", onPackageInstalled);
packageExtensionCatalog.removeEventListener("packageinstalled", onPackageInstalled);
- or -
packageExtensionCatalog.onpackageinstalled = onPackageInstalled;
Public Custom Event PackageInstalled As TypedEventHandler(Of PackageExtensionCatalog, PackageExtensionPackageInstalledEventArgs)
Event Type
Remarks
The event argument, PackageExtensionPackageInstalledEventArgs.Extensions, contains a list of extensions within the extension package.
Extensions are scoped by the <uap17:PackageExtension Name=...>
defined in the extension's Package.appxmanifest file. Only extensions that match the <uap17:PackageExtension Name=...>
defined in the host's Package.appxmanifest file, are in the list of extensions.
An event handler for this event is a good place to examine each package extension for correctness and to provide the user the option to use it.
The unit of deployment for a PackageExtension is the Package. That's why this is a Package install event and not a PackageExtension install event.
Typically there will only be one extension in a package. However, be prepared to handle the case where there are multiple extensions in the package.
Use PackageExtension.Id to distinguish between extensions in the same package. To uniquely identify an extension in your package, consider concatenating Package.Id and PackageExtension.Id:
_uniqueId = yourPackageExtension.Package.Id + "|" + yourPackageExtension.Id;
This guarantees that each PackageExtension has a unique name that you can use to track it. We recommend using this as a key for your PackageExtensions so that you can efficiently and correctly identify if a given PackageExtension is one that you already know about.