다음을 통해 공유


PackageCatalog.AddResourcePackageAsync 메서드

정의

기존 앱 패키지에 리소스 패키지를 추가합니다.

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)

매개 변수

resourcePackageFamilyName
String

Platform::String

winrt::hstring

앱의 패키지를 고유하게 식별하는 패키지 패밀리 이름입니다.

resourceID
String

Platform::String

winrt::hstring

패키지의 리소스 ID입니다.

options
AddResourcePackageOptions

앱에 리소스 패키지를 추가할 때 동작을 지정하는 옵션입니다.

반환

리소스 패키지를 추가하는 진행률 보고서입니다.

특성

Windows 요구 사항

디바이스 패밀리
Windows 10, version 1803 (10.0.17134.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v6.0에서 도입되었습니다.)

예제

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; })); 
} 

적용 대상