ProtocolActivatedEventArgs Klasse

Definition

Stellt Daten bereit, wenn eine App aktiviert wird, da es sich um die App handelt, die einem URI-Schemanamen zugeordnet ist.

Javascript Dieser Typ wird als WebUIProtocolActivatedEventArgs angezeigt.

public ref class ProtocolActivatedEventArgs sealed : IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
public ref class ProtocolActivatedEventArgs sealed : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ProtocolActivatedEventArgs final : IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class ProtocolActivatedEventArgs final : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ProtocolActivatedEventArgs : IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class ProtocolActivatedEventArgs : IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
Public NotInheritable Class ProtocolActivatedEventArgs
Implements IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
Public NotInheritable Class ProtocolActivatedEventArgs
Implements IActivatedEventArgsWithUser, IApplicationViewActivatedEventArgs, IProtocolActivatedEventArgs, IProtocolActivatedEventArgsWithCallerPackageFamilyNameAndData, IViewSwitcherProvider
Vererbung
Object Platform::Object IInspectable ProtocolActivatedEventArgs
Attribute
Implementiert

Windows-Anforderungen

Gerätefamilie
Windows 10 (eingeführt in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v1.0)

Beispiele

Der OnActivated-Ereignishandler empfängt alle Aktivierungsereignisse. Die -Eigenschaft gibt den Typ des Aktivierungsereignisses an. Dieses Beispiel ist für die Behandlung von URI-Aktivierungsereignissen eingerichtet.

public partial class App
{
   protected override void OnActivated(IActivatedEventArgs args)
   {
      if (args.Kind == ActivationKind.Protocol)
      {
         ProtocolActivatedEventArgs eventArgs = args as ProtocolActivatedEventArgs;

         // TODO: Handle URI activation
         // The received URI is eventArgs.Uri.AbsoluteUri
      }
   }
}
Private Sub OnFileActivated(ByVal args As Windows.ApplicationModel.Activation.IActivatedEventArgs)
   If args.Kind = ActivationKind.Protocol Then
      ProtocolActivatedEventArgs eventArgs = args As ProtocolActivatedEventArgs

      ' TODO: Handle URI activation
      ' The received URI is eventArgs.Uri.AbsoluteUri
   End If
End Sub
void App::OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs const& args)
{
    if (args.Kind() == Windows::ApplicationModel::Activation::ActivationKind::Protocol)
    {
        auto eventArgs{ args.as<Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs>() };

        // TODO: Handle URI activation.
        // The received URI is eventArgs.Uri().RawUri().
    }
}
void App::OnActivated(Windows::ApplicationModel::Activation::IActivatedEventArgs^ args)
{
   if (args->Kind == Windows::ApplicationModel::Activation::ActivationKind::Protocol)
   {
      Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^ eventArgs = 
          dynamic_cast<Windows::ApplicationModel::Activation::ProtocolActivatedEventArgs^>(args);

      // TODO: Handle URI activation  
      // The received URI is eventArgs->Uri->RawUri
   } 
}

Hinweise

Auf dieses Objekt wird zugegriffen, wenn Sie einen Ereignishandler implementieren, um auf Aktivierte Ereignisse zu reagieren, wenn ActivationKindden Wert Protocol hat.

UWP-Apps mit C++, C# oder Visual Basic implementieren in der Regel Aktivierungspunkte, indem methoden des Application-Objekts überschrieben werden. Die CodeBehind-Dateien der Standardvorlage app.xaml enthalten immer eine Außerkraftsetzung für OnLaunched, aber das Definieren von Außerkraftsetzungen für andere Aktivierungspunkte wie OnActivated hängt von Ihrem App-Code ab. Wenn ActivationKindauf Protocol festgelegt ist, können die schnittstellentypisierten IActivatedEventArgs von OnActivated in ProtocolActivatedEventArgs umgewandelt werden.

Alle Anwendungsüberschreibungen , die an einem Aktivierungsszenario beteiligt sind, sollten Window.Activate in ihren Implementierungen aufrufen.

Versionsverlauf

Windows-Version SDK-Version Mehrwert
1607 14393 User

Eigenschaften

CallerPackageFamilyName

Ruft den Paketfamiliennamen der Anwendung ab, die die aktuelle Anwendung aktiviert hat.

CurrentlyShownApplicationViewId

Ruft den Bezeichner für die derzeit angezeigte App-Ansicht ab.

Data

Von der Anwendung empfangene Daten, die die aktuelle Anwendung aktiviert hat.

Kind

Ruft den Aktivierungstyp ab.

PreviousExecutionState

Ruft den Ausführungsstatus der App ab, bevor sie aktiviert wurde.

SplashScreen

Ruft das Begrüßungsbildschirmobjekt ab, das Informationen zum Übergang vom Begrüßungsbildschirm zur aktivierten App bereitstellt.

Uri

Ruft den URI (Uniform Resource Identifier) ab, für den die App aktiviert wurde.

User

Ruft den Benutzer ab, für den die App aktiviert wurde.

ViewSwitcher

Ruft das Ansichtswechselobjekt ab, mit dem Sie die Ansicht für die Anwendung festlegen können.

Gilt für:

Weitere Informationen