Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Xamarin Forms: Is it possible to save and retrieve an EpubBook data using SettingsPlugin?

$
0
0

I am using SettingsPlugin for saving values to local DB. Using this plugin I have saved an EpubBook data like below:

CrossSettings.Current.AddOrUpdateValue("epub", epubBook.ToString());

Retrieved the value like below:

string epubString = CrossSettings.Current.GetValueOrDefault("epub", string.Empty);
if (!string.IsNullOrWhiteSpace(epubString))
{
    //Need to convert string epub data to EpubBook data
}

I need to convert the string epub data to EpubBook? Is this possible? This is for caching the EpubBook data.

I have done the same using Application.Current.Properties and saving and retrieving is working fine there. Please see below code:

//Saving value
Application.Current.Properties["epub"] = epubBook;
//Retriving value
EpubBook epubBook = (EpubBook)Application.Current.Properties["epub"];

But the Application.Current.Properties values are clearing automatically after closing the app. That's why I start working on SettingsPlugin. So is there any way to save and retrieve an EpubBook using SettingsPlugin? If no suggests a way to caching the EpubBook data?


Viewing all articles
Browse latest Browse all 204402

Trending Articles