AppListEntry.AppUserModelId 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得這個 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
屬性值
字串,表示應用程式的身分識別。
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 | 在 Id appxmanifest.xml(中找到的 Application 屬性,例如 <Application Id="Foo"...> ) 。 |
AUMID 與套件版本或架構無關,因此可用來識別跨多個版本或平臺的應用程式。
適用於
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應