ContactMapActivatedEventArgs クラス

定義

アプリをアクティブ化して連絡先をマップするときにデータを提供します。

Javascript この型は WebUIContactMapActivatedEventArgs として表示されます。

public ref class ContactMapActivatedEventArgs sealed : IActivatedEventArgs, IContactMapActivatedEventArgs
/// [Windows.Foundation.Metadata.ContractVersion(Windows.ApplicationModel.Activation.ContactActivatedEventsContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ContactMapActivatedEventArgs final : IActivatedEventArgs, IContactMapActivatedEventArgs
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.ApplicationModel.Activation.ContactActivatedEventsContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ContactMapActivatedEventArgs : IActivatedEventArgs, IContactMapActivatedEventArgs
Public NotInheritable Class ContactMapActivatedEventArgs
Implements IActivatedEventArgs, IContactMapActivatedEventArgs
継承
Object Platform::Object IInspectable ContactMapActivatedEventArgs
属性
実装

Windows の要件

デバイス ファミリ
Windows Desktop Extension SDK (10.0.10240.0 で導入)
API contract
Windows.ApplicationModel.Activation.ContactActivatedEventsContract (v1.0 で導入)

連絡先マップのアクティブ化を処理するために必要なコードの例を次に示します。

protected override void OnActivated(IActivatedEventArgs args)
{
    if (args.Kind == ActivationKind.Contact)
    {
        var contactArgs = args as IContactActivatedEventArgs;
        if (contactArgs.Verb == Windows.ApplicationModel.Contacts.ContactLaunchActionVerbs.Map)
        {
            IContactMapActivatedEventArgs mapArgs = contactArgs as IContactMapActivatedEventArgs;

            //get contact display info
            var contactName = mapArgs.Contact.DisplayName;
            var contactThumbnail = mapArgs.Contact.Thumbnail;

            var address = mapArgs.address;
            //add mapping logic
        }
    }
}
void App::OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs const& args)
{
    if (args.Kind() == Windows::ApplicationModel::Activation::ActivationKind::Contact)
    {
        auto contactArgs{ args.as<Windows::ApplicationModel::Activation::IContactActivatedEventArgs>() };
        if (contactArgs.Verb() == Windows::ApplicationModel::Contacts::ContactLaunchActionVerbs::Map())
        {
            auto mapArgs{ contactArgs.as<Windows::ApplicationModel::Activation::ContactMapActivatedEventArgs>() };

            // Get contact display info.
            auto contactName{ mapArgs.Contact().DisplayName() };
            auto contactThumbnail{ mapArgs.Contact().Thumbnail() };

            auto address{ mapArgs.Address() };
            // Add mapping logic.
        }
    }
}
void App::OnActivated(IActivatedEventArgs^ args)
{
    if (args->Kind == ActivationKind::Contact)
    {
        auto contactArgs = dynamic_cast<IContactActivatedEventArgs^>(args);
        if (contactArgs->Verb == Windows::ApplicationModel::Contacts::ContactLaunchActionVerbs::Map)
        {
            auto mapArgs = dynamic_cast<ContactMapActivatedEventArgs^>(contactArgs);

            //get contact display info
            auto contactName = mapArgs->Contact->DisplayName;
            auto contactThumbnail = mapArgs->Contact->Thumbnail;

            auto address = mapArgs->address;
            //add mapping logic
        }
    }
}

注釈

Windows 8.1を使用すると、ユーザーは連絡先カードまたは Windows Search エクスペリエンスから連絡先の場所をマップできます。 連絡先マップのアクティブ化コントラクトを実装することで、Windows はアプリを起動してユーザーの場所をマップできます。

マップのアクティブ化を受け取るために、アプリはマニフェストの "windows.contact" 拡張機能カテゴリに登録する必要があります。 この拡張機能の下に、"Verb" 属性が "map" と等しい "LaunchAction" 要素を含める必要があります。

このコントラクトに複数のアプリが登録されている場合、ユーザーはマッピングを処理するための既定値として、そのうちの 1 つを選択できます。

マニフェスト登録の例を次に示します。

<m2:Extension Category="windows.contact" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
  <m2:Contact>
    <m2:ContactLaunchActions>
      <m2:LaunchAction Verb="map" DesiredView="useHalf"/>
    </m2:ContactLaunchActions>
  </m2:Contact>
</m2:Extension>

マニフェストに登録すると、連絡先マップ コントラクトに対してアプリをアクティブ化できます。 アプリがアクティブ化されると、イベント情報を使用してマップのアクティブ化を識別し、ユーザーのマッピング シナリオを完了するのに役立つパラメーターを抽出できます。

連絡先アクションを使用してアプリのアクティブ化を処理する方法については、「 クイック スタート: 連絡先アクションの処理 」を参照してください。

プロパティ

Address

マッピング操作の連絡先のアドレスを取得します。

Contact

マッピング操作の連絡先を取得します。

Kind

アクティブ化の種類を取得します。

PreviousExecutionState

アクティブ化される前のアプリの実行状態を取得します。

SplashScreen

スプラッシュ スクリーン からアクティブ化されたアプリへの切り替えに関する情報を提供するスプラッシュ スクリーン オブジェクトを取得します。

Verb

実行するアクションを取得します。

適用対象

こちらもご覧ください