Sync settings and update changes across all instances in multiple instance uwp app
Asked Answered
N

2

0

I am designing an uwp app with multiple instances, I want to sync settings across all instances so that when I change a setting in one instance all the instances produce the same effect. How do I go about this??

Nightstick answered 18/4, 2020 at 10:36 Comment(0)
N
0

The right way to detect changes in settings across multiple instances is handle ApplicationData.DataChanged event across all instances and after changing any settings execute ApplicationData.SignalDataChanged() which will invoke ApplicationData.DataChanged across all instances. Loading the Localsettings when DataChanged event is fired or storing the key of LocalSettings changed before executing ApplicationData.SignalDataChanged() and only reloading settings with that specific key are the ways to handle changes in LocalSettings.

Nightstick answered 26/6, 2020 at 11:17 Comment(0)
N
0

Create an out-of-proc appservice as explained in this article, disable multiinstance for appservice. In the appservice code along with storing the created appservice connection store a static list of all the appservice created by all the new app instance. Whenever settings is changed send response to the appservice and from the service relay that message to all other app instance stored in static list. In the app itself react to settings changes when response is recieved. Also manage/update the list when an app instance is closed.

Nightstick answered 20/4, 2020 at 13:54 Comment(0)
N
0

The right way to detect changes in settings across multiple instances is handle ApplicationData.DataChanged event across all instances and after changing any settings execute ApplicationData.SignalDataChanged() which will invoke ApplicationData.DataChanged across all instances. Loading the Localsettings when DataChanged event is fired or storing the key of LocalSettings changed before executing ApplicationData.SignalDataChanged() and only reloading settings with that specific key are the ways to handle changes in LocalSettings.

Nightstick answered 26/6, 2020 at 11:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.