AppListEntry.LaunchForUserAsync(User) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定したユーザーのコンテキスト内で、この AppListEntry に関連付けられているアプリを起動します。
public:
virtual IAsyncOperation<bool> ^ LaunchForUserAsync(User ^ user) = LaunchForUserAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<bool> LaunchForUserAsync(User const& user);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<bool> LaunchForUserAsync(User user);
function launchForUserAsync(user)
Public Function LaunchForUserAsync (user As User) As IAsyncOperation(Of Boolean)
パラメーター
- user
- User
アプリを起動する必要があるユーザー コンテキスト。
戻り値
起動が成功した場合は true を返します。それ以外の場合は false。
- 属性
Windows の要件
デバイス ファミリ |
Windows 10, version 1803 (10.0.17134.0 で導入)
|
API contract |
Windows.Foundation.UniversalApiContract (v6.0 で導入)
|
例
public async void LaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
// The active User is retrieved from the initial activation args and validated against list of active users
User user = this.GetAppActiveUser();
PackageManager pm = new PackageManager();
// The App Family Name is stored as part of the Product Display Page
Package p = pm.FindPackage(this.GetFocusedAppFamilyName());
IReadOnlyList<AppListEntry> entries = await p.GetAppListEntriesAsync();
//This assumes the first app in the package should be launched, if there is one in the package
if (entries.Count > 0)
{
await entries[0].LaunchForUserAsync(user);
}
}
注釈
これはマルチユーザー対応 (MUA) API であり、MUA であることを宣言するアプリでのみ使用でき、MUA アプリをサポートするデバイスでのみ使用できます。
アプリは、指定したユーザーがアプリ一覧のエントリをクリックした場合と同じ方法で起動されます。 ユーザーは、イベント引数を使用して起動されたアプリに渡されます。 をuser
渡null
すと、例外が発生します。
MUA アプリは、既定のユーザー コンテキストで起動します。 イベント引数を使用してアクティブ化されたアプリケーションに渡される値は user
、アプリが代理でアクティブ化されているユーザーを示します。 シングル ユーザー対応アプリは、この API に渡される値の user
コンテキストで起動します。
適用対象
こちらもご覧ください
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示