c# - Where should the thread / task be started to see if you are still connected to a device (model or viewmodel)? -


I have a C # / MVVM application that works with a device. This device needs to be constantly checked to connect / disconnect the device. I was given a code that starts a thread (USB connection code project) that will constantly try to see if the device is connected or not. It will then use the callback to view modal to set the properties needed to be set.

But should the ViewModel thread not start and then call the appropriate methods "USB connection code project" to check it?

If I keep the thread in the model, then reading the other thread should probably use INOTifyPropertyChanged instead of the representative / callback .... right?

In the current code absolutely is correct.

There is absolutely nothing to check for a USB device, with view or logic; So this model is in.

The utility INotifyPropertyChanged is really painful, and is not very clearly obvious. A representative or event callback is a completely proper notification mechanism to tell the model to update its status. I will not change anything about the design described.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -