mardi 28 janvier 2020

how to update the using unit of some values in many pages

I have three pages A,B,C, and each of them has a Label to show a different distance value and the distance values can be presented as Km or Mile. The app provides a settings page for the user to change the distance unit globally. My question is how to update the UI globally when the distance unit setting is changed?

My current solution is to let every page that has distance values subscribe to the unit changed event and update its UI element separately when the event is invoked, but the app will end up having many redundant codes in this way.

Is there any elegant solution to this issue?

Aucun commentaire:

Enregistrer un commentaire