共用方式為


AppListEntry.AppUserModelId 屬性

定義

取得這個 AppListEntry的應用程式使用者模型識別碼 (AUMID)

public:
 property Platform::String ^ AppUserModelId { Platform::String ^ get(); };
winrt::hstring AppUserModelId();
public string AppUserModelId { get; }
var string = appListEntry.appUserModelId;
Public ReadOnly Property AppUserModelId As String

屬性值

String

Platform::String

winrt::hstring

字串,表示應用程式的身分識別。

Windows 需求

裝置系列
Windows 10 Fall Creators Update (已於 10.0.16299.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v5.0 引進)

範例

// Find and activate the desired application (if present on this machine)
using namespace Windows.Management.Deployment;

async Task<bool> RunApplicationAsync(string aumid)
{
  var packageManager = new Windows.Management.Deployment.PackageManager();
  IEnumerable<Package> packages = packageManager.FindPackagesForUserWithPackageTypes(
      null, PackageTypes.Main | PackageTypes.Optional);

  foreach (Package package in packages)
  {
    IReadOnlyList<AppListEntry> entries = await package.GetAppListEntriesAsync();
    foreach (AppListEntry entry in entries)
    {
      if (String.Equals(entry.AppUserModelId, aumid, StringComparison.OrdinalIgnoreCase))
      {
        return await entry.LaunchAsync();
      }
    }
  }
  return false;
}

備註

AUMID是一個可保存的值,可用來識別應用程式。 它是以套件系列名稱 + 套件相對應用程式識別碼為基礎, (PRAID)

識別碼 描述
套件系列名稱 名稱 + Publisher (<Identity>appxmanifest.xml) 中找到的專案。
PRAID Idappxmanifest.xml(中找到的 Application 屬性,例如 <Application Id="Foo"...>) 。

AUMID 與套件版本或架構無關,因此可用來識別跨多個版本或平臺的應用程式。

適用於