Esempio n. 1
0
        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();
                }
            }
        }
Esempio n. 2
0
 public static void Reset()
 {
     _options = new SerializedOptions();
 }