public static IAsyncOperation <uint> RemoveQuestionsInReadList() { return(AsyncInfo.Run(async(cancellationToken) => { CheckSettingsAreLoaded(); JsonArray readList = await ReadListManager.GetReadListAsync(); // Search for read-list-questions in questions-list. uint removedQuestions = 0; foreach (IJsonValue jsonValue in readList) { string id = jsonValue.GetString(); if (questionsCollection.ContainsKey(id)) { if (questionsCollection.Remove(id)) { removedQuestions++; } } } return removedQuestions; })); }
public static void RemoveQuestionsAndSave(IList <string> keysToDelete) { // Remove from questions-list and add to read-questions-list. foreach (string key in keysToDelete) { if (questionsCollection.Remove(key)) { ReadListManager.AddReadQuestion(key); } else { // Removing a question that was not in the questions-list. Debugger.Break(); } } // Only save if at least one question was deleted. if (keysToDelete.Count > 0) { ReadListManager.LimitTo450AndSave(); // Do not wait until questions-save is completed. var saveOperation = QuestionsManager.SaveAsync(); // And refresh tile and badge. FeedManager.UpdateTileAndBadge(); } }