jeudi 27 juillet 2017

How properly arrange notifying mechanism between GUI and Model in MVVM?

I faced with a following problem in my MVVM project. I have ViewModel object which has event notify the model when he has property updating from GUI.

This was working properly, but after this it took me updating property in model programmaly and refresh GUI accordingly. Therefore i added event property in the model for VIewModel notifying, and got hanged application.. Since i got next loop: model -> viewmodel -> GUI -> ViewModel -> model .. etc.

I may use following ways for solution:

1) To create two different methods in the model: for updating property from GUI and for updating programmaly.

2) In the model perform verification (through reflection)- which object call the method and later to do notify or not.

My question in the subject.. thank you!

Aucun commentaire:

Enregistrer un commentaire