I have this Isolated Storage Function to write into storage :
public static void WriteIsolatedStorage(object ObjectToStore, StorageType Key)
{
using (var storage = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication())
using (var storageFile = storage.CreateFile(Key.ToString()))
{
var xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(string));
switch (Key)
{
case StorageType.UserCredentials:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(dmWFUserCredentials));
break;
case StorageType.BackgroundAgentUserCredentials:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(dmWFUserCredentials));
break;
case StorageType.UserProfile:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(dmWFUser));
break;
case StorageType.InboxItems:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(ObservableCollection<dmWFInboxItem>));
break;
case StorageType.InboxTileItems:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(ObservableCollection<dmInboxTileInfo>));
break;
case StorageType.DocumentHeaders:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(ObservableCollection<dmWFDocumentHeader>));
break;
case StorageType.SearchCache:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(List<List<dmWFDocumentHeader>>));
break;
case StorageType.FacebookProfile:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(dmFBUserProfile));
break;
case
StorageType.BaseUrl:
xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(dmWFURLSetting));
break;
default:
break;
}
xmlSerializer.Serialize(storageFile, ObjectToStore);
}
}
And then here is my function to get from this storage :
public static dmWFURLSetting GetBaseUrl(StorageType Key)
{
try
{
using (var storage = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication())
{
using (var storageFile = storage.OpenFile(Key.ToString(), System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite))
{
dmWFURLSetting result = new dmWFURLSetting();
var xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(dmWFURLSetting));
return (dmWFURLSetting)xmlSerializer.Deserialize(storageFile);
}
}
}
catch (Exception)
{
return null;
}
}
okay and then here is how i call these methods fromm front end and then viemodel, i am using mvvm fr this phone app. Frontend call :
public string URL = (WorkflowBase.BaseURL != null ? WorkflowBase.BaseURL.ToString() : "");
here is the public property in backend :
public static string BaseURL = AccTech.WP8.Helpers.IsolatedStorage.GetBaseUrl(Helpers.IsolatedStorage.StorageType.BaseUrl).BaseUrl.ToString();
okay so here comes the weird part, i know when i start the emulator after being closed completely the isolated storage(cache) is completely clean so if this function is called i will get a Null return... as you can see in my frontend call i made an inline if that if i get a null value, then make it "". so here is the error that i get when i run.
PS: if i make the URL static the app works
okay and here is the error i get when i try to step through the whole process :
i am physically unable to get this working i have tried everything google offers... but nothing happens , if someone can please give me an answer i will be delighted.
if you need more data or info please let me know