public static bool Load() { // If already loaded... if (_options != null) { return(true); } try { var isoFile = IsolatedStorageFile.GetUserStoreForApplication(); if (isoFile.FileExists(Filename)) { var stream = IsolatedStorageFile.GetUserStoreForApplication().OpenFile(Filename, FileMode.Open); TextReader reader = new StreamReader(stream); var serializer = new XmlSerializer(typeof(SerializedOptions)); _options = serializer.Deserialize(reader) as SerializedOptions; reader.Close(); } return(true); } catch (FileNotFoundException) { // No options file found - that's okay return(true); } catch (Exception exc) { System.Diagnostics.Debug.WriteLine(exc); return(false); } finally { if (_options == null) { _options = new SerializedOptions(); } } }
public static void Reset() { _options = new SerializedOptions(); }