PackageDeploymentManager.IsPackageReady(String) Method

Definition

Determines whether the target package(s) is/are present (installed, registered) and ready for use. This method is a quick test to determine whether more (costly) work is needed before the target can be used.

public:
 virtual bool IsPackageReady(Platform::String ^ package) = IsPackageReady;
bool IsPackageReady(winrt::hstring const& package);
public bool IsPackageReady(string package);
function isPackageReady(package)
Public Function IsPackageReady (package As String) As Boolean

Parameters

package
String

Platform::String

winrt::hstring

The target package(s) to query about.

Returns

Boolean

bool

true if the target package(s) is/are present (installed, registered) and ready for use; otherwise, false.

Remarks

Reasons why a package isn't ready can include:

  • The package isn't present on the machine.
  • The package is present on the machine, but it's not registered for the user.
  • The package is registered for the user, but it's not in a healthy state; for example, its Package.Status is Tampered.

You typically needn't call IsPackageReady before you call EnsurePackageReadyAsync. But doing so can be useful in a case where you need to do additional work before potentially performing deployment operations. For example, if you need to prompt the user for consent before installing the target:

var pdm = PackageDeploymentManager().GetDefault();
if (!pdm.IsPackageReady(pkg))
{
    bool ok = AskUserForConsent(pkg);
    if (ok)
    {
        var options = new EnsureReadyOptions();
        var result = await pdm.EnsurePackageReadyAsync(pkg, options);
    }
}

Applies to