Bubbling up events .

后端 未结 6 2250
天涯浪人
天涯浪人 2020-12-08 07:46

I have multiple layers in an application and i find myself having to bubble up events to the GUI layer for doing status bar changes, etc . . I find myself having to write re

6条回答
  •  清歌不尽
    2020-12-08 08:13

    Unless I see a bit more of the design.. it'll be hard to give a good answer.

    WPF does bubble events up (automatically) the UI Component/Control tree... this has now been built into the framework. So I guess that's the recommended way :)

    The trouble with bypassing the middle man Layer2 is that Layer1 and Layer3 now know each other... are coupled. So its a tradeoff.. if you are okay with the coupling.. eliminate the middle man / invent a specialized component with this responsibility. However if you expect Layer 3 to be hot-swappable (low coupling), I'd say continue bubbling.

提交回复
热议问题