Should I pass just data or the whole instance that generates data between view models?

Viewed 41

My main view consists of a user control (UC1) and a corresponding UCViewModel1 that's responsible to select ip address and setup rtsp client, initialize it and subscribe to a FrameReceived event. My other user control (UC2) and its corresponding UCViewModel2 is responsible to show frames received in UCViewModel1. My design is to use a built-in mediator CommunityToolkit.Mvvm.ComponentModel.Messenger to send those frames from UCViewModel1 to UCViewModel2.

enter image description here

In the future I might have other user controls that should also receive those frames.

My question is, from MVVM stand pont, is it better to pass the rtsp client instance to each ViewModel so each view model will subscribe to the FrameReceived event instead of passing the frames with Messenger?

0 Answers
Related