このコードを使用して、RootFrame.Obscured にイベント ハンドラを追加しています。
(Application.Current as App).RootFrame.Obscured += onObScured;
アプリ内のすべてのクラスから RootFrame にアクセスできるため、別のクラスから別のイベント ハンドラを追加するとどうなりますか? 例:
class A{
(Application.Current as App).RootFrame.Obscured += onObScuredA;
private void onObScuredA(object sender, ObscuredEventArgs e) {
//Some code here
}
}
class B{
(Application.Current as App).RootFrame.Obscured += onObScuredB;
private void onObScuredB(object sender, ObscuredEventArgs e) {
//Some other code here
}
}
イベントがトリガーされると、A と B の両方のインスタンスが作成されている場合、onObScuredA() と onObScuredB() の両方がトリガーされますか? イベントハンドラーと App.xaml.cs クラスにそれぞれのメソッドを追加して、どのイベントハンドラーが追加されたかを確認できる正しい方法はありますか?
ありがとう。