I made this post earlier about storing a list with the App class: List does not get saved when I use Application.Current.SavePropertiesAsync in Xamarin forms
And it turned out it was possible to do it with a json-implementation. However I now face another task which is to store an ImageSource
locally.
With my current code where I try to store a ImageSource locally with the App class it does not get saved when I restart the app.
var setImage = new PhotoResultEventArgs(App.imageData, App.imageWidth, App.imageHeight);
photo.Source = ImageSource.FromStream(() => new MemoryStream(setImage.Image));
Application.Current.Properties["photo"] = photo.Source;
await Application.Current.SavePropertiesAsync();
It returns null when I restart the app:
if (Application.Current.Properties.ContainsKey("photo"))
{
//i dont reach this code
}
Is there anyway to store an ImageSource with the App class by converting it somehow or do I have to look for an another solution? If so I would appreciate any links, tips I can get.