/// <summary> /// Executes once LoadRequest has executed. Will also happen when deserializing cached data /// </summary> public override object Deserialize(DayLoadContext loadContext, Type objectType, Stream stream) { if (stream == null) { throw new ArgumentNullException("stream"); } string html = PageParser.GetHtml(stream); var entries = PageParser.ExtractEntriesFromHtml(html, false); var viewModel = new DeathsViewModel(loadContext); if (loadContext.ReverseOrder) { entries.Reverse(); } var groupings = entries.GroupBy(PageParser.GroupByYear()); foreach (IGrouping <string, Entry> grouping in groupings) { var displayGroup = new GroupedEntries { Name = grouping.Key, Entries = grouping.ToList() }; viewModel.Deaths.Add(displayGroup); } return(viewModel); }
/// <summary> /// Executes once LoadRequest has executed. Will also happen when deserializing cached data /// </summary> public override object Deserialize(DayLoadContext loadContext, Type objectType, Stream stream) { if (stream == null) throw new ArgumentNullException("stream"); string html = PageParser.GetHtml(stream); var entries = PageParser.ExtractEntriesFromHtml(html, false); var viewModel = new DeathsViewModel(loadContext); if (loadContext.ReverseOrder) { entries.Reverse(); } var groupings = entries.GroupBy(PageParser.GroupByYear()); foreach (IGrouping<string, Entry> grouping in groupings) { var displayGroup = new GroupedEntries { Name = grouping.Key, Entries = grouping.ToList() }; viewModel.Deaths.Add(displayGroup); } return viewModel; }