public static DataFeedsPrefetcher GetInstance() { if (_instance == null) { _instance = new DataFeedsPrefetcher(); } return _instance; }
public void PreFetch() { string[] categories = { "news", "business", "technologyscience", "sports", "art", "design", "photography", "fashion", "lifestyle", "travel", "movie", "music" }; //string[] categories = { "news", "business", "technologyscience" }; foreach (var category in categories) { var mainCat = category; var cfb = CategoryConfigB.Config; var subCatsStg = cfb[mainCat]["subcat"]; var subCats = subCatsStg.Split('|'); List<Dictionary<string, string>> categoryInfoList = subCats.Select(subCat => cfb[subCat]).ToList(); foreach (var item in categoryInfoList) { string keywords = item["keyword"]; string storageName = "fbd-prefetch-" + item["cachename"]; bool isStorageFileExisted = false; using (IsolatedStorageFile f = IsolatedStorageFile.GetUserStoreForApplication()) { isStorageFileExisted = f.FileExists(storageName + ".xml"); } if (isStorageFileExisted) continue; var dataFetcher = new DataFeedsPrefetcher(); dataFetcher.FetchFeeds(keywords, new DataModel.UserToken { DataFetchType = storageName, Callback = null }); } } }