internal async Task DismissEntryAsync(IncrementalLoadingCollectionOfEntries Reddit_Entries, Data.Data1 EntryToDismiss) { if (EntryToDismiss != null) { var Child = (from p in Reddit_Entries where p.data == EntryToDismiss select p) .FirstOrDefault(); if (Child != null) { Reddit_Entries.Remove(Child); await new Services.Persistance().AddDismissedAsync(Child.data.id); } } }
internal async Task <IncrementalLoadingCollectionOfEntries> LoadEntriesAsync(List <Child> Entries) { IncrementalLoadingCollectionOfEntries Response_Entries = null; LoadingEntries = true; try { if (Entries == null || Entries.Count == 0) { Reddit reddit = new Reddit(); var res = await reddit.GetEntriesAsync(Reddit.eKindOfGet.CleanSearchFromTheBeggining, 10); if (res.Success == false) { return(null); } Entries = res.value.data.children; } //To Tag the Read ones, and remove the Dissmissed ones. await FilterEntriesAsync(Entries); Services.SuspensionManager.PointerTo_ListOfEntries = Entries; //Reddit_Entries = new ObservableCollection<Child>(Entries); Response_Entries = new IncrementalLoadingCollectionOfEntries(this); foreach (var item in Entries) { Response_Entries.Add(item); } } catch { Response_Entries = null; } finally { LoadingEntries = false; } return(Response_Entries); }
internal async Task DismissEntriesAsync(IncrementalLoadingCollectionOfEntries Reddit_Entries, List <Child> EntriesToDismiss) { if (EntriesToDismiss != null) { try { List <string> IdsToDismiss = new List <string>(); foreach (var entry in EntriesToDismiss) { IdsToDismiss.Add(entry.data.id); Reddit_Entries.Remove(entry); } await new Services.Persistance().AddDismissedAsync(IdsToDismiss); } catch (Exception ex) { var messageDialog = new MessageDialog("Could not Dismiss all the visible entries." + Environment.NewLine + "Details: " + ex.Message); await messageDialog.ShowAsync(); } } }