使用此代码,我向 RootFrame.Obscured 添加了一个事件处理程序。
(Application.Current as App).RootFrame.Obscured += onObScured;
由于可以从 App 中的每个类访问 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 类上添加事件处理程序及其各自的方法是否正确,以便我可以确定添加了哪些事件处理程序?
谢谢。