How to save and access server response around the app with C# (Xamarin Forms)? -


i trying create app receives json data server , want know how can access saved server response around app? example, json response can contain key "score", "username", etc , need display on different screen, after push new window (navigation.pushmodalasync(...)), can not access received data new window.

so far, able to:

  • send post request server
  • receive , deserialize json

now need able access response on app, on different screens, not able that.

serverresponseobject result = jsonconvert.deserializeobject<serverresponseobject>(json.tostring()); 

serverresponseobject class created me

i want able access "result" variable inside different pages, screens. access globally.

i have tried declare global variable , create class, class static , server response not static.

any suggestions (or new approaches) on problem, appreciated. thanks


update

if set class "serverresponseobject" static, can no longer use this:

serverresponseobject result = jsonconvert.deserializeobject<serverresponseobject>(json.tostring()); 

that means, have manually assign data server response every single class property , it's difficult update labels around app, when properties changed


Comments