Windows ストア アプリで検索コントラクトを実装している場合は、App.xaml.cs で次のようにOnSearchActivated
メソッドをオーバーライドします。
protected override void OnSearchActivated(SearchActivatedEventArgs args)
{
(Window.Current.Content as Frame).Navigate(typeof(Contracts.Search), args.QueryText);
}
しかし、注意を払っている場合は、次OnActivated
のように、検索のアクティブ化を示すイベント引数を持つ、呼び出された App クラスに別のオーバーライドがあることがわかります。
protected override void OnActivated(IActivatedEventArgs args)
{
if (args.Kind == ActivationKind.Search)
{
(Window.Current.Content as Frame).Navigate(typeof(Contracts.Search), args.QueryText);
}
}
どちらか一方を実装すると、結果は同じようです。それは疑問を投げかけます:2つの違いは何ですか?それらは本当に同じですか?