public async Task Preloadreadings(IList <Reading> majorReadings, IList <Reading> minoReadings) { ReadingsMajor = majorReadings.Select(x => new HistoryReadingViewModel(x, this)).ToList(); ReadingsMinor = minoReadings.Select(x => new HistoryReadingViewModel(x, this)).ToList(); firstDate = ReadingsMajor.FirstOrDefault()?.Reading.Time; var first = ReadingsMinor.FirstOrDefault()?.Reading.Time; if (first < firstDate || firstDate == new DateTime()) { firstDate = first; } lastDate = ReadingsMajor.LastOrDefault()?.Reading.Time; var last = ReadingsMajor.FirstOrDefault()?.Reading.Time; if (last > lastDate || lastDate == new DateTime()) { lastDate = last; } if (firstDate != null) { dateSpan = (lastDate.Value - firstDate.Value); } await LoadGraph(ReadingsMajor, ReadingsMinor); }
public void RemoveReading(HistoryReadingViewModel historyReadingViewModel) { ReadingsMajor.Remove(historyReadingViewModel); ReadingsMinor.Remove(historyReadingViewModel); }