PackageCatalog.AddResourcePackageAsync Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Agrega un paquete de recursos a un paquete de aplicación existente.
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)
Parámetros
- resourcePackageFamilyName
-
String
Platform::String
winrt::hstring
Nombre de familia del paquete que identifica de forma única el paquete de la aplicación.
- resourceID
-
String
Platform::String
winrt::hstring
Identificador de recurso del paquete.
- options
- AddResourcePackageOptions
Opciones para especificar el comportamiento al agregar un paquete de recursos a una aplicación.
Devoluciones
Informe de progreso de la adición de un paquete de recursos.
- Atributos
Requisitos de Windows
Familia de dispositivos |
Windows 10, version 1803 (se introdujo en la versión 10.0.17134.0)
|
API contract |
Windows.Foundation.UniversalApiContract (se introdujo en la versión v6.0)
|
Ejemplos
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; }));
}