Exemple #1
0
        public void LoadStateFromIsoStorage()
        {
            if (!MainDataSource.Instance.IsActive)
            {
                UserDataSource        user      = CoreExtensions.LoadFromFile <UserDataSource>("user.xml");
                PinnedItemsCollection pins      = CoreExtensions.LoadFromFile <PinnedItemsCollection>("pins.xml");
                ForumCollection       forums    = CoreExtensions.LoadFromFile <ForumCollection>("forums.xml");
                UserBookmarks         bookmarks = CoreExtensions.LoadFromFile <UserBookmarks>("bookmarks.xml");
                ThreadTable           threads   = CoreExtensions.LoadFromFile <ThreadTable>("threads.xml");

                MainDataSource.Instance.CurrentUser = user;
                MainDataSource.Instance.Pins        = pins;
                MainDataSource.Instance.Forums      = forums;
                MainDataSource.Instance.Bookmarks   = bookmarks;
                MainDataSource.Instance.ThreadTable = threads;
            }
        }
Exemple #2
0
        private void LoadResourceFilesIntoIsoStore()
        {
            var dictionary = new Dictionary <string, string>();
            var storage    = IsolatedStorageFile.GetUserStoreForApplication();

            // add resource locations here.

            dictionary.Add(Constants.RESOURCE_PATH_CSS, Constants.FILE_PATH_CSS);
            dictionary.Add(Constants.RESOURCE_PATH_AWFUL_JAVASCRIPT, Constants.FILE_PATH_AWFUL_JAVASCRIPT);
            dictionary.Add(Constants.RESOURCE_PATH_JQUERY, Constants.FILE_PATH_JQUERY_JAVASCRIPT);
            dictionary.Add(Constants.RESOURCE_PATH_THREADVIEW, Constants.FILE_PATH_WWW);

            // copy them into storage
            foreach (var key in dictionary.Keys)
            {
                var path    = dictionary[key];
                var success = CoreExtensions.CopyResourceFileToIsoStore(key, path);
                success = success && storage.FileExists(path);

#if DEBUG
                if (success)
                {
                    using (var reader = new System.IO.StreamReader(
                               storage.OpenFile(path,
                                                System.IO.FileMode.Open,
                                                System.IO.FileAccess.Read)))
                    {
                        string text = reader.ReadToEnd();
                        Debug.WriteLine(text);
                    }
                }
#endif

                if (!success)
                {
                    throw new Exception("Could not save resources to storage!");
                }
            }
        }
Exemple #3
0
        public static ThreadViewPageState Load()
        {
            var state = CoreExtensions.LoadFromFile <ThreadViewPageState>(SAVE_FILE);

            return(state);
        }