PackageCatalog.AddResourcePackageAsync Méthode

Définition

Ajoute un package de ressources à un package d’application existant.

public:
 virtual IAsyncOperationWithProgress<PackageCatalogAddResourcePackageResult ^, PackageInstallProgress> ^ AddResourcePackageAsync(Platform::String ^ resourcePackageFamilyName, Platform::String ^ resourceID, AddResourcePackageOptions options) = AddResourcePackageAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperationWithProgress<PackageCatalogAddResourcePackageResult, PackageInstallProgress> AddResourcePackageAsync(winrt::hstring const& resourcePackageFamilyName, winrt::hstring const& resourceID, AddResourcePackageOptions const& options);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperationWithProgress<PackageCatalogAddResourcePackageResult,PackageInstallProgress> AddResourcePackageAsync(string resourcePackageFamilyName, string resourceID, AddResourcePackageOptions options);
function addResourcePackageAsync(resourcePackageFamilyName, resourceID, options)
Public Function AddResourcePackageAsync (resourcePackageFamilyName As String, resourceID As String, options As AddResourcePackageOptions) As IAsyncOperationWithProgress(Of PackageCatalogAddResourcePackageResult, PackageInstallProgress)

Paramètres

resourcePackageFamilyName
String

Platform::String

winrt::hstring

Nom de la famille de packages qui identifie de manière unique le package de l’application.

resourceID
String

Platform::String

winrt::hstring

ID de ressource du package.

options
AddResourcePackageOptions

Options permettant de spécifier le comportement lors de l’ajout d’un package de ressources à une application.

Retours

Rapport de progression de l’ajout d’un package de ressources.

Attributs

Configuration requise pour Windows

Famille d’appareils
Windows 10, version 1803 (introduit dans 10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduit dans v6.0)

Exemples

async void btnInstallFrenchProofingTools_Click(object sender, EventArgs e) 
{ 
    var packageCatalog = PackageCatalog.OpenForCurrentPackage(); 
    string familyName = "Microsoft.Word_8wekyb3d8bbwe"; 
    // The resourceId specified in the AppxManifest.xml should be unique within a PackageFamily
    string resourceId = "FR_ProofingTools"; 

    // Install the resource package and start reporting progress on the current 
    // progressBar in the UI
    var installedPackage = await packageCatalog.AddResourcePackageAsync(familyName, resourceId, AddResourcePackageOptions.RestartApplication) 
    .AsTask<PackageCatalogAddResourcePackageResult, PackageInstallProgress>(new Progress<PackageInstallProgress> 
    (progress => { progressBar.CurrentValue = progress.PercentComplete; })); 
} 

S’applique à